diff --git a/.changeset/fluffy-mice-wash.md b/.changeset/fluffy-mice-wash.md new file mode 100644 index 0000000000..0e2dfe6e26 --- /dev/null +++ b/.changeset/fluffy-mice-wash.md @@ -0,0 +1,11 @@ +--- +"toolkit-app": patch +"toolkit-app": patch +"web": patch +"@blitzjs/rpc": patch +"blitz": patch +"test-auth": patch +"test-react-query-utils": patch +--- + +Fix issue with the route name that's generated for nested routes in @blitzjs/rpc. This was causing issues for windows users. diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b566e8e7d1..391ebc23ae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,8 @@ concurrency: cancel-in-progress: true jobs: - build: + lint: + name: 'Lint: ${{ matrix.os }}' runs-on: ${{ matrix.os }} strategy: matrix: @@ -19,20 +20,99 @@ jobs: - ubuntu-latest node_version: - 16 - name: Node ${{ matrix.node_version }} - ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2 + - uses: actions/checkout@v2 + - uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2 + with: + version: 6.32.6 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + cache: "pnpm" + - name: Install dependencies + run: pnpm install --frozen-lockfile + - run: pnpm manypkg check + - name: Turborepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: ${{ secrets.TURBO_SERVER_TOKEN }} + - name: Build + run: pnpm build -- --api="http://127.0.0.1:9080" --token="${{ secrets.TURBO_SERVER_TOKEN }}" --team="foo" + - name: Lint + run: pnpm lint -- --api="http://127.0.0.1:9080" --token="${{ secrets.TURBO_SERVER_TOKEN }}" --team="foo" + + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + node_version: + - 16 + name: Build - ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2 + with: + version: 6.32.6 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + cache: "pnpm" + - run: pnpm install --frozen-lockfile + - run: pnpm manypkg check + - name: Turborepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: ${{ secrets.TURBO_SERVER_TOKEN }} + - name: Build + run: pnpm build -- --api="http://127.0.0.1:9080" --token="${{ secrets.TURBO_SERVER_TOKEN }}" --team="foo" + - name: Build Apps + run: pnpm build:apps -- --api="http://127.0.0.1:9080" --token="${{ secrets.TURBO_SERVER_TOKEN }}" --team="foo" + + test: + name: 'Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})' + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + node_version: + - 16 + fail-fast: false + env: + NODE_VERSION: ${{ matrix.NODE_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2 with: version: 6.32.6 - - name: Setup node + - name: Setup node@${{ matrix.NODE_VERSION }} uses: actions/setup-node@v2 with: - node-version: ${{ matrix.node_version }} - cache: "pnpm" - - run: pnpm install --frozen-lockfile + node-version: ${{ matrix.NODE_VERSION }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile - run: pnpm manypkg check - - run: pnpm build - - run: pnpm lint - - run: pnpm build:apps - - run: pnpm test + - name: Turborepo local server + uses: felixmosh/turborepo-gh-artifacts@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + server-token: ${{ secrets.TURBO_SERVER_TOKEN }} + + - name: Build + run: pnpm build -- --api="http://127.0.0.1:9080" --token="${{ secrets.TURBO_SERVER_TOKEN }}" --team="foo" + + - name: Test + run: pnpm test -- --api="http://127.0.0.1:9080" --token="${{ secrets.TURBO_SERVER_TOKEN }}" --team="foo" + diff --git a/apps/toolkit-app-passportjs/package.json b/apps/toolkit-app-passportjs/package.json index fa0fd30d96..846175b668 100644 --- a/apps/toolkit-app-passportjs/package.json +++ b/apps/toolkit-app-passportjs/package.json @@ -3,7 +3,7 @@ "version": "1.0.1-alpha.16", "scripts": { "start:dev": "pnpm run prisma:start && blitz dev", - "buildapp": "NODE_ENV=production pnpm blitz codegen && pnpm prisma generate && next build", + "buildapp": "pnpm blitz codegen && pnpm prisma generate && next build", "start": "next start", "lint": "next lint", "prisma:start": "prisma generate && prisma migrate deploy", diff --git a/apps/toolkit-app/package.json b/apps/toolkit-app/package.json index 8057b3d26f..9372d673eb 100644 --- a/apps/toolkit-app/package.json +++ b/apps/toolkit-app/package.json @@ -3,7 +3,7 @@ "version": "1.0.1-alpha.16", "scripts": { "start:dev": "pnpm run prisma:start && blitz dev", - "buildapp": "NODE_ENV=production pnpm blitz codegen && pnpm prisma generate && next build", + "buildapp": "pnpm blitz codegen && pnpm prisma generate && next build", "start": "next start", "lint": "next lint", "prisma:start": "prisma generate && prisma migrate deploy", diff --git a/apps/web/package.json b/apps/web/package.json index c033330471..5e78e627f4 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "start:dev": "pnpm run prisma:start && next dev", - "buildapp": "NODE_ENV=production pnpm blitz codegen && pnpm prisma generate && next build", + "buildapp": "pnpm blitz codegen && pnpm prisma generate && next build", "start": "next start", "lint": "next lint", "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next", diff --git a/integration-tests/auth/package.json b/integration-tests/auth/package.json index 6651595a4d..b8d9e8a75d 100644 --- a/integration-tests/auth/package.json +++ b/integration-tests/auth/package.json @@ -2,6 +2,9 @@ "name": "test-auth", "version": "0.0.0", "private": true, + "prisma": { + "seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts" + }, "scripts": { "start:dev": "pnpm run prisma:start && next dev", "test": "pnpm run prisma:start && vitest run", @@ -9,7 +12,8 @@ "start": "next start", "lint": "next lint", "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next", - "prisma:start": "prisma generate && prisma migrate deploy", + "prisma:start": "prisma generate && prisma migrate dev && pnpm run prisma:seed", + "prisma:seed": "prisma db push --force-reset && prisma db seed", "prisma:studio": "prisma studio" }, "dependencies": { @@ -28,6 +32,7 @@ "@next/bundle-analyzer": "12.0.8", "@types/express": "4.17.13", "@types/fs-extra": "9.0.13", + "@types/node": "18.7.13", "@types/node-fetch": "2.6.1", "@types/react": "18.0.17", "b64-lite": "1.4.0", @@ -35,6 +40,7 @@ "fs-extra": "10.0.1", "get-port": "6.1.2", "node-fetch": "3.2.3", + "ts-node": "10.9.1", "typescript": "^4.5.3" } } diff --git a/integration-tests/auth/prisma/seed.ts b/integration-tests/auth/prisma/seed.ts index 6062c56c4c..be8a58e389 100644 --- a/integration-tests/auth/prisma/seed.ts +++ b/integration-tests/auth/prisma/seed.ts @@ -2,7 +2,6 @@ import prisma from "./index" import {SecurePassword} from "@blitzjs/auth" const seed = async () => { - await prisma.$reset() const hashedPassword = await SecurePassword.hash("abcd1234") @@ -12,7 +11,11 @@ const seed = async () => { hashedPassword, role: "user", }, - }) + }).catch(console.error) + + process.exit(0); } +seed() + export default seed diff --git a/integration-tests/auth/test/index.test.ts b/integration-tests/auth/test/index.test.ts index 3055d80b73..74524bb67b 100644 --- a/integration-tests/auth/test/index.test.ts +++ b/integration-tests/auth/test/index.test.ts @@ -128,7 +128,6 @@ describe("Auth Tests", () => { try { appPort = await findPort() app = await launchApp(appDir, appPort, {cwd: process.cwd()}) - await seed() } catch (error) { console.log(error) } diff --git a/integration-tests/react-query-utils/vitest.config.ts b/integration-tests/react-query-utils/vitest.config.ts new file mode 100644 index 0000000000..47ae0bee3a --- /dev/null +++ b/integration-tests/react-query-utils/vitest.config.ts @@ -0,0 +1,9 @@ +/// +import {defineConfig} from "vitest/config" + +export default defineConfig({ + test: { + hookTimeout: 100000, + }, +}) + diff --git a/packages/blitz-rpc/src/loader-utils.ts b/packages/blitz-rpc/src/loader-utils.ts index b4c6509ab3..ed0a1d7ab7 100644 --- a/packages/blitz-rpc/src/loader-utils.ts +++ b/packages/blitz-rpc/src/loader-utils.ts @@ -64,6 +64,7 @@ export function convertPageFilePathToRoutePath( return filePath .replace(/^.*?[\\/]queries[\\/]/, "/") .replace(/^.*?[\\/]mutations[\\/]/, "/") + .replace(/\\/g, "/") .replace(fileExtensionRegex, "") } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff91cd06c6..88cec1f762 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -231,6 +231,7 @@ importers: "@prisma/client": 4.0.0 "@types/express": 4.17.13 "@types/fs-extra": 9.0.13 + "@types/node": 18.7.13 "@types/node-fetch": 2.6.1 "@types/react": 18.0.17 b64-lite: 1.4.0 @@ -244,6 +245,7 @@ importers: prisma: 4.0.0 react: 18.2.0 react-dom: 18.2.0 + ts-node: 10.9.1 typescript: ^4.5.3 dependencies: "@blitzjs/auth": link:../../packages/blitz-auth @@ -260,6 +262,7 @@ importers: "@next/bundle-analyzer": 12.0.8 "@types/express": 4.17.13 "@types/fs-extra": 9.0.13 + "@types/node": 18.7.13 "@types/node-fetch": 2.6.1 "@types/react": 18.0.17 b64-lite: 1.4.0 @@ -267,6 +270,7 @@ importers: fs-extra: 10.0.1 get-port: 6.1.2 node-fetch: 3.2.3 + ts-node: 10.9.1_kakyiqi62sfonxvjmz3ft5vt7y typescript: 4.6.3 integration-tests/get-initial-props: @@ -3231,6 +3235,7 @@ packages: semver: 5.7.1 transitivePeerDependencies: - supports-color + dev: false /@babel/preset-flow/7.17.12_@babel+core@7.18.2: resolution: @@ -3724,6 +3729,16 @@ packages: dependencies: "@cspotcode/source-map-consumer": 0.8.0 + /@cspotcode/source-map-support/0.8.1: + resolution: + { + integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==, + } + engines: {node: ">=12"} + dependencies: + "@jridgewell/trace-mapping": 0.3.9 + dev: true + /@eslint/eslintrc/0.4.3: resolution: { @@ -4106,6 +4121,16 @@ packages: "@jridgewell/resolve-uri": 3.0.7 "@jridgewell/sourcemap-codec": 1.4.13 + /@jridgewell/trace-mapping/0.3.9: + resolution: + { + integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==, + } + dependencies: + "@jridgewell/resolve-uri": 3.0.7 + "@jridgewell/sourcemap-codec": 1.4.13 + dev: true + /@juanm04/cpx/2.0.1_supports-color@8.1.1: resolution: { @@ -5273,6 +5298,13 @@ packages: integrity: sha512-aveCYRQbgTH9Pssp1voEP7HiuWlD2jW2BO56w+bVrJn04i61yh6mRfoKO6hEYQD9vF+W8Chkwc6j1M36uPkx4g==, } + /@types/node/18.7.13: + resolution: + { + integrity: sha512-46yIhxSe5xEaJZXWdIBP7GU4HDTG8/eo0qd9atdiL+lFpA03y8KS+lkTN834TWJj5767GbWv4n/P6efyTFt1Dw==, + } + dev: true + /@types/nodemailer/6.4.4: resolution: { @@ -5690,6 +5722,7 @@ packages: typescript: 4.6.3 transitivePeerDependencies: - supports-color + dev: false /@typescript-eslint/experimental-utils/5.28.0_hrkuebk64jiu2ut2d2sm4oylnu: resolution: @@ -9658,6 +9691,7 @@ packages: transitivePeerDependencies: - eslint-import-resolver-webpack - supports-color + dev: false /eslint-config-next/12.2.5_hrkuebk64jiu2ut2d2sm4oylnu: resolution: @@ -9695,6 +9729,7 @@ packages: hasBin: true peerDependencies: eslint: ">=7.0.0" + dev: false /eslint-config-prettier/8.5.0_eslint@7.32.0: resolution: @@ -17736,7 +17771,39 @@ packages: typescript: 4.6.3 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - + /ts-node/10.9.1_kakyiqi62sfonxvjmz3ft5vt7y: + resolution: + { + integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==, + } + hasBin: true + peerDependencies: + "@swc/core": ">=1.2.50" + "@swc/wasm": ">=1.2.50" + "@types/node": "*" + typescript: ">=2.7" + peerDependenciesMeta: + "@swc/core": + optional: true + "@swc/wasm": + optional: true + dependencies: + "@cspotcode/source-map-support": 0.8.1 + "@tsconfig/node10": 1.0.9 + "@tsconfig/node12": 1.0.10 + "@tsconfig/node14": 1.0.2 + "@tsconfig/node16": 1.0.3 + "@types/node": 18.7.13 + acorn: 8.7.1 + acorn-walk: 8.2.0 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 4.6.3 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: true /tsconfig-paths/3.14.1: resolution: {