diff --git a/bun.lockb b/bun.lockb index ec5246e..56072c8 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/example/prisma/schema.prisma b/example/prisma/schema.prisma index bcea436..cd13353 100644 --- a/example/prisma/schema.prisma +++ b/example/prisma/schema.prisma @@ -3,7 +3,9 @@ generator client { } generator custom_generator { - provider = "prisma-generator-fake-data" + ///in your project, you'll use it like this + ///provider = "prisma-generator-fake-data" + provider = "ts-node ../src/bin.ts" extraImport = "import {fakeSettings} from './fakeData.utils'" extraExport = "export * from './fakeData.utils'" } diff --git a/example/yarn.lock b/example/yarn.lock index 64c7978..0c561b4 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -39,6 +39,11 @@ dependencies: "@prisma/engines-version" "4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584" +"@prisma/client@^5.8.1": + version "5.8.1" + resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.8.1.tgz#7815ec51c0ca2a6de219c02e7846701ae3baf240" + integrity sha512-xQtMPfbIwLlbm0VVIVQY2yqQVOxPwRQhvIp7Z3m2900g1bu/zRHKhYZJQWELqmjl6d8YwBy0K2NvMqh47v1ubw== + "@prisma/debug@5.8.1": version "5.8.1" resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.8.1.tgz#704daa36919b0fc4d227260ecebfa1c94b155b07" @@ -78,7 +83,7 @@ "@prisma/engines-version" "5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2" "@prisma/get-platform" "5.8.1" -"@prisma/generator-helper@5.8.1", "@prisma/generator-helper@^5.0.0": +"@prisma/generator-helper@5.8.1", "@prisma/generator-helper@^5.8.1": version "5.8.1" resolved "https://registry.yarnpkg.com/@prisma/generator-helper/-/generator-helper-5.8.1.tgz#11d226bf004839763375303a7a081913796df06b" integrity sha512-2EDd0o+GHfbX1dtw5BnfOz3hQB7AtYrwe4YNiKfo2UDBvB/ne/ChZa3b/vBm/GKpjW2Xaymct8D9oIHev3juzQ== @@ -92,7 +97,7 @@ dependencies: "@prisma/debug" "5.8.1" -"@prisma/internals@^5.0.0": +"@prisma/internals@^5.8.1": version "5.8.1" resolved "https://registry.yarnpkg.com/@prisma/internals/-/internals-5.8.1.tgz#cb73784f64846a65efe74f5f563ec8908ac857e9" integrity sha512-9okoCgLeMqql58IbEG3YmzgNLRUQdN+qZUYp2DojWC7VAmL9TSOKQ5Dcc0588cKAsCBBDUQ2jfdflorYkzeFKw== @@ -182,12 +187,12 @@ make-error@^1.1.1: integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== "prisma-generator-fake-data@file:..": - version "0.13.0" + version "0.14.0" dependencies: "@faker-js/faker" "^8.0.2" - "@prisma/client" "^5.0.0" - "@prisma/generator-helper" "^5.0.0" - "@prisma/internals" "^5.0.0" + "@prisma/client" "^5.8.1" + "@prisma/generator-helper" "^5.8.1" + "@prisma/internals" "^5.8.1" decimal.js "^10.4.3" tiny-invariant "^1.3.1" diff --git a/package.json b/package.json index 8c6f850..9273f51 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,9 @@ }, "dependencies": { "@faker-js/faker": "^8.0.2", - "@prisma/client": "^5.0.0", - "@prisma/generator-helper": "^5.0.0", - "@prisma/internals": "^5.0.0", + "@prisma/client": "^5.8.1", + "@prisma/generator-helper": "^5.8.1", + "@prisma/internals": "^5.8.1", "decimal.js": "^10.4.3", "tiny-invariant": "^1.3.1" }, @@ -32,7 +32,7 @@ "generate-changelog": "^1.8.0", "prettier": "^2.8.7", "pretty-quick": "^3.1.3", - "prisma": "^5.0.0", + "prisma": "^5.8.1", "release-it": "^15.9.3", "typescript": "^5.0.2", "vitest": "^0.29.8" diff --git a/src/utils/generatorUtils.ts b/src/utils/generatorUtils.ts index 3c6de4c..db6871b 100644 --- a/src/utils/generatorUtils.ts +++ b/src/utils/generatorUtils.ts @@ -1,9 +1,19 @@ import { GeneratorOptions } from '@prisma/generator-helper'; export function extractClientPath(options: GeneratorOptions) { - return ( - options.otherGenerators.find( - (g) => g?.provider?.value === 'prisma-client-js', - )?.output?.value || undefined - ); + const clientPath = options.otherGenerators.find( + (g) => g?.provider?.value === 'prisma-client-js', + )?.output?.value; + + /** + * not sure what changed, but this value was undefined before + * and now it's set to the full path of the client (including + * the user folder etc). If we detect that, we just return + * the @prisma/client string + */ + if (clientPath?.includes('node_modules/@prisma/client')) { + return '@prisma/client'; + } + + return clientPath || undefined; }