Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async init() {
await super.init();
const definition = await core.fs.readJson(
path.resolve(this.flags.definitionfile)
);
// TODO: use require.resolve to dynamically load plugins from npm packages
this.settings = ConfigParser.parse(DRIVERS, definition);
this.bf = new Browserforce(this.org, this.ux.cli);
this.ux.startSpinner('logging in');
await this.bf.login();
this.ux.stopSpinner();
}
try {
driverState = await instance.retrieve(setting.value);
state.settings[setting.key] = driverState;
} catch (err) {
this.ux.stopSpinner('failed');
throw err;
}
this.ux.stopSpinner();
this.ux.startSpinner(`[${driver.name}] generating plan`);
const driverPlan = instance.diff(driverState, setting.value);
plan.settings[setting.key] = driverPlan;
this.ux.stopSpinner();
}
if (this.flags.statefile) {
this.ux.startSpinner('writing state file');
await core.fs.writeJson(path.resolve(this.flags.statefile), state);
this.ux.stopSpinner();
}
if (this.flags.planfile) {
this.ux.startSpinner('writing plan file');
await core.fs.writeJson(path.resolve(this.flags.planfile), plan);
this.ux.stopSpinner();
}
return { success: true, plan };
}
}