How to use stringify-package - 3 common examples

To help you get started, we’ve selected a few stringify-package 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 teambit / bit / src / consumer / component / package-json-vinyl.ts View on Github external
static load({
    base,
    path,
    content,
    indent,
    newline,
    override = true
  }: {
    base: string;
    path: string;
    content: Record;
    indent?: string | null | undefined;
    newline?: string | null | undefined;
    override?: boolean;
  }): PackageJsonVinyl {
    const jsonStr = stringifyPackage(content, indent, newline);
    // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
    const jsonFile = new PackageJsonVinyl({ base, path, contents: Buffer.from(jsonStr) });
    jsonFile.override = override;
    return jsonFile;
  }
}
github teambit / bit / src / consumer / component / package-json-file.ts View on Github external
async write() {
    if (!this.workspaceDir) throw new Error('PackageJsonFile is unable to write, workspaceDir is not defined');
    const pathToWrite = path.join(this.workspaceDir, this.filePath);
    logger.debug(`package-json-file.write, path ${pathToWrite}`);
    const packageJsonStr = stringifyPackage(this.packageJsonObject, this.indent, this.newline);
    await fs.outputFile(pathToWrite, packageJsonStr);
    this.fileExist = true;
  }
github teambit / bit / src / consumer / component / package-json-file.js View on Github external
async write() {
    if (!this.workspaceDir) throw new Error('PackageJsonFile is unable to write, workspaceDir is not defined');
    const pathToWrite = path.join(this.workspaceDir, this.filePath);
    logger.debug(`package-json-file.write, path ${pathToWrite}`);
    const packageJsonStr = stringifyPackage(this.packageJsonObject, this.indent, this.newline);
    await fs.outputFile(pathToWrite, packageJsonStr);
    this.fileExist = true;
  }

stringify-package

stringifies npm-written json files

ISC
Latest version published 5 years ago

Package Health Score

50 / 100
Full package analysis

Popular stringify-package functions