@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.
52 lines (50 loc) • 1.2 kB
JavaScript
const arg = require('arg');
const buildCmd = require('./build/build');
const publishCmd = require('./publish/publish');
const deleteCmd = require('./delete/delete');
const listCmd = require('./list/list');
const devServerCmd = require('./dev-server-asset/dev-server');
const parseArgumentsIntoOptions = rawArgs => {
const args = arg(
{
'--install': Boolean,
'--skipBundle': Boolean
},
{
argv: rawArgs.slice(2)
}
);
return {
cmd: args._[0],
git: true, // args['--git'] || false
runInstall: true, // args['--install'] || false
skipBundle: args['--skipBundle'] || false,
params: rawArgs
};
};
exports.excuteCmd = function (args) {
const options = parseArgumentsIntoOptions(args);
let { params } = options;
switch (params) {
case 'build':
buildCmd.buildLib()
break;
case 'build-v3':
buildCmd.buildLibV3()
break;
case 'publish':
publishCmd.publishLib()
break;
case 'delete':
deleteCmd.deleteLib();
break;
case 'list':
listCmd.listLib();
break;
case 'dev-server':
devServerCmd.devServerStart();
break;
default:
process.exit();
}
};