mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-17 16:00:14 +01:00
chore(dependencies): update dependencies, move to @types, some refactoring as per AngularClass/angular2-webpack-starter project
This commit is contained in:
parent
7d0ff2ef96
commit
e7fca6d4ed
24 changed files with 505 additions and 295 deletions
|
|
@ -1,69 +1,32 @@
|
|||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
|
||||
var path = require('path');
|
||||
|
||||
// Helper functions
|
||||
var _root = path.resolve(__dirname, '..');
|
||||
|
||||
console.log('root directory:', root());
|
||||
var ROOT = path.resolve(__dirname, '..');
|
||||
|
||||
function hasProcessFlag(flag) {
|
||||
return process.argv.join('').indexOf(flag) > -1;
|
||||
}
|
||||
|
||||
function isWebpackDevServer() {
|
||||
return process.argv[1] && !! (/webpack-dev-server$/.exec(process.argv[1]));
|
||||
}
|
||||
|
||||
function root(args) {
|
||||
args = Array.prototype.slice.call(arguments, 0);
|
||||
return path.join.apply(path, [_root].concat(args));
|
||||
return path.join.apply(path, [ROOT].concat(args));
|
||||
}
|
||||
|
||||
function rootNode(args) {
|
||||
args = Array.prototype.slice.call(arguments, 0);
|
||||
return root.apply(path, ['node_modules'].concat(args));
|
||||
}
|
||||
|
||||
function prependExt(extensions, args) {
|
||||
args = args || [];
|
||||
if (!Array.isArray(args)) { args = [args] }
|
||||
return extensions.reduce(function(memo, val) {
|
||||
return memo.concat(val, args.map(function(prefix) {
|
||||
return prefix + val;
|
||||
}));
|
||||
}, ['']);
|
||||
}
|
||||
|
||||
function packageSort(packages) {
|
||||
// packages = ['polyfills', 'vendor', 'main']
|
||||
var len = packages.length - 1;
|
||||
var first = packages[0];
|
||||
var last = packages[len];
|
||||
return function sort(a, b) {
|
||||
// polyfills always first
|
||||
if (a.names[0] === first) {
|
||||
return -1;
|
||||
}
|
||||
// main always last
|
||||
if (a.names[0] === last) {
|
||||
return 1;
|
||||
}
|
||||
// vendor before app
|
||||
if (a.names[0] !== first && b.names[0] === last) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
function checkNodeImport(context, request, cb) {
|
||||
if (!path.isAbsolute(request) && request.charAt(0) !== '.') {
|
||||
cb(null, 'commonjs ' + request); return;
|
||||
}
|
||||
cb();
|
||||
}
|
||||
|
||||
function reverse(arr) {
|
||||
return arr.reverse();
|
||||
}
|
||||
|
||||
exports.reverse = reverse;
|
||||
exports.hasProcessFlag = hasProcessFlag;
|
||||
exports.isWebpackDevServer = isWebpackDevServer;
|
||||
exports.root = root;
|
||||
exports.rootNode = rootNode;
|
||||
exports.prependExt = prependExt;
|
||||
exports.prepend = prependExt;
|
||||
exports.packageSort = packageSort;
|
||||
exports.checkNodeImport = checkNodeImport;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue