Skip to content

Commit

Permalink
Merge pull request #52 from prisma/fix-prisma-client-notfound
Browse files Browse the repository at this point in the history
fix(custom): fix prisma types not being found
  • Loading branch information
jharrell authored Nov 13, 2024
2 parents 5e5df2c + 296b774 commit 19fab8c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
node-version: "lts/*"
- run: npm clean-install
- run: npx nuxi prepare
- run: npm run dev:build
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Release
Expand Down
1 change: 1 addition & 0 deletions playground/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface ModuleOptions extends Prisma.PrismaClientOptions {
generateClient: boolean;
installStudio: boolean;
autoSetupPrisma: boolean;
skipPrompts: boolean;
}

export type PrismaExtendedModule = ModuleOptions;
Expand All @@ -59,6 +60,7 @@ export default defineNuxtModule<PrismaExtendedModule>({
generateClient: true,
installStudio: true,
autoSetupPrisma: false,
skipPrompts: false,
},

async setup(options, nuxt) {
Expand All @@ -69,6 +71,9 @@ export default defineNuxtModule<PrismaExtendedModule>({
// Identifies which script is running: posinstall, dev or prod
const npm_lifecycle_event = process.env?.npm_lifecycle_event;

const skip_all_prompts =
options.skipPrompts || npm_lifecycle_event === "dev:build";

const prepareModule = () => {
// Enable server components for Nuxt
nuxt.options.experimental.componentIslands ||= {};
Expand Down Expand Up @@ -157,8 +162,8 @@ export default defineNuxtModule<PrismaExtendedModule>({
}

const promptResult = await executeRequiredPrompts({
promptForMigrate: true,
promptForPrismaStudio: false,
promptForMigrate: true && !skip_all_prompts,
promptForPrismaStudio: false && !skip_all_prompts,
});

if (promptResult?.promptForPrismaMigrate && options.runMigration) {
Expand Down Expand Up @@ -208,8 +213,8 @@ export default defineNuxtModule<PrismaExtendedModule>({
}

const promptResults = await executeRequiredPrompts({
promptForMigrate: false,
promptForPrismaStudio: true,
promptForMigrate: false && !skip_all_prompts,
promptForPrismaStudio: true && !skip_all_prompts,
});

if (promptResults?.promptForInstallingStudio) {
Expand Down

0 comments on commit 19fab8c

Please sign in to comment.