diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e030a17..24f95f2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 diff --git a/playground/package-lock.json b/playground/package-lock.json index f5206d8..6f1528b 100644 --- a/playground/package-lock.json +++ b/playground/package-lock.json @@ -2546,6 +2546,7 @@ "integrity": "sha512-M0SVXfyHnQREBKxCgyo7sffrKttwE6R8PMq330MIUF0pTwjUhLbW84pFDlf06B27XyCR++VtjugEnIHdr07SVA==", "dev": true, "hasInstallScript": true, + "license": "Apache-2.0", "engines": { "node": ">=16.13" }, diff --git a/src/module.ts b/src/module.ts index ae7a56f..90779dc 100644 --- a/src/module.ts +++ b/src/module.ts @@ -33,6 +33,7 @@ interface ModuleOptions extends Prisma.PrismaClientOptions { generateClient: boolean; installStudio: boolean; autoSetupPrisma: boolean; + skipPrompts: boolean; } export type PrismaExtendedModule = ModuleOptions; @@ -59,6 +60,7 @@ export default defineNuxtModule({ generateClient: true, installStudio: true, autoSetupPrisma: false, + skipPrompts: false, }, async setup(options, nuxt) { @@ -69,6 +71,9 @@ export default defineNuxtModule({ // 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 ||= {}; @@ -157,8 +162,8 @@ export default defineNuxtModule({ } const promptResult = await executeRequiredPrompts({ - promptForMigrate: true, - promptForPrismaStudio: false, + promptForMigrate: true && !skip_all_prompts, + promptForPrismaStudio: false && !skip_all_prompts, }); if (promptResult?.promptForPrismaMigrate && options.runMigration) { @@ -208,8 +213,8 @@ export default defineNuxtModule({ } const promptResults = await executeRequiredPrompts({ - promptForMigrate: false, - promptForPrismaStudio: true, + promptForMigrate: false && !skip_all_prompts, + promptForPrismaStudio: true && !skip_all_prompts, }); if (promptResults?.promptForInstallingStudio) {