How to use the @salesforce/command.core.fs function in @salesforce/command

To help you get started, we’ve selected a few @salesforce/command examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amtrack / sfdx-browserforce-plugin / src / browserforceCommand.ts View on Github external
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();
  }
github amtrack / sfdx-browserforce-plugin / src / commands / browserforce / plan.ts View on Github external
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 };
  }
}