How to use the pacote.tarball function in pacote

To help you get started, we’ve selected a few pacote 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 expo / expo-cli / packages / xdl / src / Exp.ts View on Github external
export async function extractTemplateAppAsync(
  templateSpec: PackageSpec,
  targetPath: string,
  config: AppJSONConfig | BareAppConfig
) {
  let tarStream = await pacote.tarball.stream(templateSpec, {
    cache: path.join(UserSettings.dotExpoHomeDirectory(), 'template-cache'),
  });
  await fs.mkdirp(targetPath);
  await new Promise((resolve, reject) => {
    const extractStream = tar.x({
      cwd: targetPath,
      strip: 1,
      // TODO(ville): pending https://github.com/DefinitelyTyped/DefinitelyTyped/pull/36598
      // @ts-ignore property missing from the type definition
      transform: createFileTransform(config),
      onentry(entry: ReadEntry) {
        if (config.name) {
          // Rewrite paths for bare workflow
          entry.path = entry.path
            .replace(/HelloWorld/g, config.name)
            .replace(/helloworld/g, config.name.toLowerCase());

pacote

JavaScript package downloader

ISC
Latest version published 18 days ago

Package Health Score

95 / 100
Full package analysis