chore: reorganize npm script (#884)

The goal is every package should be responsible to `lint`, `build` and
`test` commands. This modification helps to easier add new package to
the repository.
This commit is contained in:
Róbert Kiss
2018-12-22 02:20:38 +01:00
committed by László Monda
parent c9f052b8c7
commit 1eb8720305
6 changed files with 21 additions and 29 deletions

View File

@@ -81,27 +81,11 @@
"scripts": { "scripts": {
"postinstall": "lerna bootstrap", "postinstall": "lerna bootstrap",
"precommit-msg": "Git precommit hook is running... & exit 0", "precommit-msg": "Git precommit hook is running... & exit 0",
"test": "run-p -sn test:test-serializer test:uhk-common", "test": "lerna run test",
"test:test-serializer": "lerna exec --scope test-serializer npm test", "lint": "lerna run lint",
"test:uhk-common": "lerna exec --scope uhk-common npm test",
"test:uhk-web": "lerna exec --scope uhk-web npm test",
"lint": "run-s -scn lint:ts lint:style",
"lint:ts": "run-p -sn lint:ts:electron-main lint:ts:electron-renderer lint:ts:web lint:ts:test-serializer lint:ts:uhk-usb",
"lint:ts:electron-main": "tslint --project ./packages/uhk-agent/tsconfig.json",
"lint:ts:electron-renderer": "tslint --project ./packages/uhk-web/src/tsconfig.renderer.json",
"lint:ts:web": "tslint --project ./packages/uhk-web/src/tsconfig.app.json",
"lint:ts:test-serializer": "tslint --project ./packages/test-serializer/tsconfig.json",
"lint:ts:uhk-usb": "tslint --project ./packages/uhk-usb/tsconfig.json",
"lint:style": "stylelint \"packages/uhk-agent/src/**/*.scss\" \"packages/uhk-web/src/**/*.scss\" --syntax scss",
"e2e": "lerna run e2e --scope uhk-web", "e2e": "lerna run e2e --scope uhk-web",
"prebuild": "check-node-version --package", "prebuild": "check-node-version --package",
"build": "run-s build:common build:usb build:web build:electron", "build": "lerna run build",
"build:web": "lerna exec --scope uhk-web npm run build",
"build:electron": "cross-env AOT_BUILD=true run-s -sn build:electron:renderer build:electron:main",
"build:electron:main": "lerna exec --scope uhk-agent npm run build",
"build:electron:renderer": "lerna exec --scope uhk-web npm run build:renderer",
"build:common": "lerna exec --scope uhk-common npm run build",
"build:usb": "lerna exec --scope uhk-usb npm run build",
"server:web": "lerna exec --scope uhk-web npm start", "server:web": "lerna exec --scope uhk-web npm start",
"server:electron": "lerna exec --scope uhk-web npm run server:renderer", "server:electron": "lerna exec --scope uhk-web npm run server:renderer",
"electron": "lerna exec --scope uhk-agent npm start", "electron": "lerna exec --scope uhk-agent npm start",
@@ -111,7 +95,7 @@
"sprites": "node ./scripts/generate-svg-sprites", "sprites": "node ./scripts/generate-svg-sprites",
"release": "node ./scripts/release.js", "release": "node ./scripts/release.js",
"clean": "lerna exec rimraf ./node_modules ./dist && rimraf ./node_modules ./dist", "clean": "lerna exec rimraf ./node_modules ./dist && rimraf ./node_modules ./dist",
"predeploy-gh-pages": "run-s build:web", "predeploy-gh-pages": "lerna run build:web --scope=uhk-web",
"deploy-gh-pages": "gh-pages -d packages/uhk-web/dist" "deploy-gh-pages": "gh-pages -d packages/uhk-web/dist"
}, },
"dependencies": {} "dependencies": {}

View File

@@ -19,6 +19,7 @@
"devDependencies": { "devDependencies": {
}, },
"scripts": { "scripts": {
"test": "jasmine-ts --config=jasmine.json" "test": "jasmine-ts --config=jasmine.json",
"lint": "tslint --project tsconfig.json"
} }
} }

View File

@@ -34,6 +34,7 @@
"electron:spe": "electron ./dist/electron-main.js --spe", "electron:spe": "electron ./dist/electron-main.js --spe",
"build": "webpack && npm run install:build-deps && npm run build:usb && npm run download-firmware && npm run copy-to-tmp-folder", "build": "webpack && npm run install:build-deps && npm run build:usb && npm run download-firmware && npm run copy-to-tmp-folder",
"build:usb": "electron-rebuild -w node-hid -p -m ./dist", "build:usb": "electron-rebuild -w node-hid -p -m ./dist",
"lint": "tslint --project tsconfig.json",
"install:build-deps": "cd ./dist && npm i", "install:build-deps": "cd ./dist && npm i",
"download-firmware": "node ../../scripts/download-firmware.js", "download-firmware": "node ../../scripts/download-firmware.js",
"copy-to-tmp-folder": "node ../../scripts/copy-to-tmp-folder.js" "copy-to-tmp-folder": "node ../../scripts/copy-to-tmp-folder.js"

View File

@@ -16,7 +16,8 @@
"copy:scancodes": "copyfiles ./src/config-serializer/config-items/scancodes.json dist", "copy:scancodes": "copyfiles ./src/config-serializer/config-items/scancodes.json dist",
"copy:secondary-roles": "copyfiles ./src/config-serializer/config-items/secondaryRole.json dist", "copy:secondary-roles": "copyfiles ./src/config-serializer/config-items/secondaryRole.json dist",
"test": "jasmine-ts --config=jasmine.json", "test": "jasmine-ts --config=jasmine.json",
"coverage": "nyc jasmine-ts --config=jasmine.json" "coverage": "nyc jasmine-ts --config=jasmine.json",
"lint": "tslint --project tsconfig.json"
}, },
"dependencies": { "dependencies": {
"tslib": "1.9.3" "tslib": "1.9.3"

View File

@@ -5,7 +5,8 @@
"main": "dist/index.js", "main": "dist/index.js",
"license": "GPL-3.0", "license": "GPL-3.0",
"scripts": { "scripts": {
"build": "tsc" "build": "tsc",
"lint": "tslint --project tsconfig.json"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "8.0.28" "@types/node": "8.0.28"

View File

@@ -5,13 +5,17 @@
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build --prod --aot --base-href=\"\"", "build": "run-p -sn build:*",
"test": "ng test --watch false", "build:web": "ng build --prod --aot --base-href=\"\"",
"lint": "ng lint", "build:renderer": "cross-env AOT_BUILD=true webpack --config webpack.config.js",
"e2e": "ng e2e",
"build:renderer": "webpack --config webpack.config.js",
"server:renderer": "webpack --config webpack.config.js --watch", "server:renderer": "webpack --config webpack.config.js --watch",
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet" "test-skip": "ng test --watch false",
"lint": "run-p -snc lint:*",
"lint:ng": "ng lint",
"lint:renderer": "tslint --project src/tsconfig.renderer.json",
"lint:style": "stylelint \"src/**/*.scss\" --syntax scss",
"pree2e": "webdriver-manager update --standalone false --gecko false --quiet",
"e2e": "ng e2e"
}, },
"private": true, "private": true,
"devDependencies": { "devDependencies": {