-
Notifications
You must be signed in to change notification settings - Fork 7
/
package-scripts.js
55 lines (47 loc) · 1.9 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
const pathTo = require('path').join.bind(null, process.cwd());
exports.scripts = {
dev: 'cross-env NODE_ENV=development webpack-dev-server',
ghPages: [
'npm start -- build.ghPages',
'gh-pages --dist example'
].join(' && '),
build: {
default: [
`rimraf ${pathTo('lib')} ${pathTo('example')} ${pathTo('build')}`,
'npm start -- --parallel build.lib,build.ghPages,build.dist,build.min'
].join(' && '),
lib: 'cross-env NODE_ENV=production' +
` babel ${pathTo('src')} --out-dir ${pathTo('lib')}` +
` --ignore ${pathTo('src', 'example')}`,
ghPages: 'cross-env NODE_ENV=production BUILD=ghPages webpack',
dist: 'cross-env NODE_ENV=production BUILD=dist webpack',
min: 'cross-env NODE_ENV=production BUILD=min webpack'
},
lint: `eslint ${pathTo('.')}`,
test: {
default: `cross-env NODE_ENV=test babel-node ${pathTo('test')}`,
dev: 'npm start -- test | tap-nyan',
cov: 'cross-env NODE_ENV=test' +
' babel-node node_modules/.bin/babel-istanbul cover' +
` --report text --report html --report lcov --dir reports/coverage ${pathTo('test')}`,
e2e: 'cross-env NODE_ENV=development nightwatch-autorun'
},
// CircleCI scripts
ci: {
lint: `eslint ${pathTo('.')}`,
test: `NODE_ENV=test babel-node ${pathTo('test')}`,
cov: 'NODE_ENV=test' +
' babel-node node_modules/.bin/babel-istanbul cover' +
' --report text --report lcov --verbose --dir ${CIRCLE_ARTIFACTS}/coverage' +
` ${pathTo('test')}`,
e2e: 'REPORT_DIR=${CIRCLE_TEST_REPORTS} LOG_DIR=${CIRCLE_ARTIFACTS}' +
' NODE_ENV=development nightwatch-autorun',
codecov: 'cat ${CIRCLE_ARTIFACTS}/coverage/lcov.info | codecov'
},
// GIT Hooks
precommit: 'npm start -- lint',
prepush: 'npm start -- test',
// NPM Hooks
postversion: 'git push --follow-tags',
prepublish: 'npm start -- --parallel build.lib,build.dist,build.min'
};