@interopio/desktop-cli
Version:
io.Connect Desktop Seed Repository CLI Tools
58 lines • 2.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModificationManager = void 0;
const utils_1 = require("../utils");
const component_manager_1 = require("./component-manager");
class ModificationManager {
constructor(componentManager) {
this.componentManager = componentManager || new component_manager_1.ComponentManager();
this.componentRegistry = this.componentManager.getComponentRegistry();
}
/**
* Get the component registry for external registration of components
*/
getComponentRegistry() {
return this.componentRegistry;
}
/**
* Get the component manager for external component management
*/
getComponentManager() {
return this.componentManager;
}
async applyAll() {
utils_1.Logger.info('Applying modifications using component system...');
// Use the interface method directly
await this.componentRegistry.applyAllModifications();
}
async applyForComponent(componentName) {
const processor = this.componentRegistry.get(componentName);
if (!processor) {
utils_1.Logger.warning(`Component processor not found: ${componentName}`);
return;
}
if (!(await processor.hasModifications())) {
utils_1.Logger.info(`No modifications found for component: ${componentName}`);
return;
}
await processor.applyModifications();
}
async validate() {
utils_1.Logger.info('Validating modifications using component system...');
// Use the interface method directly
return await this.componentRegistry.validateAllModifications();
}
// Static helper methods for electron-builder integration
/**
* Check if there are any modifications available to process.
*/
static async hasModifications() {
const componentManager = new component_manager_1.ComponentManager();
const componentRegistry = componentManager.getComponentRegistry();
// Use the interface method directly
const componentsWithMods = await componentRegistry.getComponentsWithModifications();
return componentsWithMods.length > 0;
}
}
exports.ModificationManager = ModificationManager;
//# sourceMappingURL=modification-manager.js.map