diff --git a/.github/workflows/validate-workflow.yml b/.github/workflows/validate-workflow.yml index 50e378d4..e59ffd76 100644 --- a/.github/workflows/validate-workflow.yml +++ b/.github/workflows/validate-workflow.yml @@ -90,7 +90,8 @@ jobs: run: | npm install --global vercel@latest vercel link --token $VERCEL_TOKEN --scope openint-dev --yes - vercel env pull --token $VERCEL_TOKEN ./apps/web/.env.local + vercel env pull --token $VERCEL_TOKEN ./apps/web/.env.local.orig + cat ./apps/web/.env.local.orig | pnpm bun scripts/escape-env.ts > ./apps/web/.env.local - name: Ensure OpenAPI spec and docs are up to date run: pnpm --dir ./kits/sdk run gen && pnpm --dir ./docs generate && git diff --exit-code diff --git a/package.json b/package.json index 62e103bb..a87d21ac 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,10 @@ "pgdump": "pg_dump --schema public --schema-only --no-owner --exclude-schema=graphile_migrate --file=packages/db/schema.sql $DATABASE_URL", "worker:setup": "tsx ./bin/openint setupWorker", "worker:run": "tsx ./bin/openint runWorker", - "env:pull": "vercel env pull --environment development .env.dev && vercel env pull --environment preview --git-branch $(git rev-parse --abbrev-ref HEAD) .env.pre && vercel env pull --environment production .env.prod" + "env:pull:development": "vercel env pull --environment development .env.dev.orig && cat .env.dev.orig | pnpm bun scripts/escape-env.ts > .env.dev", + "env:pull:preview": "vercel env pull --environment preview --git-branch $(git rev-parse --abbrev-ref HEAD) .env.pre.orig && cat .env.pre.orig | pnpm bun scripts/escape-env.ts > .env.pre", + "env:pull:production": "vercel env pull --environment production .env.prod.orig && cat .env.prod.orig | pnpm bun scripts/escape-env.ts > .env.prod", + "env:pull": "run-s env:pull:*" }, "lint-staged": { "**/*.{js,ts,tsx,json,css,yml,yaml}": "prettier --write", @@ -46,6 +49,7 @@ "@types/prettier": "3.0.0", "@typescript-eslint/eslint-plugin": "6.21.0", "@typescript-eslint/parser": "6.21.0", + "bun": "latest", "esbuild": "0.17.5", "esbuild-jest": "0.5.0", "eslint": "8.23.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 70cd3727..47c77520 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -80,6 +80,9 @@ importers: '@typescript-eslint/parser': specifier: 6.21.0 version: 6.21.0(eslint@8.23.0)(typescript@5.7.3) + bun: + specifier: latest + version: 1.2.4 esbuild: specifier: 0.17.5 version: 0.17.5 @@ -5452,56 +5455,111 @@ packages: cpu: [arm64] os: [darwin] + '@oven/bun-darwin-aarch64@1.2.4': + resolution: {integrity: sha512-xBz/Q7X6AFwMg7MXtBemjjt5uB+tvEYBmi9Zbm1r8qnI2V8m/Smuhma0EARhiVfLuIAYj2EM5qjzxeAFV4TBJA==} + cpu: [arm64] + os: [darwin] + '@oven/bun-darwin-x64-baseline@1.2.3': resolution: {integrity: sha512-oYqGnocQ7eY5wfthGivpXd0lzLYklXU4rEKXU4+oLaiFeFnY3lyszv85UHjywuB5bl7xybmSIE8tN8ie36WY1w==} cpu: [x64] os: [darwin] + '@oven/bun-darwin-x64-baseline@1.2.4': + resolution: {integrity: sha512-stsq8vBiYgfGunBGlf2M7ST7Ymyw3WnwrxEeJ04vkKmMEEE2LpX8Rkol6UPRvZawab9s9/scFIRgFi6hu9H4SQ==} + cpu: [x64] + os: [darwin] + '@oven/bun-darwin-x64@1.2.3': resolution: {integrity: sha512-kBeKYLNAwQrcJ1HPcuDGo3PGEfDvzHbL5N5kiaui1+eluyCS2yJZvuy2ddg9b0vqQkgzNu7D1keiRLpdR2Wneg==} cpu: [x64] os: [darwin] + '@oven/bun-darwin-x64@1.2.4': + resolution: {integrity: sha512-ufyty+2754QCFDhq447H39JiqabMlFRItLn1YFp+2hdpKak7KCYLGOUuHnlr1pmImKJzDHURjnvTTq1QRlUWAA==} + cpu: [x64] + os: [darwin] + '@oven/bun-linux-aarch64-musl@1.2.3': resolution: {integrity: sha512-nSB6FU29OW+8zUP5jRrQEAXl9m6Jd8vp5Swplh3prc0L0niYdtan39wouCxDVFNJafC0DaeKQme4UMQJ65s9qw==} cpu: [aarch64] os: [linux] + '@oven/bun-linux-aarch64-musl@1.2.4': + resolution: {integrity: sha512-+lxWF7up9MuB1ZdGxXCH3AH3XmYtdBC6soQ38+yg3+y3iOPrAlSG+wytHEkypN/UU2mGvCuaEED3cMvejrGdDw==} + cpu: [aarch64] + os: [linux] + '@oven/bun-linux-aarch64@1.2.3': resolution: {integrity: sha512-hbi7ykhLAtoBZl7mox5Qg6xVy9FcnPNibo/h6A1oElXBl4pRaVGNFDsuDmb80f9sFf4yZL0vwYyb47hL89MiGw==} cpu: [arm64] os: [linux] + '@oven/bun-linux-aarch64@1.2.4': + resolution: {integrity: sha512-OhVpzme2vvLA7w8GYeJg2SQ2h2CwJQN9oYDiGeoML4EwE+DEoYHdxgaBZsQySOwZtFIr8ufpc/8iD4hssJ50qg==} + cpu: [arm64] + os: [linux] + '@oven/bun-linux-x64-baseline@1.2.3': resolution: {integrity: sha512-PrkC18s81ImpHMdqgFXvyq9Oxed8mzlYb709DsuuoV9NL3nrzQzfqq8JStz/g3dYMc4obrljG/EKXGfMaJMJVA==} cpu: [x64] os: [linux] + '@oven/bun-linux-x64-baseline@1.2.4': + resolution: {integrity: sha512-3nmDDZJH73MzhBg2sRYioj4CE8wgaz0w24OieMqj4/c44BbNr3X5RewrldsMD2cU6DtVbi52FuD5WpTw3N8nmw==} + cpu: [x64] + os: [linux] + '@oven/bun-linux-x64-musl-baseline@1.2.3': resolution: {integrity: sha512-1VsFwYMOryIsnTGPG70N1HAXoa8Fa7s+XAtP2Y010tao0omgpM0S6Go0Uc7VJ8g+yHKyIw79leRMwUs35ysQZA==} cpu: [x64] os: [linux] + '@oven/bun-linux-x64-musl-baseline@1.2.4': + resolution: {integrity: sha512-qDsUvKCW0WUlVOt6Yx5eEzxgCbvzuSJBsu0sXtr6uGt8TnMKghmliRO5FmiMLQ0k/PUDA8vPJCtuv5k14bDi6g==} + cpu: [x64] + os: [linux] + '@oven/bun-linux-x64-musl@1.2.3': resolution: {integrity: sha512-481HyvBKKXrKH2VZsSBVsqsqxcnncqpsKz7qgTqnSEToCSyNqc3bGrI6pN6haI9nLawJpIh+oNXCg4JISUi6bg==} cpu: [x64] os: [linux] + '@oven/bun-linux-x64-musl@1.2.4': + resolution: {integrity: sha512-cLdMbK7srNoUbYSG3Tp4GYdPAO0+5mgUhdbU053GZs0DLQmQ8h1JQhALp+ZjrUWstmQe7ddcNu7l7EAu6E76XA==} + cpu: [x64] + os: [linux] + '@oven/bun-linux-x64@1.2.3': resolution: {integrity: sha512-oxubd+zJW8+1H02bwzne8lj2EtvgoRU6w245hWMtwjo15IET/YGc01ndFRd42FX02bwo926N+7Jm7NFzS8GOHQ==} cpu: [x64] os: [linux] + '@oven/bun-linux-x64@1.2.4': + resolution: {integrity: sha512-oof3ii92Cz2yIOZRbVFHMHmffCutRPFITIdXLZ2/rkqVuKUe0ZdqWjHPhxJFm31AL9MlJ/dSqDbPb51SaLI7tw==} + cpu: [x64] + os: [linux] + '@oven/bun-windows-x64-baseline@1.2.3': resolution: {integrity: sha512-pvtDgWRclz/bxLEWUAppj854MklfTu01DfHAvKzV1UAHbBOlurC8+StpE7EhITAHC/jBK9U39eVYnZNvumVU9w==} cpu: [x64] os: [win32] + '@oven/bun-windows-x64-baseline@1.2.4': + resolution: {integrity: sha512-j/G4bnfsRAiCvpTADda40m29iSGvueIaF9Kc9hBu4jN8dTS9fEXdNNXuf8c30/z7/npxw2dhzsAn8jbc5QvD1A==} + cpu: [x64] + os: [win32] + '@oven/bun-windows-x64@1.2.3': resolution: {integrity: sha512-z3G7jft1hbiiX47rY666i3HFJZBqCLgddr7e0ccoE/kUk4U5IB08mqJZYW0vaaL8zy0wuEF2h5VkK0S/iryLWw==} cpu: [x64] os: [win32] + '@oven/bun-windows-x64@1.2.4': + resolution: {integrity: sha512-4YRJd4pdaTWEM+uawYmchOeNv874RGAFpIZQubWnN4SBf6HfcDm0OMMZcm0f0I70Wd5gbPg1+rvCRtDZWVmZog==} + cpu: [x64] + os: [win32] + '@panva/asn1.js@1.0.0': resolution: {integrity: sha512-UdkG3mLEqXgnlKsWanWcgb6dOjUzJ+XC5f+aWw30qrtjxeNUSfKX1cd5FBzOaXQumoe9nIqeZUvrRJS03HCCtw==} engines: {node: '>=10.13.0'} @@ -8733,6 +8791,12 @@ packages: os: [darwin, linux, win32] hasBin: true + bun@1.2.4: + resolution: {integrity: sha512-ZY0EZ/UKqheaLeAtMsfJA6jWoWvV9HAtfFaOJSmS3LrNpFKs1Sg5fZLSsczN1h3a+Dtheo4O3p3ZYWrf40kRGw==} + cpu: [arm64, x64, aarch64] + os: [darwin, linux, win32] + hasBin: true + busboy@1.6.0: resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} engines: {node: '>=10.16.0'} @@ -19987,36 +20051,69 @@ snapshots: '@oven/bun-darwin-aarch64@1.2.3': optional: true + '@oven/bun-darwin-aarch64@1.2.4': + optional: true + '@oven/bun-darwin-x64-baseline@1.2.3': optional: true + '@oven/bun-darwin-x64-baseline@1.2.4': + optional: true + '@oven/bun-darwin-x64@1.2.3': optional: true + '@oven/bun-darwin-x64@1.2.4': + optional: true + '@oven/bun-linux-aarch64-musl@1.2.3': optional: true + '@oven/bun-linux-aarch64-musl@1.2.4': + optional: true + '@oven/bun-linux-aarch64@1.2.3': optional: true + '@oven/bun-linux-aarch64@1.2.4': + optional: true + '@oven/bun-linux-x64-baseline@1.2.3': optional: true + '@oven/bun-linux-x64-baseline@1.2.4': + optional: true + '@oven/bun-linux-x64-musl-baseline@1.2.3': optional: true + '@oven/bun-linux-x64-musl-baseline@1.2.4': + optional: true + '@oven/bun-linux-x64-musl@1.2.3': optional: true + '@oven/bun-linux-x64-musl@1.2.4': + optional: true + '@oven/bun-linux-x64@1.2.3': optional: true + '@oven/bun-linux-x64@1.2.4': + optional: true + '@oven/bun-windows-x64-baseline@1.2.3': optional: true + '@oven/bun-windows-x64-baseline@1.2.4': + optional: true + '@oven/bun-windows-x64@1.2.3': optional: true + '@oven/bun-windows-x64@1.2.4': + optional: true + '@panva/asn1.js@1.0.0': {} '@pkgjs/parseargs@0.11.0': @@ -24251,6 +24348,20 @@ snapshots: '@oven/bun-windows-x64': 1.2.3 '@oven/bun-windows-x64-baseline': 1.2.3 + bun@1.2.4: + optionalDependencies: + '@oven/bun-darwin-aarch64': 1.2.4 + '@oven/bun-darwin-x64': 1.2.4 + '@oven/bun-darwin-x64-baseline': 1.2.4 + '@oven/bun-linux-aarch64': 1.2.4 + '@oven/bun-linux-aarch64-musl': 1.2.4 + '@oven/bun-linux-x64': 1.2.4 + '@oven/bun-linux-x64-baseline': 1.2.4 + '@oven/bun-linux-x64-musl': 1.2.4 + '@oven/bun-linux-x64-musl-baseline': 1.2.4 + '@oven/bun-windows-x64': 1.2.4 + '@oven/bun-windows-x64-baseline': 1.2.4 + busboy@1.6.0: dependencies: streamsearch: 1.1.0 diff --git a/scripts/escape-env.ts b/scripts/escape-env.ts new file mode 100644 index 00000000..aa7637b2 --- /dev/null +++ b/scripts/escape-env.ts @@ -0,0 +1,19 @@ +// Workaround for vercel env pull cannot properly handle value that contains " #11258 +// https://github.com/vercel/vercel/issues/11258 +import * as readline from 'node:readline' + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + terminal: false, +}) + +rl.on('line', (line) => { + // Replace double quotes with single quotes, but only when they're part of the value + const processed = line.replace(/^(.*)="(.*)"$/g, "$1='$2'") + console.log(processed) +}) + +rl.on('close', () => { + process.exit(0) +})