How to use the write-yaml-file.sync function in write-yaml-file

To help you get started, we’ve selected a few write-yaml-file 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 pnpm / pnpm / privatePackages / prepare / src / index.ts View on Github external
manifestFormat?: ManifestFormat,
    tempDir?: string,
  }
) {
  const dir = opts?.tempDir ?? path.join(tempDir(test), 'project')

  makeDir.sync(dir)
  switch (opts?.manifestFormat ?? 'JSON') {
    case 'JSON':
      writePkg.sync(dir, { name: 'project', version: '0.0.0', ...manifest } as any) // tslint:disable-line
      break
    case 'JSON5':
      writeJson5File(path.join(dir, 'package.json5'), { name: 'project', version: '0.0.0', ...manifest } as any) // tslint:disable-line
      break
    case 'YAML':
      writeYamlFile(path.join(dir, 'package.yaml'), { name: 'project', version: '0.0.0', ...manifest } as any) // tslint:disable-line
      break
  }
  process.chdir(dir)

  return assertProject(test, dir)
}

write-yaml-file

Stringify and write YAML to a file atomically

MIT
Latest version published 12 months ago

Package Health Score

66 / 100
Full package analysis

Popular write-yaml-file functions