Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
92 lines (89 sloc)
2.78 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {series, crossEnv, concurrent, rimraf} = require('nps-utils') | |
const {config: {port : E2E_PORT}} = require('./test/protractor.conf') | |
module.exports = { | |
scripts: { | |
default: 'nps webpack', | |
test: { | |
default: 'nps test.karma', | |
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' | |
}, | |
lint: { | |
default: 'eslint src', | |
fix: 'eslint --fix' | |
}, | |
all: concurrent({ | |
browser: series.nps('test.karma'), | |
lint: 'nps test.lint' | |
}) | |
}, | |
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: 'nps webpack.build', | |
webpack: { | |
default: 'nps webpack.server', | |
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' | |
), | |
serve: series.nps( | |
'webpack.build.development', | |
'serve' | |
), | |
}, | |
production: { | |
inlineCss: series( | |
'nps webpack.build.before', | |
crossEnv('NODE_ENV=production webpack --progress -p --env.production') | |
), | |
default: series( | |
'nps webpack.build.before', | |
crossEnv('NODE_ENV=production webpack --progress -p --env.production --env.extractCss') | |
), | |
serve: series.nps( | |
'webpack.build.production', | |
'serve' | |
), | |
} | |
}, | |
server: { | |
default: `webpack-dev-server -d --devtool '#source-map' --inline --env.server`, | |
extractCss: `webpack-dev-server -d --devtool '#source-map' --inline --env.server --env.extractCss`, | |
hmr: `webpack-dev-server -d --devtool '#source-map' --inline --hot --env.server` | |
}, | |
}, | |
serve: 'http-server dist --cors', | |
}, | |
} |