Skip to content

Commit

Permalink
feat(commons-api): add commons-api package
Browse files Browse the repository at this point in the history
- feat: add error handler modules

- chore(release): 0.1.0

- fix: remove unecessary shallow copy

- chore(release): 0.1.1

- build: build before publish

  add lodash to check error issue

- chore(release): 0.1.2
  • Loading branch information
@jotadeveloper authored and sergiohgz committed Jul 23, 2019
1 parent 8be1f76 commit 13dfa76
Show file tree
Hide file tree
Showing 19 changed files with 7,935 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/commons-api/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["@verdaccio", {"typescript": true}]]
}
148 changes: 148 additions & 0 deletions core/commons-api/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
version: 2

aliases:
- &defaults
working_directory: ~/commons
- &node12_executor
docker:
- image: circleci/node:12
- &node8_executor
docker:
- image: circleci/node:8
- &node10_executor
docker:
- image: circleci/node:10
- &default_executor
<<: *node10_executor
- &repo_key repo-{{ .Branch }}-{{ .Revision }}
- &coverage_key coverage-{{ .Branch }}-{{ .Revision }}
- &base_config_key base-config-{{ .Branch }}-{{ .Revision }}
- &yarn_cache_key yarn-sha-{{ checksum "yarn.lock" }}
- &restore_repo
restore_cache:
keys:
- *repo_key
- &ignore_non_dev_branches
filters:
tags:
only: /.*/
branches:
ignore:
- /release\/.*/
- &execute_on_release
filters:
tags:
only: /(v)?[0-9]+(\.[0-9]+)*/
branches:
ignore:
- /.*/

jobs:
prepare:
<<: *defaults
<<: *default_executor
steps:
- *restore_repo
- checkout
- restore_cache:
key: *base_config_key
- run:
name: 'Base environment setup'
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- save_cache:
key: *base_config_key
paths:
- ~/.npmrc
- ~/.gitconfig
- restore_cache:
key: *yarn_cache_key
- run:
name: Install Js dependencies
command: yarn install --no-progress
- save_cache:
key: *yarn_cache_key
paths:
- ~/.yarn
- ~/.cache/yarn
- node_modules
- save_cache:
key: *repo_key
paths:
- ~/commons

check_lint:
<<: *defaults
<<: *default_executor
steps:
- *restore_repo
- run:
name: Check defined rules
command: yarn lint

test_node12:
<<: *defaults
<<: *node12_executor
steps:
- *restore_repo
- run:
name: Test with Node 12
command: yarn test

test_node8:
<<: *defaults
<<: *node8_executor
steps:
- *restore_repo
- run:
name: Test with Node 8
command: yarn test

test_node10:
<<: *defaults
<<: *node10_executor
steps:
- *restore_repo
- run:
name: Test with Node 10
command: yarn test

publish_package:
<<: *defaults
<<: *default_executor
steps:
- *restore_repo
- restore_cache:
key: *base_config_key
- run:
name: Publish
command: yarn publish

workflows:
version: 2
workflow:
jobs:
- prepare:
<<: *ignore_non_dev_branches
- check_lint:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_node12:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_node8:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_node10:
requires:
- prepare
<<: *ignore_non_dev_branches
- publish_package:
requires:
- check_lint
- test_node12
- test_node8
- test_node10
<<: *execute_on_release
12 changes: 12 additions & 0 deletions core/commons-api/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# 2 space indentation
[{.,}*.{js,yml,yaml}]
indent_style = space
indent_size = 2
5 changes: 5 additions & 0 deletions core/commons-api/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
coverage/
lib/
.nyc_output
tests-report/
12 changes: 12 additions & 0 deletions core/commons-api/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": [
"@verdaccio"
],
"plugins": ["jest"],
"rules": {
"@typescript-eslint/no-use-before-define": 0
},
"env": {
"jest/globals": true
}
}
16 changes: 16 additions & 0 deletions core/commons-api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.DS_Store
package-lock.json
_storage/
lib/
node_modules/
coverage/
*.lock.*

# IDE
.vscode/*
.idea/
*.log
*.tar
*.gz
*.tmp-*
coverage/
23 changes: 23 additions & 0 deletions core/commons-api/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
src/
tests-report/
.nyc_output
.editorconfig
.gitignore
yarn-error.log
yarn.lock
.eslintrc
.babelrc
test/
.eslintignore
.eslintrc.yml
.npmignore
.travis.yml
coverage/
types/
.idea/
.circleci/
tsconfig.json
jest.config.js
.DS_Store
.prettierrc
*.spec.js
16 changes: 16 additions & 0 deletions core/commons-api/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"semi": true,
"singleQuote": true,
"useTabs": false,
"printWidth": 800,
"tabWidth": 2,
"bracketSpacing": true,
"overrides": [
{
"files": "*.test.js",
"options": {
"semi": true
}
}
]
}
28 changes: 28 additions & 0 deletions core/commons-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.1.2](https://github.com/verdaccio/commons-api/compare/v0.1.1...v0.1.2) (2019-07-15)


### Build System

* build before publish ([f3d952d](https://github.com/verdaccio/commons-api/commit/f3d952d))



### [0.1.1](https://github.com/verdaccio/commons-api/compare/v0.1.0...v0.1.1) (2019-07-12)


### Bug Fixes

* remove unecessary shallow copy ([af7bc7c](https://github.com/verdaccio/commons-api/commit/af7bc7c))



## 0.1.0 (2019-06-25)


### Features

* add error handler modules ([936212b](https://github.com/verdaccio/commons-api/commit/936212b))
21 changes: 21 additions & 0 deletions core/commons-api/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Verdaccio team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions core/commons-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# @verdaccio/commons-api

commons api utilities for verdaccio

[![verdaccio (latest)](https://img.shields.io/npm/v/@verdaccio/commons-api/latest.svg)](https://www.npmjs.com/package/@verdaccio/commons-api)
[![docker pulls](https://img.shields.io/docker/pulls/verdaccio/verdaccio.svg?maxAge=43200)](https://verdaccio.org/docs/en/docker.html)
[![backers](https://opencollective.com/verdaccio/tiers/backer/badge.svg?label=Backer&color=brightgreen)](https://opencollective.com/verdaccio)
[![stackshare](https://img.shields.io/badge/Follow%20on-StackShare-blue.svg?logo=stackshare&style=flat)](https://stackshare.io/verdaccio)
[![discord](https://img.shields.io/discord/388674437219745793.svg)](http://chat.verdaccio.org/)
[![node](https://img.shields.io/node/v/@verdaccio/commons-api/latest.svg)](https://www.npmjs.com/package/@verdaccio/commons-api)
![MIT](https://img.shields.io/github/license/mashape/apistatus.svg)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/verdaccio/localized.svg)](https://crowdin.com/project/verdaccio)


[![Twitter followers](https://img.shields.io/twitter/follow/verdaccio_npm.svg?style=social&label=Follow)](https://twitter.com/verdaccio_npm)
[![Github](https://img.shields.io/github/stars/verdaccio/verdaccio.svg?style=social&label=Stars)](https://github.com/verdaccio/verdaccio/stargazers)
12 changes: 12 additions & 0 deletions core/commons-api/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint comma-dangle: 0 */

module.exports = {
name: 'common-api-jest',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': 'babel-jest'
},
verbose: true,
collectCoverage: true,
coveragePathIgnorePatterns: ['node_modules', '_storage', 'fixtures']
};
65 changes: 65 additions & 0 deletions core/commons-api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@verdaccio/commons-api",
"version": "0.1.2",
"description": "commons api utilities for verdaccio",
"main": "lib/index.js",
"keywords": [
"http",
"verdaccio",
"api"
],
"devDependencies": {
"@commitlint/cli": "8.0.0",
"@commitlint/config-conventional": "8.0.0",
"@types/http-errors": "1.6.1",
"@types/jest": "24.0.15",
"@types/lodash": "4.14.136",
"@types/node": "12.6.2",
"@verdaccio/babel-preset": "0.2.1",
"@verdaccio/eslint-config": "0.0.1",
"codecov": "3.5.0",
"eslint": "5.16.0",
"husky": "2.5.0",
"in-publish": "2.0.0",
"jest": "24.8.0",
"lint-staged": "8.2.1",
"lodash": "4.17.14",
"standard-version": "6.0.1",
"typescript": "3.5.2"
},
"author": "Juan Picado <[email protected]>",
"private": false,
"license": "MIT",
"dependencies": {
"http-errors": "1.7.3"
},
"lint-staged": {
"*.{ts, json}": [
"npm run lint",
"git add"
]
},
"homepage": "https://github.com/verdaccio/commons-api",
"scripts": {
"commitmsg": "commitlint -e $GIT_PARAMS",
"coverage": "codecov",
"release": "standard-version -a -s",
"test": "jest .",
"lint": "npm run type-check && eslint . --ext .js,.ts",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"build": "npm run build:types && npm run build:js",
"build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src/ --out-dir lib --extensions \".ts,.tsx\"",
"precommit": "lint-staged",
"prepublish": "in-publish && npm run build || not-in-publish"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"engines": {
"node": ">=8"
}
}
Loading

0 comments on commit 13dfa76

Please sign in to comment.