new version for latest webpack 4.28.x
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const npm = require("npm");
|
||||
|
||||
module.exports = function(scriptName, onSuccess, onError) {
|
||||
|
||||
npm.load(function(err) {
|
||||
console.log('Running npm script: "' + scriptName + '"');
|
||||
npm.commands.run([scriptName], function(error, data) {
|
||||
|
||||
if (error) {
|
||||
console.error('Npm script: "' + scriptName + '" error', error);
|
||||
|
||||
if (onError) {
|
||||
onError(error);
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.log('Npm script: "' + scriptName + '" ran successfully');
|
||||
|
||||
if (onSuccess) {
|
||||
onSuccess(data);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
npm.on('log', function(message) {
|
||||
console.log('Npm script: "' + scriptName + '" log', message);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user