mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ADF CLI fixes (#5674)
* safety checks and better path eval * do not execute command on help * rewrite 'update-version' command
This commit is contained in:
@@ -1,16 +1,30 @@
|
||||
#!/usr/bin/env node
|
||||
// tslint:disable: adf-file-name
|
||||
// tslint:disable: no-var-requires
|
||||
const minimist = require('minimist');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const args = minimist(process.argv.slice(2), {
|
||||
boolean: ['verbose']
|
||||
});
|
||||
|
||||
if (args._.length === 0) {
|
||||
console.error('Error: no commands provided');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const scriptName = args._.shift();
|
||||
const scriptPath = path.join('../scripts', scriptName);
|
||||
const scriptPath = process.env.DEVELOP
|
||||
? path.resolve(path.join(__dirname, '../dist/scripts', scriptName))
|
||||
: path.resolve(path.join(__dirname, '../scripts', scriptName));
|
||||
|
||||
if (!fs.existsSync(`${scriptPath}.js`)) {
|
||||
console.error(`Error: command ${scriptName} not found.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const cwd = process.cwd();
|
||||
process.chdir(path.join(__dirname, '..'));
|
||||
|
||||
|
||||
try {
|
||||
Promise.resolve()
|
||||
|
Reference in New Issue
Block a user