@pega/custom-dx-components
Version:
Utility for building custom UI components
57 lines (43 loc) • 1.29 kB
JavaScript
import { Listr } from 'listr2';
import chalk from 'chalk';
import {
showVersion,
addDebugLog,
checkLibraryAndArchives,
getConfigDefaults,
getLibraryBased,
zipVersionAndArchive,
cleanUpTemp
} from '../../util.js';
export default async options => {
await showVersion();
await checkLibraryAndArchives();
addDebugLog("storeComponents", "", "+");
await cleanUpTemp();
const isLibraryBased = getLibraryBased();
if (!isLibraryBased) {
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
process.exit();
}
console.log(chalk.bold.yellow('\nBe sure to SAVE all changes before storing, or changes will NOT be stored.'));
console.log("");
const confDef = getConfigDefaults();
const tasks = new Listr(
[
{
title: `Store ${confDef.displayLibVersion}`,
task: async () => {
await zipVersionAndArchive(confDef.currentOrgLib, confDef.buildVersion);
}
}
],
{ concurrent: false, exitOnError: true }
);
await tasks.run().catch(err => {
console.log(chalk.bold.red(err.toString()));
addDebugLog("storeComponents", "", "-");
process.exit(1);
});
console.log(chalk.greenBright('\nComponents Stored'));
addDebugLog("storeComponents", "", "-");
};