a6625cfadc
* WIP #945 Added some structure for the extensions support * WIP #945 Added ext installation using npm * WIP #945 Added some structure for the extensions support * WIP #945 Added ext installation using npm * WIP #945 Restructured export formats * WIP #945 Added ExportFormat:Pipeline installation * WIP #945 Updated extension installer * WIP #945 Fixed format.js format path * WIP #945 Added reinstalling message * WIP #945 Updated the default Basic CLI * WIP Updated deserializers and cli deserializer * WIP #945 Added simple static ext config * WIP #945 Added custom config dialog for exporting pipelines * WIP #945 Added dynamic updating based on config * WIP #945 Added section headers * WIP #945 Renamed to Export:Pipeline * WIP #945 moved cli export to first option * WIP #945 Renamed plugin 'GenerateExecFile' -> 'Export' * WIP #945 Renamed GenExecFile -> Export * WIP #945 Added 'deepforge extension remove X' * WIP #945 Added 'list' command for extensions * WIP #945 fixed minor linting issues * WIP #945 aliased remove/rm, list/ls * WIP #945 Moved gen installation fn to utils/extender * WIP #945 Added ext reinstall script on postinstall * WIP #945 don't prompt if no options * WIP #945 Updated the plugin name in registry * WIP #945 Updated format template * WIP #945 Fixed cli tests * WIP #945 Removed unused main method * WIP #945 Fixed linter issues
68 linhas
1.9 KiB
JavaScript
Arquivo Executável
68 linhas
1.9 KiB
JavaScript
Arquivo Executável
#!/usr/bin/env node
|
|
|
|
var Command = require('commander').Command,
|
|
program = new Command(),
|
|
extender = require('../utils/extender');
|
|
|
|
// Supported commands
|
|
// - add
|
|
// - remove
|
|
// - list
|
|
// - update
|
|
program
|
|
.command('add <project>')
|
|
.description('Add an extension to deepforge')
|
|
.option('-n, --name <name>', 'Project name (if different from <project>)')
|
|
.action(project => {
|
|
console.log('loading extension from: ' + project);
|
|
extender.install(project)
|
|
.then(extConfig =>
|
|
console.log(`The ${extConfig.name} extension has been added to deepforge.`))
|
|
.fail(err => {
|
|
console.error('Could not install extension:\n');
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|
|
});
|
|
|
|
program
|
|
.command('remove <name>').alias('rm')
|
|
.description('Remove an extension from deepforge')
|
|
.action(name => {
|
|
try {
|
|
extender.uninstall(name);
|
|
console.log(`${name} has been successfully removed!`);
|
|
} catch (e) {
|
|
console.error('Could not remove extension:');
|
|
console.error(e);
|
|
process.exit(1);
|
|
}
|
|
});
|
|
|
|
program
|
|
.command('list').alias('ls')
|
|
.description('List installed deepforge extensions')
|
|
.action(() => {
|
|
var allExtConfigs = extender.getExtensionsConfig(),
|
|
types = Object.keys(allExtConfigs),
|
|
hasContents = false,
|
|
names;
|
|
|
|
for (var i = types.length; i--;) {
|
|
names = Object.keys(allExtConfigs[types[i]]);
|
|
if (names.length) {
|
|
hasContents = true;
|
|
console.log(types[i]);
|
|
for (var j = names.length; j--;) {
|
|
console.log(` ${names[j]}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!hasContents) {
|
|
console.log('No installed extensions');
|
|
}
|
|
});
|
|
|
|
program.parse(process.argv);
|