-
Notifications
You must be signed in to change notification settings - Fork 1
/
package-scripts.js
79 lines (76 loc) · 2.25 KB
/
package-scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
const {series, crossEnv, concurrent, rimraf} = require('nps-utils')
module.exports = {
scripts: {
default: 'nps webpack',
test: {
default: 'nps test.jest',
jest: {
default: series(
rimraf('test/coverage-jest'),
'jest'
),
accept: 'jest -u',
watch: 'jest --watch',
},
karma: {
default: series(
rimraf('test/coverage-karma'),
'karma start test/karma.conf.js'
),
watch: 'karma start test/karma.conf.js --auto-watch --no-single-run',
debug: 'karma start test/karma.conf.js --auto-watch --no-single-run --debug'
},
lint: {
default: 'eslint src',
fix: 'eslint --fix'
},
all: concurrent({
browser: series.nps('test.karma'),
jest: 'nps test.jest',
lint: 'nps test.lint'
})
},
build: 'nps webpack.build',
webpack: {
default: 'nps webpack.server',
build: {
before: rimraf('dist'),
default: 'nps webpack.build.production',
development: {
default: series(
'nps webpack.build.before',
'webpack --progress -d'
),
extractCss: series(
'nps webpack.build.before',
'webpack --progress -d --env.extractCss'
),
serve: series.nps(
'webpack.build.development',
'serve'
),
},
production: {
inlineCss: series(
'nps webpack.build.before',
crossEnv('NODE_ENV=production webpack --progress -p --env.production')
),
default: series(
'nps webpack.build.before',
crossEnv('NODE_ENV=production webpack --progress -p --env.production --env.extractCss')
),
serve: series.nps(
'webpack.build.production',
'serve'
),
}
},
server: {
default: `webpack-dev-server -d --devtool '#source-map' --inline --env.server`,
extractCss: `webpack-dev-server -d --devtool '#source-map' --inline --env.server --env.extractCss`,
hmr: `webpack-dev-server -d --devtool '#source-map' --inline --hot --env.server`
},
},
serve: 'http-server docs --cors',
},
}