-
Notifications
You must be signed in to change notification settings - Fork 20
/
package-scripts.js
41 lines (38 loc) · 1.42 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
/* eslint-disable */
const {
series, ifWindows, rimraf, mkdirp,
} = require('nps-utils');
const buildDir = 'build';
const distDir = 'dist';
const createDist = mkdirp(distDir);
const createBuild = mkdirp(buildDir);
const cleanDist = rimraf(`${distDir}/*`);
const cleanBuild = rimraf(`${buildDir}/*`);
const browserifyDebug = 'browserify src/index.js -t babelify --debug | exorcist --base=./build build/segmentstream.js.map > build/segmentstream.js';
const browserifyProd = 'browserify src/index.js -t babelify > dist/segmentstream.js && grunt wrap && uglifyjs dist/segmentstream.js -c -m --output dist/segmentstream.min.js';
const browserifyTest = 'browserify test/index.test.js -t babelify --debug | exorcist --base=./build build/segmentstream-test.js.map > build/segmentstream-test.js';
module.exports = {
scripts: {
build: {
default:
{
description: 'This uses for debug purpose. Creates dd.manager.js and its map.',
script: series(cleanBuild, createBuild, browserifyDebug),
},
prod:
{
description: 'Prepare for deploy. JS + minimize',
script: series(cleanDist, createDist, browserifyProd),
},
},
standard: 'standard',
buildTest: series(cleanBuild, createBuild, browserifyTest),
mocha: 'mocha build/segmentstream-test.js',
test: {
default: series.nps('standard', 'buildTest', 'karma')
},
karma: {
default: 'karma start'
},
},
};