mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-02 05:52:46 +02:00
Add CI command and server sigterm handler
This commit is contained in:
parent
7d3c8daf07
commit
3ce59432bc
|
@ -9,9 +9,10 @@
|
|||
"build": "npm run js:build && npm run css:build",
|
||||
"lint": "eslint assets/**/*.js",
|
||||
"coverage": "nyc npm run test",
|
||||
"cypress": "$(npm bin)/cypress run",
|
||||
"test": "mocha --require ./config/test.js --compilers js:babel-core/register \"./src/**/**/**/**/*.test.js\"",
|
||||
"test:watch": "npm run test -- --watch --inspect=5556",
|
||||
"cypress": "$(npm bin)/cypress run",
|
||||
"test:ci": "concurrently --kill-others --prefix-colors yellow,green \"npm run start\" \"npm run cypress\"",
|
||||
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
|
||||
"css:build": "npm run css:sass -s && npm run css:prefix -s && npm run css:min -s",
|
||||
"css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css",
|
||||
|
|
28
server.js
28
server.js
|
@ -16,21 +16,35 @@ if (process.env.NODE_ENV !== 'production') {
|
|||
console.log('Compiling bundle... 👷🏽');
|
||||
const compiler = webpack(config);
|
||||
|
||||
app.use(webpackDevMiddleware(compiler, {
|
||||
publicPath: '/assets/scripts/',
|
||||
stats: {
|
||||
colors: true,
|
||||
},
|
||||
}));
|
||||
app.use(
|
||||
webpackDevMiddleware(compiler, {
|
||||
publicPath: '/assets/scripts/',
|
||||
stats: {
|
||||
colors: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
app.use(webpackHotMiddleware(compiler));
|
||||
}
|
||||
|
||||
app.use(express.static(DIST_DIR));
|
||||
app.listen(PORT, (err) => {
|
||||
|
||||
const server = app.listen(PORT, err => {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
console.log(`Listening at http://localhost:${PORT} 👂`);
|
||||
});
|
||||
|
||||
process.on('SIGTERM', () => {
|
||||
if (server) {
|
||||
server.close(() => {
|
||||
console.log('Shutting down server');
|
||||
process.exit(0);
|
||||
});
|
||||
} else {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue