@interopio/desktop-cli
Version:
io.Connect Desktop Seed Repository CLI Tools
52 lines • 2.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.modificationsCommand = void 0;
const commander_1 = require("commander");
const utils_1 = require("../utils");
const modification_manager_1 = require("../services/modification-manager");
// Parent command
exports.modificationsCommand = new commander_1.Command('modifications')
.description('Manage component modifications (apply / validate)');
// Apply subcommand
exports.modificationsCommand
.command('apply [component]')
.description('Apply modifications (optionally for a specific component)')
.option('--component <name>', 'Only operate on a specific component (alternative to positional argument)')
.action(async (component, opts) => {
try {
const manager = new modification_manager_1.ModificationManager();
const targetComponent = component || opts?.component;
if (targetComponent) {
utils_1.Logger.info(`Applying modifications for component: ${targetComponent}`);
await manager.applyForComponent(targetComponent);
}
else {
await manager.applyAll();
}
utils_1.Logger.success('Modifications applied successfully');
}
catch (error) {
utils_1.Logger.error(`Failed to apply modifications: ${error instanceof Error ? error.message : String(error)}`);
process.exit(1);
}
});
// Validate subcommand
exports.modificationsCommand
.command('validate')
.description('Validate modifications for all components')
.action(async () => {
try {
const manager = new modification_manager_1.ModificationManager();
const valid = await manager.validate();
if (!valid) {
utils_1.Logger.error('Modifications validation failed');
process.exit(1);
}
utils_1.Logger.success('Modifications validation passed');
}
catch (error) {
utils_1.Logger.error(`Failed to validate modifications: ${error instanceof Error ? error.message : String(error)}`);
process.exit(1);
}
});
//# sourceMappingURL=modifications.js.map