-
Notifications
You must be signed in to change notification settings - Fork 2
/
package-scripts.js
40 lines (36 loc) · 1.09 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
const { series, concurrent, commonTags: { oneLine } } = require("nps-utils");
const execInEachPackage = (...cmds) =>
series(
...cmds.map(cmd => "bolt workspaces exec --ignore-fs examples/* -- " + cmd)
);
const { env } = process;
const isCI = env.CI === "true";
function crossEnv(arg) {
return `node ${require.resolve(".bin/cross-env")} ${arg}`;
}
module.exports = {
scripts: {
postinstall: series.nps("build"),
build: execInEachPackage(
crossEnv(
oneLine`
BABEL_ENV=commonjs
babel src --copy-files --out-dir dist --ignore "**/__tests__,**/*.test.js"
`
),
"flow-copy-source src dist"
),
bootstrap: series("bolt", "lint-json"),
clean: execInEachPackage("rimraf dist"),
test: isCI ? "jest --ci --coverage" : "jest",
lint: concurrent.nps("lint-js", "lint-json"),
lintJs: `eslint ${isCI ? "" : "--fix"} "**/*.js"`,
lintJson: oneLine`
prettier --ignore-path .eslintignore
${isCI ? "--list-different" : "--write"}
"**/*.json"
`,
ci: series("lint", "test"),
precommit: "lint-staged"
}
};