How to use the @prisma/sdk.getGenerators function in @prisma/sdk

To help you get started, we’ve selected a few @prisma/sdk 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 / Generate.ts View on Github external
public async parse(argv: string[], minimalOutput = false): Promise {
    const datamodelPath = await getSchemaPath()
    if (!datamodelPath) {
      throw new Error(`Can't find schema.prisma`) // TODO: Add this into a central place in getSchemaPath() as an arg
    }
    const generators = await getGenerators({
      schemaPath: datamodelPath,
      providerAliases: this.aliases,
      printDownloadProgress: true,
      version: pkg.prisma.version,
    })

    if (generators.length === 0) {
      console.log(missingGeneratorMessage)
    }

    // CONTINUE HERE

    for (const generator of generators) {
      const toStr = generator.options!.generator.output! ? chalk.dim(` to ${generator.options!.generator.output}`) : ''
      const name = generator.manifest ? generator.manifest.prettyName : generator.options!.generator.provider
      console.log(`Generating ${chalk.bold(name!)}${toStr}`)
github prisma / lift / src / Lift.ts View on Github external
public async watch(options: WatchOptions = { preview: false, clear: true, providerAliases: {} }): Promise {
    if (!options.clear) {
      options.clear = true
    }

    const datamodel = await this.getDatamodel()

    const generators = await getGenerators({
      schemaPath: getDatamodelPath(this.projectDir),
      printDownloadProgress: false,
      version: packageJson.prisma.version,
      cliVersion: packageJson.version,
    })

    this.studioPort = await getPort({ port: getPort.makeRange(5555, 5600) })

    const datamodelPath = getDatamodelPath(this.projectDir)
    const relativeDatamodelPath = path.relative(process.cwd(), datamodelPath)

    // From here on, we render the dev ui
    const renderer = new DevComponentRenderer({
      port: this.studioPort,
      initialState: {
        studioPort: this.studioPort,