How to use the @yarnpkg/json-proxy.updateAndSave function in @yarnpkg/json-proxy

To help you get started, we’ve selected a few @yarnpkg/json-proxy 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 yarnpkg / berry / packages / plugin-init / sources / commands / init.ts View on Github external
async executeRegular(configuration: Configuration) {
    if (!xfs.existsSync(this.context.cwd))
      await xfs.mkdirpPromise(this.context.cwd);

    const manifest = new Manifest();
    manifest.name = structUtils.makeIdent(configuration.get(`initScope`), ppath.basename(this.context.cwd));
    manifest.version = configuration.get(`initVersion`);
    manifest.private = this.private;
    manifest.license = configuration.get(`initLicense`);

    await updateAndSave(ppath.join(this.context.cwd, Manifest.fileName), (tracker: Object) => {
      manifest.exportTo(tracker);
    });

    const inspectable: any = {};
    manifest.exportTo(inspectable);

    this.context.stdout.write(`${inspect(inspectable, {
      depth: Infinity,
    })}\n`);
  }
}

@yarnpkg/json-proxy

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

80 / 100
Full package analysis

Popular @yarnpkg/json-proxy functions

Similar packages