Skip to content

Commit

Permalink
Add shebang, fix compatibility with Prisma 5.7.0
Browse files Browse the repository at this point in the history
The main script was missing a shebang, which caused it not to work with
several package manager and/or OS combinations. This adds that in, which
should fix the issues.

Additionally, the 5.7.0 version of @prisma/generator-helper no longer
seems to support named imports when importing from an ESM package, so
this switches to using the default export.

This also updates all dependencies to their latest versions.
  • Loading branch information
mogzol committed Dec 11, 2023
1 parent c9fd12d commit bc6eddc
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 160 deletions.
7 changes: 6 additions & 1 deletion generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { DMMF, generatorHandler } from "@prisma/generator-helper";
#!/usr/bin/env node
import type { DMMF } from "@prisma/generator-helper";
import generatorHelper from "@prisma/generator-helper";
import { mkdir, writeFile } from "node:fs/promises";
import { dirname } from "node:path";

// Need to use default export for ESM compatibility
const { generatorHandler } = generatorHelper;

interface Config {
enumPrefix: string;
enumSuffix: string;
Expand Down
Loading

0 comments on commit bc6eddc

Please sign in to comment.