Initial application generated by JHipster-5.8.2
This commit is contained in:
30
webpack/utils.js
Normal file
30
webpack/utils.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
parseVersion,
|
||||
root,
|
||||
isExternalLib
|
||||
};
|
||||
|
||||
// Returns the second occurrence of the version number from `build.gradle` file
|
||||
function parseVersion() {
|
||||
const versionRegex = /^version\s*=\s*[',"]([^',"]*)[',"]/gm; // Match and group the version number
|
||||
const buildGradle = fs.readFileSync('build.gradle', 'utf8');
|
||||
return versionRegex.exec(buildGradle)[1];
|
||||
}
|
||||
|
||||
const _root = path.resolve(__dirname, '..');
|
||||
|
||||
function root(args) {
|
||||
args = Array.prototype.slice.call(arguments, 0);
|
||||
return path.join.apply(path, [_root].concat(args));
|
||||
}
|
||||
|
||||
function isExternalLib(module, check = /node_modules/) {
|
||||
const req = module.userRequest;
|
||||
if (typeof req !== 'string') {
|
||||
return false;
|
||||
}
|
||||
return req.search(check) >= 0;
|
||||
}
|
Reference in New Issue
Block a user