UNPKG

@pega/custom-dx-components

Version:

Utility for building custom UI components

70 lines (61 loc) 2.43 kB
import chalk from 'chalk'; import { showVersion, getLibraryBased, getConfigDefaults, getComponents, checkLibraryAndArchives, getPegaServerConfig, getLibraryBasedCL, getApplicationAndVersionFromToken } from '../../util.js'; export const showCurrentStatus = async () => { const configDefaults = getConfigDefaults(); const componentList = await getComponents(); const isLibraryBased = getLibraryBased(); const isLibraryBasedCL = getLibraryBasedCL(); const pegaServer = await getPegaServerConfig(true); const { app_name, app_version } = await getApplicationAndVersionFromToken(); console.log(''); console.log('\tCurrent status'); console.log('\t---------------------'); console.log(`\tOrganization:\t ${chalk.bold.green(`${configDefaults.organization}`)}`); console.log(`\tLibrary:\t ${chalk.bold.green(`${configDefaults.library}`)}`); console.log(`\tVersion:\t ${chalk.bold.green(`${configDefaults.buildVersion}`)}`); if (!isLibraryBasedCL) { if (!configDefaults.devBuild) { console.log(`\tPermanent:\t ${chalk.bold.magentaBright(`${!configDefaults.devBuild}`)}`); } else { console.log(`\tPermanent:\t ${chalk.bold.green(`${!configDefaults.devBuild}`)}`); } } if (componentList.length === 0) { console.log(`\tComponent count: ${chalk.bold.yellow(`${componentList.length}`)}`); } else { console.log(`\tComponent count: ${chalk.bold.green(`${componentList.length}`)}`); } console.log(''); if (isLibraryBased && !isLibraryBasedCL) { // no publishing for just libraryBased, that goes to App Static } else { console.log(`\tPublish configuration`); console.log(`\t Server:\t ${chalk.bold.green(`${pegaServer.server}`)} `); if (app_name === '**') { console.log(`\t Application:\t ${chalk.bold.yellow(`Need to authenticate`)}`); } else { console.log(`\t Application:\t ${chalk.bold.green(`${app_name} - ${app_version}`)}`); } console.log(`\t Ruleset:\t ${chalk.bold.green(`${pegaServer.rulesetName}:`)}${chalk.bold.magenta(`${pegaServer.rulesetVersion}`)}`); console.log(''); } }; export default async options => { const isLibraryBased = getLibraryBased(); if (!isLibraryBased) { console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`); process.exit(); } await showVersion(); await checkLibraryAndArchives(); await showCurrentStatus(); };