Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.copySfdxProjectFolder = (flags.copySfdxProjectFolder === 'true');
this.verbose = flags.verbose;
if (flags.fetchExpressionList) {
this.fetchExpressionList = flags.fetchExpressionList.split(',');
} else if (flags.fetchExpressionList === '') {
this.fetchExpressionList = [];
}
// Read config file and store it in class variable
const jsonDataModelToMigrate = fs.readFileSync(this.configFile);
this.configData = JSON.parse(jsonDataModelToMigrate.toString());
// Build progress bars
// @ts-ignore
this.multibar = new cliProgress.MultiBar({
clearOnComplete: false,
hideCursor: true,
fps: 500,
format: '{name} [{bar}] {percentage}% | {value}/{total} | {file} '
}, cliProgress.Presets.shades_grey);
this.multibars.total = this.multibar.create(this.fetchExpressionList.length, 0, { name: 'Total'.padEnd(30, ' '), file: 'N/A' });
// Expression list progress bars
this.fetchExpressionList.forEach((fetchExpression: string) => {
const customFileNameList = glob.sync(this.inputFolder + '/' + fetchExpression);
if (this.multibar.terminal.isTTY()) {
this.multibars[fetchExpression] = this.multibar.create(customFileNameList.length, 0, { name: fetchExpression.padEnd(30, ' '), file: 'N/A' });
}
});
// Delete files progress bar
if (this.deleteFiles && this.configData.objectToDelete && this.multibar.terminal.isTTY()) {
this.multibars.deleteFiles = this.multibar.create(1, 0, { name: 'Delete files & folders'.padEnd(30, ' '), file: 'N/A' });
public async run() {
const elapseStart = Date.now();
// tslint:disable-next-line:no-shadowed-variable
const { args, flags } = this.parse(ExecuteFilterMetadatas);
// Get input arguments or default values
this.packageXmlFile = flags.packagexml;
this.inputFolder = flags.inputfolder || '.';
this.outputFolder = flags.outputfolder || 'filteredMetadatas';
if (flags.verbose) {
this.verbose = true;
}
this.log(`Initialize filtering of ${this.inputFolder} ,using ${this.packageXmlFile} , into ${this.outputFolder}`);
// @ts-ignore
this.multibar = new cliProgress.MultiBar({
clearOnComplete: false,
fps: 500,
format: '{name} [{bar}] {percentage}% | {value}/{total} | {file} '
}, cliProgress.Presets.shades_grey);
if (this.multibar.terminal.isTTY()) {
this.multibars.total = this.multibar.create(3, 0, { name: 'Total'.padEnd(30, ' '), file: 'N/A' });
this.multibars.initialize = this.multibar.create(1, 0, { name: 'Initialize'.padEnd(30, ' '), file: 'N/A' });
this.multibars.filterMetadatasByType = this.multibar.create(1, 0, { name: 'Filter metadatas by type'.padEnd(30, ' '), file: 'N/A' });
this.multibars.copyImpactedObjects = this.multibar.create(1, 0, { name: 'Copy impacted objects'.padEnd(30, ' '), file: 'N/A' });
}
// Read package.xml file
let interval: any;
if (this.multibar.terminal.isTTY()) {
// @ts-ignore
interval = EssentialsUtils.multibarStartProgress(this.multibars, 'initialize', this.multibar, 'Initializing');