diff options
| author | 2023-08-16 20:12:02 -0300 | |
|---|---|---|
| committer | 2023-08-16 16:12:02 -0700 | |
| commit | 2634c64aa32fec00073bd0a776e5ac67ad6aa6e5 (patch) | |
| tree | 7092edaa9484a3070708a7f276e9db2860a02390 /test/js | |
| parent | af23dab833e76c65fa28788d7c23ff97ef8fd428 (diff) | |
| download | bun-2634c64aa32fec00073bd0a776e5ac67ad6aa6e5.tar.gz bun-2634c64aa32fec00073bd0a776e5ac67ad6aa6e5.tar.zst bun-2634c64aa32fec00073bd0a776e5ac67ad6aa6e5.zip | |
Fix prisma linux generation (#4150)
* check
* fmt + fix
* fmt
* ops
* add more targets
* more targets
* oops
* update bun lock and prisma
* manually add openssl
* targets on sqlite
Diffstat (limited to 'test/js')
6 files changed, 28 insertions, 11 deletions
diff --git a/test/js/third_party/prisma/helper.ts b/test/js/third_party/prisma/helper.ts index 8b4462247..ae11ede20 100644 --- a/test/js/third_party/prisma/helper.ts +++ b/test/js/third_party/prisma/helper.ts @@ -1,5 +1,6 @@ import path from "path"; import { bunExe, bunEnv } from "harness"; +import fs from "fs"; const cwd = import.meta.dir; export async function generateClient(type: string) { @@ -39,15 +40,27 @@ export function migrate(type: string) { } export function generate(type: string) { - const result = Bun.spawnSync( - [bunExe(), "prisma", "generate", "--schema", path.join(cwd, "prisma", type, "schema.prisma")], - { - cwd, - env: { - ...bunEnv, - NODE_ENV: undefined, - }, + const schema = path.join(cwd, "prisma", type, "schema.prisma"); + + const content = fs + .readFileSync(schema) + .toString("utf8") + // only affect linux + .replace( + "%binaryTargets%", + process.platform === "win32" || process.platform === "darwin" + ? "" + : 'binaryTargets = ["native", "debian-openssl-1.1.x", "debian-openssl-3.0.x", "linux-musl", "linux-musl-openssl-3.0.x"]', + ); + + fs.writeFileSync(schema, content); + + const result = Bun.spawnSync([bunExe(), "prisma", "generate", "--schema", schema], { + cwd, + env: { + ...bunEnv, + NODE_ENV: undefined, }, - ); + }); if (!result.success) throw new Error(result.stderr.toString("utf8")); } diff --git a/test/js/third_party/prisma/package.json b/test/js/third_party/prisma/package.json index 7455b963b..4086944d0 100644 --- a/test/js/third_party/prisma/package.json +++ b/test/js/third_party/prisma/package.json @@ -4,13 +4,13 @@ "type": "module", "devDependencies": { "bun-types": "0.7.0", - "prisma": "5.0.0" + "prisma": "5.1.1" }, "peerDependencies": { "typescript": "5.0.0" }, "dependencies": { - "@prisma/client": "5.0.0" + "@prisma/client": "5.1.1" }, "scripts": { "postinstall": "prisma generate --schema=./prisma/schema.prisma" diff --git a/test/js/third_party/prisma/prisma/mongodb/schema.prisma b/test/js/third_party/prisma/prisma/mongodb/schema.prisma index 42e77d1d4..184ac829b 100644 --- a/test/js/third_party/prisma/prisma/mongodb/schema.prisma +++ b/test/js/third_party/prisma/prisma/mongodb/schema.prisma @@ -4,6 +4,7 @@ generator client { provider = "prisma-client-js" output = "client" + %binaryTargets% } datasource db { diff --git a/test/js/third_party/prisma/prisma/mssql/schema.prisma b/test/js/third_party/prisma/prisma/mssql/schema.prisma index ea10aae7d..1e275ee7b 100644 --- a/test/js/third_party/prisma/prisma/mssql/schema.prisma +++ b/test/js/third_party/prisma/prisma/mssql/schema.prisma @@ -4,6 +4,7 @@ generator client { provider = "prisma-client-js" output = "client" + %binaryTargets% } datasource db { diff --git a/test/js/third_party/prisma/prisma/postgres/schema.prisma b/test/js/third_party/prisma/prisma/postgres/schema.prisma index 4884e21ce..afbd6f39a 100644 --- a/test/js/third_party/prisma/prisma/postgres/schema.prisma +++ b/test/js/third_party/prisma/prisma/postgres/schema.prisma @@ -4,6 +4,7 @@ generator client { provider = "prisma-client-js" output = "client" + %binaryTargets% } datasource db { diff --git a/test/js/third_party/prisma/prisma/sqlite/schema.prisma b/test/js/third_party/prisma/prisma/sqlite/schema.prisma index 1759eeaf1..bbe3292cb 100644 --- a/test/js/third_party/prisma/prisma/sqlite/schema.prisma +++ b/test/js/third_party/prisma/prisma/sqlite/schema.prisma @@ -4,6 +4,7 @@ generator client { provider = "prisma-client-js" output = "client" + %binaryTargets% } datasource db { |
