This repository was archived by the owner on Apr 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpackage-scripts.js
54 lines (51 loc) · 1.99 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
const npsUtils = require('nps-utils');
const path = require('path');
const getDevCmd = project => `NODE_ENV="development" babel \
--config-file "${path.resolve(__dirname)}/packages/${project}/.babelrc.js" \
--src-type module \
--out-dir "packages/${project}/dist/cjs" \
--ignore "packages/${project}/src/**/*.test.js" \
--extensions ".js,.jsx,.ts,.tsx" \
--watch \
"packages/${project}/src"`;
const getTypeCmd = project => `cd ${__dirname}/packages/${project} && yarn run type`;
const getDevTypeCmd = project => `cd ${__dirname}/packages/${project} && yarn run type --watch`;
const getLintCmd = project => `eslint --ext .js,.jsx,.ts,.tsx --config .eslintrc.js packages/${project}/src`;
module.exports = {
// @todo expand these scripts
scripts: {
lint: {
all: npsUtils.concurrent.nps('lint.helpers', 'lint.field', 'lint.form', 'lint.slider', 'lint.extra-fields'),
helpers: getLintCmd('helpers'),
field: getLintCmd('field'),
form: getLintCmd('form'),
slider: getLintCmd('slider'),
example: getLintCmd('example'),
'extra-fields': getLintCmd('extra-fields'),
},
dev: {
all: npsUtils.concurrent.nps('dev.rollup', 'type.dev.all', 'dev.example'),
helpers: getDevCmd('helpers'),
form: getDevCmd('form'),
field: getDevCmd('field'),
'extra-fields': getDevCmd('extra-fields'),
slider: getDevCmd('slider'),
rollup: 'rollup -c -w',
example: 'cd packages/example && yarn run dev',
},
type: {
all: npsUtils.concurrent.nps('type.helpers', 'type.field', 'type.form', 'type.slider'),
dev: {
all: npsUtils.concurrent.nps('type.dev.helpers', 'type.dev.field', 'type.dev.form', 'type.dev.slider'),
helpers: getDevTypeCmd('helpers'),
field: getDevTypeCmd('field'),
form: getDevTypeCmd('form'),
slider: getDevTypeCmd('slider'),
},
helpers: getTypeCmd('helpers'),
field: getTypeCmd('field'),
form: getTypeCmd('form'),
slider: getTypeCmd('slider'),
},
},
};