Skip to content

Commit

Permalink
fix(package): up deps, fix vuls, update ci flow (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub authored Feb 25, 2021
1 parent d1ccfec commit 7f6c933
Show file tree
Hide file tree
Showing 20 changed files with 3,618 additions and 925 deletions.
9 changes: 3 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.test.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'eslint-config-qiwi',
'prettier',
],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'sonarjs/no-duplicate-string': 'off',
'unicorn/no-null': 'off',
'@typescript-eslint/no-var-requires': 'off',
'unicorn/prefer-spread': 'off'
},
root: true,
env: {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ build
dist
lib
target
buildstamp.json

#Docs
docs
Expand Down
104 changes: 82 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,86 @@
language: node_js
node_js:
- '12'
cache: yarn
node_js: 14
install: skip
os: linux
dist: focal

before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
jobs:
fast_finish: true
include:
- stage: verify
if: branch != master AND type != pull_request
install: yarn
script:
- yarn build
- if [ "$CI_TEST" != "false" ]; then
yarn test;
fi
- &build
stage: build
if: branch = master
install: yarn
script: yarn build
# https://docs.travis-ci.com/user/using-workspaces/
workspaces:
create:
name: linux-shared
paths:
- target
- flow-typed
- typings
- docs
- node_modules
- <<: *build
os: windows
if: branch = master AND env(CI_WIN_BUILD) = true AND type = pull_request
# https://travis-ci.community/t/timeout-after-build-finished-and-succeeded/1336/2
env: YARN_GPG=no
workspaces:
create:
name: win-shared
paths:
- target
- node_modules

after_script:
- ./cc-test-reporter format-coverage -t lcov ./coverage/lcov.info
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
- &test
if: branch = master AND type = pull_request AND env(CI_TEST) != false
stage: test
install: skip
script: yarn test
workspaces:
use: linux-shared
- <<: *test
node_js: 12
- <<: *test
if: branch = master AND type != pull_request AND env(CI_TEST) != false
before_script:
- if [ "$CC_TEST_REPORTER_ID" != "" ]; then
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter;
chmod +x ./cc-test-reporter;
./cc-test-reporter before-build;
fi
script:
- if [ "$CC_TEST_REPORTER_ID" != "" ]; then
yarn test:report;
else
yarn test;
fi
after_script:
- if [ "$CC_TEST_REPORTER_ID" != "" ]; then
./cc-test-reporter format-coverage -t lcov ./coverage/lcov.info;
./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT;
fi
- <<: *test
if: branch = master AND type = pull_request AND env(CI_WIN_BUILD) = true AND env(CI_TEST) != false
os: windows
env: YARN_GPG=no
workspaces:
use: win-shared

install:
- yarn cache clean
- yarn

script:
- yarn run build
- yarn test:report

deploy:
provider: script
skip_cleanup: true
script:
- npx -p @qiwi/semrel-toolkit semrel
- stage: release
if: branch = master AND type != pull_request AND env(CI_RELEASE) = true
workspaces:
use: linux-shared
install: skip
script: npx -p @qiwi/semrel-toolkit semrel -e @qiwi/semrel-config
21 changes: 10 additions & 11 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"preset": "ts-jest",
"testEnvironment": "jsdom",
"transform": {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.jsx?$": "@swissquote/crafty-preset-jest/src/esm-transformer"
},
"collectCoverage": true,
"coveragePathIgnorePatterns": [
"types.ts"
],
"collectCoverageFrom": [
"<rootDir>/src/main/ts/**/*.ts"
"<rootDir>/src/main/**/*.(j|t)s"
],
"coveragePathIgnorePatterns": [],
"testMatch": [
"<rootDir>/src/test/ts/**/*.ts",
"<rootDir>/src/test/js/**/*.js"
"<rootDir>/src/test/js/**/*.js",
"<rootDir>/src/test/ts/**/*.ts"
],
"testPathIgnorePatterns": [
"/node_modules/",
Expand All @@ -23,12 +25,9 @@
"json",
"node"
],
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
"globals": {
"ts-jest": {
"tsConfig": "tsconfig.test.json"
"tsconfig": "<rootDir>/tsconfig.test.json"
}
}
}
99 changes: 45 additions & 54 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,29 @@
"flow-typed"
],
"scripts": {
"jest": "jest -w 2 --config=jest.config.json",
"lint": "eslint src/**/*.ts",
"clean": "rimraf target typings flow-typed buildcache docs coverage buildstamp.json",
"lint": "eslint src/**/*.{ts,js}",
"lint:fix": "yarn lint --fix",
"test": "yarn lint && yarn jest",
"clean": "rimraf target typings docs flow-typed",
"build": "yarn clean && yarn build:es5 && yarn build:es6 && yarn build:ts && yarn build:libdef && yarn docs && yarn uglify",
"build:es5": "mkdir -p target/es5 && tsc -p tsconfig.es5.json",
"build:es6": "mkdir -p target/es6 && tsc -p tsconfig.es6.json",
"build:ts": "cp -r src/main/ts/ target/ts/",
"build:libdef": "libdefkit --tsconfig=tsconfig.es5.json --tsconfig=tsconfig.es6.json",
"format": "prettier --write \"src/**/*.ts\"",
"test": "npm-run-all -p -l lint test:unit test:depcheck test:depaudit",
"test:unit": "jest --config=jest.config.json --runInBand",
"test:deps": "npm-run-all -p -l test:depcheck test:depauditfix",
"test:depcheck": "npx depcheck --ignores tslib,@swissquote/crafty-preset-jest,@types/jest,@types/node",
"test:depaudit": "yarn audit --level=moderate; [[ $? -ge 4 ]] && exit 1 || exit 0",
"test:depauditfix": "npx yarn-audit-fix --audit-level=moderate",
"test:report": "yarn test && yarn push:report",
"prebuild": "yarn clean && npx buildstamp --git --out.path buildstamp.json",
"build": "npm-run-all -p -l build:es5 build:es6 build:ts build:libdef build:bundle docs",
"build:es5": "mkdirp target/es5 && tsc -p tsconfig.es5.json",
"build:es6": "mkdirp target/es6 && tsc -p tsconfig.es6.json",
"build:ts": "cpy src/main/ts/ target/ts/",
"build:bundle": "microbundle --tsconfig tsconfig.es5.json build src/main/ts/index.ts -o target/bundle",
"build:libdef": "libdefkit --tsconfig=tsconfig.es5.json --tsconfig=tsconfig.es6.json",
"docs": "typedoc ./src/main/ts",
"coveralls:push": "cat ./coverage/lcov.info | coveralls || exit 0",
"push:report": "yarn coveralls:push",
"coveralls:push": "cat ./coverage/lcov.info | coveralls",
"docs": "typedoc --readme README.md --tsconfig tsconfig.json src/main",
"uglify": "for f in $(find target -name '*.js'); do short=${f%.js}; terser -c -m -o $short.js -- $f; done",
"postupdate": "yarn && yarn build && yarn test"
"postupdate": "yarn && yarn test:deps && yarn build && yarn test"
},
"repository": {
"type": "git",
Expand All @@ -49,59 +56,43 @@
},
"homepage": "https://github.com/qiwi/event-transmitter#readme",
"dependencies": {
"@qiwi/substrate": "^1.19.4",
"@qiwi/substrate": "^1.20.3",
"@types/lodash.once": "^4.1.6",
"fast-luhn": "^1.1.1",
"@types/lodash.set": "^4.3.6",
"@types/safe-json-stringify": "^1.1.2",
"@types/platform": "^1.3.3",
"fast-luhn": "^2.0.0",
"lodash.once": "^4.1.1",
"lodash.set": "^4.3.2",
"platform": "^1.3.6",
"safe-json-stringify": "^1.2.0",
"stacktrace-js": "^2.0.2",
"tslib": "^2.0.3"
"tslib": "^2.1.0"
},
"devDependencies": {
"@qiwi/libdefkit": "^2.1.5",
"@types/jest": "^26.0.15",
"@types/jest-json-schema": "^2.1.3",
"@types/lodash.set": "^4.3.6",
"@types/platform": "^1.3.3",
"@types/safe-json-stringify": "^1.1.2",
"user-agents": "^1.0.573",
"@types/user-agents": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^3.6.1",
"@typescript-eslint/parser": "^3.6.1",
"@qiwi/libdefkit": "^2.1.6",
"@qiwi/npm-run-all": "^4.1.6",
"@swissquote/crafty-preset-jest": "^1.13.7",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.31",
"coveralls": "^3.1.0",
"cross-fetch": "^3.0.6",
"eslint": "^7.14.0",
"eslint-config-qiwi": "1.10.0",
"eslint-plugin-typescript": "^0.14.0",
"esm": "^3.2.25",
"cpy-cli": "^3.1.1",
"eslint": "^7.20.0",
"eslint-config-prettier": "^8.1.0",
"eslint-config-qiwi": "^1.10.7",
"jest": "^26.6.3",
"microbundle": "^0.13.0",
"mkdirp": "^1.0.4",
"prettier": "^2.2.1",
"prettier-config-qiwi": "^1.3.3",
"rimraf": "^3.0.2",
"terser": "^4.8.0",
"ts-jest": "^26.4.4",
"typedoc": "^0.19.2",
"typedoc-plugin-external-module-name": "^4.0.3",
"typescript": "^4.1.2",
"typescript-eslint-parser": "^22.0.0",
"user-agents": "^1.0.559"
"terser": "^5.6.0",
"ts-jest": "^26.5.2",
"typedoc": "^0.20.28",
"typescript": "4.2.2",
"cross-fetch": "^3.0.6"
},
"release": {
"branch": "master",
"verifyConditions": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@qiwi/semantic-release-gh-pages-plugin"
],
"prepare": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
],
"publish": [
"@semantic-release/npm",
"@semantic-release/github",
"@qiwi/semantic-release-gh-pages-plugin"
]
}
"prettier": "prettier-config-qiwi"
}
57 changes: 0 additions & 57 deletions scripts/js/coverage-merge.js

This file was deleted.

Loading

0 comments on commit 7f6c933

Please sign in to comment.