1
0
mirror of https://github.com/webstudio-is/webstudio.git synced 2025-03-15 09:45:09 +00:00

build: Support PRISMA_BINARY_TARGET, support mode as NODE_ENV ()

## Description

Allow set `PRISMA_BINARY_TARGET` during build
Use mode to overwrite "NODE_ENV"

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
5de6)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env.example`
and the `builder/env-check.js` if mandatory
This commit is contained in:
Ivan Starkov
2024-04-11 16:53:32 +03:00
committed by GitHub
parent 40d2de0439
commit 3d746fefde
4 changed files with 15 additions and 3 deletions
_todo_vercel.json
apps/builder
packages/prisma-client

5
_todo_vercel.json Normal file

@ -0,0 +1,5 @@
{
"git": {
"deploymentEnabled": false
}
}

@ -4,7 +4,7 @@ import { vitePlugin as remix } from "@remix-run/dev";
const isStorybook = process.argv[1]?.includes("storybook") ?? false;
export default defineConfig({
export default defineConfig(({ mode }) => ({
plugins: [isStorybook === false && remix()],
resolve: {
conditions: ["webstudio", "import", "module", "browser", "default"],
@ -15,7 +15,10 @@ export default defineConfig({
},
],
},
define: {
"process.env.NODE_ENV": JSON.stringify(mode),
},
ssr: {
external: ["@webstudio-is/prisma-client"],
},
});
}));

@ -9,7 +9,9 @@
"typecheck": "tsc",
"checks": "pnpm typecheck",
"dev": "pnpm build",
"build": "prisma format && prisma generate && esbuild src/prisma.ts --outdir=lib --format=cjs && cp src/cjs/package.json lib && cp -r src/__generated__ lib/__generated__ && pnpm dts",
"build": "prisma format && pnpm generate && esbuild src/prisma.ts --outdir=lib --format=cjs && cp src/cjs/package.json lib && cp -r src/__generated__ lib/__generated__ && pnpm dts",
"generate": "PRISMA_BINARY_TARGET=${PRISMA_BINARY_TARGET:-'[\"native\"]'} prisma generate",
"build:prod": "PRISMA_BINARY_TARGET='[\"rhel-openssl-1.0.x\"]' pnpm build",
"dts": "tsc --declarationDir lib",
"migrations": "./migrations-cli/cli.ts"
},

@ -8,6 +8,8 @@ generator client {
// <output-placeholder-for-migrations>
output = "../src/__generated__"
// </output-placeholder-for-migrations>
binaryTargets = env("PRISMA_BINARY_TARGET")
}
datasource db {