How to use the @prisma/fetch-engine.download function in @prisma/fetch-engine

To help you get started, we’ve selected a few @prisma/fetch-engine 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 prisma / prisma2 / cli / prisma2 / src / CLI.ts View on Github external
return Version.new().parse(argv)
    }
    // display help for help flag or no subcommand
    if (args._.length === 0 || args['--help']) {
      return this.help()
    }

    // check if we have that subcommand
    const cmdName = args._[0]
    const cmd = this.cmds[cmdName]
    if (cmd) {
      // if we have that subcommand, let's ensure that the binary is there in case the command needs it
      if (this.ensureBinaries.includes(cmdName)) {
        const binaryPath = eval(`require('path').join(__dirname, '../')`)
        const version = (pkg && pkg.prisma && pkg.prisma.version) || 'latest'
        await download({
          binaries: {
            'query-engine': binaryPath,
            'migration-engine': binaryPath,
            'introspection-engine': binaryPath,
          },
          showProgress: true,
          version,
          failSilent: false,
        })
      }

      return cmd.parse(args._.slice(1))
    }
    // unknown command
    return unknownCommand(CLI.help, args._[0])
  }
github MichalLytek / type-graphql / tests / helpers / ensure-engine.ts View on Github external
import { download } from "@prisma/fetch-engine";
import path from "path";
import fs from "fs";

const photonRuntimeDir = path.join(
  __dirname,
  "../../node_modules/@prisma/photon",
);

if (!fs.existsSync(photonRuntimeDir)) {
  throw new Error("Missing Photon directory: " + photonRuntimeDir);
}

download({
  binaries: {
    "query-engine": photonRuntimeDir,
  },
  showProgress: true,
})
  .then(() => process.exit(0))
  .catch(() => process.exit(1));
github prisma / prisma2 / cli / sdk / src / getGenerators.ts View on Github external
},
      {},
    )

    const downloadParams: DownloadOptions = {
      binaries: binariesConfig,
      binaryTargets: binaryTargets as any[],
      showProgress:
        typeof printDownloadProgress === 'boolean'
          ? printDownloadProgress
          : true,
      version: version || 'latest',
      skipDownload,
    }

    const binaryPathsWithEngineType = await download(downloadParams)
    const binaryPaths = mapKeys(
      binaryPathsWithEngineType,
      binaryTypeToEngineType,
    )

    for (const generator of generators) {
      if (generator.manifest && generator.manifest.requiresEngines) {
        const generatorBinaryPaths = pick(
          binaryPaths,
          generator.manifest.requiresEngines,
        )
        generator.setBinaryPaths(generatorBinaryPaths)
      }
    }

    return generators

@prisma/fetch-engine

This package is intended for Prisma's internal use

Apache-2.0
Latest version published 4 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages