Skip to content

Commit

Permalink
chore(package): update all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ruscon committed Mar 24, 2020
1 parent 42aa855 commit c4456cb
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 146 deletions.
File renamed without changes.
94 changes: 94 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* How to install and use
* @link {https://www.arden.nl/setting-up-a-gatsby-js-starter-with-type-script-es-lint-prettier-and-pre-commit-hooks}
*
* Rule documentation
* @link {https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md}
*/
module.exports = {
root: true,
env: {
browser: true,
node: true,
es6: true,
mocha: true,
},
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'prettier',
'prettier/@typescript-eslint',
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
parserOptions: {
project: './tsconfig.eslint.json',
},
plugins: ['@typescript-eslint', 'import', 'prettier'],
rules: {
'prettier/prettier': 'error',
'import/no-deprecated': ['error'],
'import/order': ['error', { groups: ['builtin', 'external', 'parent', 'sibling', 'index'] }],
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
'@typescript-eslint/explicit-function-return-type': ['error'],
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-require-imports': ['error'],
'@typescript-eslint/no-use-before-define': ['error'],
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/promise-function-async': [
'error',
{
allowAny: true,
},
],
'@typescript-eslint/ban-types': [
'error',
{
types: {
Number: {
message: 'Use number instead',
fixWith: 'number',
},
Function: {
message: 'Use () => void instead',
fixWith: '() => void',
},
Object: {
message: 'Use object instead',
fixWith: 'object',
},
String: {
message: 'Use string instead',
fixWith: 'string',
},
},
},
],
},
overrides: [
{
files: ['*.js', '*.jsx'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
],
};
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
fetch-depth: 1
fetch-depth: 0

- name: Lints Pull Request commits
uses: wagoid/commitlint-github-action@v1.2.2
uses: wagoid/commitlint-github-action@v1

build:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [8.x, 10.x, 12.x, 13.x]
node-version: [10.x, 12.x, 13.x]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
14 changes: 12 additions & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"ui": "bdd",
"project": "tsconfig.spec.json",
"require": ["ts-node/register", "source-map-support/register", "tsconfig-paths/register", "dotenv-safe/config", "./test/common.opts.ts"]
"project": "tsconfig.json",
"check-leaks": true,
"full-trace": true,
"recursive": true,
"exit": true,
"require": [
"ts-node/register/transpile-only",
"source-map-support/register",
"tsconfig-paths/register",
"dotenv-safe/config",
"./test/common.opts.ts"
]
}
20 changes: 0 additions & 20 deletions bin/prepublish.js

This file was deleted.

21 changes: 21 additions & 0 deletions bin/prepublish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { writeFileSync, copyFileSync } from 'fs';
import originPackage from '../package.json';

const distPackage: Record<string, any> = originPackage;
distPackage.module = './index.js';
distPackage.main = './index.js';
distPackage.types = './index.d.ts';
delete distPackage.scripts;
delete distPackage.devDependencies;
delete distPackage.config;
delete distPackage.husky;
delete distPackage.files;
delete distPackage.directories;
delete distPackage['lint-staged'];

writeFileSync('./dist/package.json', JSON.stringify(distPackage, null, ' '));

const copyFiles = ['README.md'];
for (const file of copyFiles) {
copyFileSync(`./${file}`, `./dist/${file}`);
}
81 changes: 41 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@
"retry"
],
"engines": {
"node": ">=8.9.0"
"node": ">=10"
},
"main": "src/index.ts",
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "npm run pre-commit",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS && npm run pre-commit",
"post-commit": "git update-index --again"
}
},
"lint-staged": {
"*.{ts,json}": [
"npm run format"
"*.{ts,tsx,json,js,jsx}": [
"npm run format:base"
]
},
"config": {
Expand All @@ -42,27 +41,24 @@
"scripts": {
"commit": "git-cz",
"test": "mocha 'test/unit/**/*.spec.ts' 'test/e2e/**/*.spec.ts'",
"test:fast": "TS_NODE_TRANSPILE_ONLY=true npm run test",
"test:all": "mocha --timeout 15000 'test/**/*.spec.ts'",
"test:unit": "mocha 'test/unit/**/*.spec.ts'",
"test:e2e": "mocha 'test/e2e/**/*.spec.ts'",
"test:integration": "mocha --timeout 15000 'test/integration/**/*.spec.ts'",
"test:integration:fast": "mocha --timeout 15000 'test/integration/**/*.spec.ts'",
"test:all": "mocha --timeout 15000 'test/**/*.spec.ts'",
"test:all:fast": "TS_NODE_TRANSPILE_ONLY=true mocha --timeout 15000 'test/**/*.spec.ts'",
"coverage": "nyc npm test",
"coverage:fast": "TS_NODE_TRANSPILE_ONLY=true nyc npm run test:fast",
"coverage:all": "nyc npm run test:all",
"coverage:all:fast": "TS_NODE_TRANSPILE_ONLY=true nyc npm run test:all:fast",
"format": "prettier \"**/*.{ts,js,json}\" --write",
"format:staged": "lint-staged",
"lint": "npm run lint:config:check && tslint -c tslint.json -p tsconfig.json --format stylish",
"lint:config:check": "tslint-config-prettier-check ./tslint.json",
"lint": "npm run lint:base -- '.'",
"lint:base": "npm run lint:config:check && eslint --ignore-path .gitignore --ext .ts,.tsx,.json,.js,.jsx",
"lint:config:check": "eslint --print-config src/index.ts | eslint-config-prettier-check",
"format": "npm run format:base -- '.'",
"format:base": "npm run lint:base -- --fix",
"format:staged": "git add . && lint-staged",
"build": "rimraf dist && tsc -p tsconfig.build.json",
"remark": "remark README.md CHANGELOG.md CONTRIBUTING.md CODE_OF_CONDUCT.md .github/ -o -f -q && git add .",
"pre-commit": "git add . && npm run format:staged && npm run remark && npm run lint && npm run coverage:all && npm run build",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && remark CHANGELOG.md -o -f -q && git add CHANGELOG.md",
"prepublishOnly": "echo \"use 'npm run publish'\" && exit 1",
"publish": "npm run build && node bin/prepublish.js && npm publish dist",
"publish": "npm run build && ts-node -T bin/prepublish.ts && npm publish dist",
"publish:dev": "npm run publish --tag dev",
"publish:dev:dry": "npm run publish:dev --dry-run",
"version": "echo \"use 'npm run release'\" && exit 1",
Expand All @@ -71,50 +67,55 @@
"github-release": "env-cmd conventional-github-releaser -p angular"
},
"peerDependencies": {
"square-connect": "^2.20190814.0"
"square-connect": "^3.20200226.0"
},
"dependencies": {},
"devDependencies": {
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@commitlint/travis-cli": "^8.2.0",
"@types/chai": "^4.2.8",
"@types/chai": "^4.2.11",
"@types/chai-as-promised": "^7.1.2",
"@types/mocha": "^7.0.1",
"@types/node": "^13.5.3",
"@types/sinon": "^7.5.0",
"@types/mocha": "^7.0.2",
"@types/node": "^13.9.3",
"@types/sinon": "^7.5.2",
"@types/square-connect": "^2.20190814.3",
"@types/superagent": "^4.1.4",
"@types/superagent": "^4.1.7",
"@typescript-eslint/eslint-plugin": "^2.25.0",
"@typescript-eslint/parser": "^2.25.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"commitizen": "^4.0.0",
"conventional-changelog-cli": "^2.0.27",
"conventional-github-releaser": "^3.1.3",
"cz-conventional-changelog": "^3.1.0",
"dotenv-safe": "^8.2.0",
"env-cmd": "^10.0.1",
"husky": "^4.2.1",
"lint-staged": "^10.0.7",
"mocha": "^7.0.1",
"env-cmd": "^10.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.3",
"lint-staged": "^10.0.9",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^1.23.0",
"nock": "^12.0.0",
"nock": "^12.0.3",
"nyc": "^15.0.0",
"prettier": "^1.18.2",
"prettier": "^2.0.2",
"remark-cli": "^7.0.0",
"remark-frontmatter": "^1.3.2",
"remark-github": "^8.0.0",
"remark-frontmatter": "^1.3.3",
"remark-github": "^9.0.0",
"remark-lint-emphasis-marker": "^1.0.3",
"remark-lint-strong-marker": "^1.0.3",
"rimraf": "^3.0.1",
"sinon": "^9.0.0",
"rimraf": "^3.0.2",
"sinon": "^9.0.1",
"source-map-support": "^0.5.16",
"square-connect": "^2.20200122.0",
"square-connect": "^3.20200226.0",
"standard-version": "^7.0.0",
"superagent": "^5.2.1",
"ts-node": "^8.4.1",
"superagent": "^5.2.2",
"ts-node": "^8.8.1",
"tsconfig-paths": "^3.9.0",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.7.5"
"typescript": "^3.8.3"
}
}
20 changes: 4 additions & 16 deletions test/e2e/client/square-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ describe('SquareClient (e2e)', (): void => {
});

it('should NOT retry 501 http status', async (): Promise<any> => {
nock(basePath)
.get(/.*/)
.times(1000)
.reply(501);
nock(basePath).get(/.*/).times(1000).reply(501);

return new SquareClient(accessToken, config)
.getLocationsApi()
Expand All @@ -39,10 +36,7 @@ describe('SquareClient (e2e)', (): void => {
});

it('should NOT retry 400 http status', async (): Promise<any> => {
nock(basePath)
.get(/.*/)
.times(1000)
.reply(400);
nock(basePath).get(/.*/).times(1000).reply(400);

return new SquareClient(accessToken, config)
.getLocationsApi()
Expand Down Expand Up @@ -73,10 +67,7 @@ describe('SquareClient (e2e)', (): void => {
});

it('should retry 500 http status', async (): Promise<any> => {
nock(basePath)
.get(/.*/)
.times(1000)
.reply(500);
nock(basePath).get(/.*/).times(1000).reply(500);

return new SquareClient(accessToken, config)
.getLocationsApi()
Expand All @@ -86,10 +77,7 @@ describe('SquareClient (e2e)', (): void => {
});

it('should retry 503 http status', async (): Promise<any> => {
nock(basePath)
.get(/.*/)
.times(1000)
.reply(503);
nock(basePath).get(/.*/).times(1000).reply(503);

return new SquareClient(accessToken, config)
.getLocationsApi()
Expand Down
5 changes: 1 addition & 4 deletions test/integration/client/square-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ describe('SquareClient (integration)', (): void => {
});

it('should retrieve data', async (): Promise<any> => {
return new SquareClient(accessToken, config)
.getLocationsApi()
.listLocations()
.should.eventually.be.fulfilled.and.have.property('locations');
return new SquareClient(accessToken, config).getLocationsApi().listLocations().should.eventually.be.fulfilled.and.have.property('locations');
});
});

Expand Down
5 changes: 1 addition & 4 deletions test/unit/utils/common.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ describe('common.utils (unit)', (): void => {

it('should correctly merge class props with simple object', async (): Promise<any> => {
const error: Error = new Error();
return mergeDeepProps(error, { name: 'x' })
.should.be.instanceOf(Error)
.and.deep.eq(error)
.and.have.property('name', 'x');
return mergeDeepProps(error, { name: 'x' }).should.be.instanceOf(Error).and.deep.eq(error).and.have.property('name', 'x');
});
});
});
Loading

0 comments on commit c4456cb

Please sign in to comment.