forked from paypal/glamorous
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage-scripts.js
123 lines (120 loc) · 3.43 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
const npsUtils = require('nps-utils')
const series = npsUtils.series
const concurrent = npsUtils.concurrent
const rimraf = npsUtils.rimraf
module.exports = {
scripts: {
contributors: {
add: {
description: 'When new people contribute to the project, run this',
script: 'all-contributors add',
},
generate: {
description: 'Update the badge and contributors table',
script: 'all-contributors generate',
},
},
commit: {
description: 'This uses commitizen to help us generate well formatted commit messages',
script: 'git-cz',
},
test: {
default: 'jest --coverage',
watch: 'jest --watch',
build: {
description: 'validates the built files',
script: 'babel-node dist-test/index.js',
},
},
build: {
description: 'delete the dist directory and run all builds',
default: series(
rimraf('dist'),
concurrent.nps(
'build.es',
'build.cjs',
'build.umd.main',
'build.umd.min',
'build.es.tiny',
'build.cjs.tiny',
'build.umd.main.tiny',
'build.umd.min.tiny'
)
),
es: {
description: 'run the build with rollup (uses rollup.config.js)',
script: 'rollup --config --environment FORMAT:es',
tiny: 'rollup --config --environment FORMAT:es,TINY',
},
cjs: {
description: 'run rollup build with CommonJS format',
script: 'rollup --config --environment FORMAT:cjs',
tiny: 'rollup --config --environment FORMAT:cjs,TINY',
},
umd: {
min: {
description: 'run the rollup build with sourcemaps',
script: 'rollup --config --sourcemap --environment MINIFY,FORMAT:umd',
tiny: 'rollup --config --sourcemap --environment MINIFY,FORMAT:umd,TINY',
},
main: {
description: 'builds the cjs and umd files',
script: 'rollup --config --sourcemap --environment FORMAT:umd',
tiny: 'rollup --config --sourcemap --environment FORMAT:umd,TINY',
},
},
andTest: series.nps('build', 'test.build'),
},
lint: {
description: 'lint the entire project',
script: 'eslint .',
},
reportCoverage: {
description: 'Report coverage stats to codecov. This should be run after the `test` script',
script: 'codecov',
},
release: {
description: 'We automate releases with semantic-release. This should only be run on travis',
script: series(
'semantic-release pre',
'npm publish',
'semantic-release post'
),
},
examples: {
withJest: {
description: 'This jumpstarts and validates the with-jest example.',
script: series(
'cd examples/with-jest',
'yarn install',
'yarn run test',
'cd ../../'
),
},
},
validate: {
description: 'This runs several scripts to make sure things look good before committing or on clean install',
default: concurrent.nps('lint', 'build.andTest', 'test'),
examples: {
description: 'Validates the examples folder',
script: 'nps examples.withJest',
},
},
},
options: {
silent: false,
},
}
// this is not transpiled
/*
eslint
max-len: 0,
comma-dangle: [
2,
{
arrays: 'always-multiline',
objects: 'always-multiline',
functions: 'never'
}
]
*/