-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpackage-scripts.js
128 lines (126 loc) · 4.04 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
124
125
126
127
128
const {
series,
crossEnv,
concurrent,
rimraf,
runInNewWindow
} = require("nps-utils");
const { config: { port: E2E_PORT } } = require("./test/protractor.conf");
const env = require("env-variable")();
const joinPath = require("path.join");
const cwd = require("cwd")();
const vanilleRoot = env.vanilleRoot || cwd;
const pathArcJs =
env.pathArcJs || joinPath(vanilleRoot, "node_modules/@daostack/arc.js");
module.exports = {
scripts: {
default: series(
"nps arc-js.ganache.runAsync",
"nps arc-js.migrateContracts",
"nps build.development",
"nps browse"
),
/**
* Migrate contracts using daostack-arc.js. For usage, see this readme.md, the
* daostack-arc.js readme.md and its package-scripts.js.
*/
"arc-js": {
ganache: "npm explore @daostack/arc.js -- npm start ganache",
ganacheDb: {
default: "npm explore @daostack/arc.js -- npm start ganacheDb",
clean: "npm explore @daostack/arc.js -- npm start ganacheDb.clean",
zip: "npm explore @daostack/arc.js -- npm start ganacheDb.zip",
unzip: "npm explore @daostack/arc.js -- npm start ganacheDb.unzip",
restoreFromZip: "npm explore @daostack/arc.js -- npm start ganacheDb.restoreFromZip"
},
migrateContracts: "npm explore @daostack/arc.js -- npm start migrateContracts",
createGenesisDao: "npm explore @daostack/arc.js -- npm start createGenesisDao"
},
test: {
default: "nps test.jest",
jest: {
default: "jest",
coverage: rimraf("test/coverage-jest"),
accept: "jest -u",
watch: "jest --watch",
updateSnapshots: "jest --updateSnapshot"
},
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"
},
all: concurrent({
browser: series.nps("test.karma", "e2e"),
jest: "nps test.jest"
})
},
e2e: {
default:
concurrent({
webpack: `webpack-dev-server --inline --port=${E2E_PORT}`,
protractor: "nps e2e.whenReady"
}) + " --kill-others --success first",
protractor: {
install: "webdriver-manager update",
default: series(
"nps e2e.protractor.install",
"protractor test/protractor.conf.js"
),
debug: series(
"nps e2e.protractor.install",
"protractor test/protractor.conf.js --elementExplorer"
)
},
whenReady: series(
`wait-on --timeout 120000 http-get://localhost:${E2E_PORT}/index.html`,
"nps e2e.protractor"
)
},
build: {
production: {
default: "nps webpack.build.production",
andServe: "nps webpack.build.production.andServe"
},
development: {
default: "nps webpack.build.development",
andServe: "nps webpack.build.development.andServe"
}
},
webpack: {
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"
),
// doesn't use the dist folder
andServe: `webpack-dev-server -d --inline --hot --env.server --port 8090`
},
production: {
default: series(
"nps webpack.build.before",
"webpack --progress --env.production --env.extractCss"
),
inlineCss: series(
"nps webpack.build.before",
"webpack --progress --env.production"
),
andServe: series(
"nps webpack.build.production",
"nps browse")
}
}
},
hmr: "nps build.development.andServe",
browse: "http-server dist --cors -o -p 8090"
}
};