@pega/constellation-dx-components-build-utils
Version:
This tool uses a 'v3' approach to group components in a library, create a component map, employ webpack, and load the library like Pega-generated components, constellation app-static.
25 lines (21 loc) • 868 B
JavaScript
const events = require('events');
const chalk = require('chalk');
// const { buildFolderFullPath } = require('../lib/helper').getBuildFolderName();
let emitter = new events.EventEmitter();
emitter.on('build-completed', (message)=>{
console.log(chalk.magenta(`${message}`));
});
class CustomDonePlugin {
constructor(options) {
this.projectName = options.projectName;
this.libName = options.libName;
this.libVersion = options.libVersion;
}
apply(compiler) {
compiler.hooks.done.tap({ name: 'CustomDonePlugin' }, () => {
// logic to notify childprocess that we can resolve the promise
emitter.emit('build-completed', '==== '+this.projectName+' : Webpacked library '+chalk.magenta.underline.bold(this.libName+":"+this.libVersion)+' successfully!! ====');
});
}
};
module.exports = CustomDonePlugin;