angular4-testing/ng2-admin/config/helpers.js

26 lines
590 B
JavaScript
Raw Permalink Normal View History

2017-02-24 22:54:59 +01:00
var path = require('path');
const EVENT = process.env.npm_lifecycle_event || '';
// Helper functions
var ROOT = path.resolve(__dirname, '..');
function hasProcessFlag(flag) {
return process.argv.join('').indexOf(flag) > -1;
}
function hasNpmFlag(flag) {
return EVENT.includes(flag);
}
function isWebpackDevServer() {
return process.argv[1] && !! (/webpack-dev-server/.exec(process.argv[1]));
}
var root = path.join.bind(path, ROOT);
exports.hasProcessFlag = hasProcessFlag;
exports.hasNpmFlag = hasNpmFlag;
exports.isWebpackDevServer = isWebpackDevServer;
exports.root = root;