Compare commits
11 Commits
@blitzjs/c
...
revert-378
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35214bf529 | ||
|
|
161270e3b1 | ||
|
|
f6dac093d2 | ||
|
|
69fb280340 | ||
|
|
7498aef4fc | ||
|
|
49aaaaefb0 | ||
|
|
638f2319b7 | ||
|
|
3d950f7772 | ||
|
|
2313fa61b0 | ||
|
|
b72d1215c3 | ||
|
|
1bf185d618 |
5
.changeset/cyan-bulldogs-heal.md
Normal file
5
.changeset/cyan-bulldogs-heal.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/next": patch
|
||||
---
|
||||
|
||||
Allow setting static page properties (e.g. `getInitialProps`) on the App component
|
||||
5
.changeset/fast-clocks-push.md
Normal file
5
.changeset/fast-clocks-push.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Fix tsconfig.json referencing blitz-env.d.ts insetad of next-env.d.ts in new app templates
|
||||
5
.changeset/fluffy-mangos-begin.md
Normal file
5
.changeset/fluffy-mangos-begin.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Prevent `Minified react error #419` in production
|
||||
5
.changeset/gold-horses-punch.md
Normal file
5
.changeset/gold-horses-punch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Add vscode debugging configuration to new app templates
|
||||
5
.changeset/lucky-months-guess.md
Normal file
5
.changeset/lucky-months-guess.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/rpc": patch
|
||||
---
|
||||
|
||||
Improve RPC logging: print `resolverName()` insetad of `/resolverName()`
|
||||
5
.changeset/orange-zebras-reflect.md
Normal file
5
.changeset/orange-zebras-reflect.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Fix upgrade-legacy codemod replacing identifiers with an invalid value. Previously new values were hardcoded to `NextApiRequest`. Now we're using correct values provided as `replaceIdentifiers` function argument.
|
||||
@@ -53,6 +53,7 @@
|
||||
"fast-trainers-kneel",
|
||||
"few-dogs-fetch",
|
||||
"flat-bees-approve",
|
||||
"fluffy-mangos-begin",
|
||||
"forty-timers-rhyme",
|
||||
"four-brooms-juggle",
|
||||
"four-meals-fry",
|
||||
@@ -60,6 +61,7 @@
|
||||
"fuzzy-bees-warn",
|
||||
"fuzzy-jars-admire",
|
||||
"gentle-dogs-reply",
|
||||
"gold-horses-punch",
|
||||
"good-apes-drum",
|
||||
"good-insects-wink",
|
||||
"gorgeous-birds-warn",
|
||||
@@ -105,6 +107,7 @@
|
||||
"olive-bees-buy",
|
||||
"olive-feet-rhyme",
|
||||
"olive-sheep-rhyme",
|
||||
"orange-zebras-reflect",
|
||||
"perfect-eyes-repeat",
|
||||
"perfect-trains-double",
|
||||
"plenty-bottles-swim",
|
||||
@@ -145,6 +148,7 @@
|
||||
"sour-mails-lick",
|
||||
"spicy-beds-float",
|
||||
"spotty-dingos-stare",
|
||||
"spotty-peas-hope",
|
||||
"stale-jobs-drum",
|
||||
"strong-apes-reply",
|
||||
"stupid-walls-sell",
|
||||
|
||||
5
.changeset/spotty-peas-hope.md
Normal file
5
.changeset/spotty-peas-hope.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/codemod": patch
|
||||
---
|
||||
|
||||
Add a new codemod step to update the .eslintrc.js file
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -48,13 +48,13 @@ tsconfig.tsbuildinfo
|
||||
.next
|
||||
dist
|
||||
.now
|
||||
|
||||
# local env files
|
||||
**/.env.local
|
||||
**/.env.*.local
|
||||
**/.envrc
|
||||
.blitz-*
|
||||
.blitz-cli-cache
|
||||
.vscode
|
||||
.tsbuildinfo
|
||||
.nvmrc
|
||||
**/.test*
|
||||
@@ -65,7 +65,6 @@ db.sqlite-journal
|
||||
**/db/db.sqlite
|
||||
test/integration/**/db.json
|
||||
test/**/*/out
|
||||
test/**/blitz-env.d.ts
|
||||
examples/**/blitz-env.d.ts
|
||||
test/**/next-env.d.ts
|
||||
examples/**/next-env.d.ts
|
||||
.blitz**
|
||||
|
||||
|
||||
28
apps/toolkit-app/.vscode/launch.json
vendored
Normal file
28
apps/toolkit-app/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Blitz: debug server-side",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "pnpm start:dev"
|
||||
},
|
||||
{
|
||||
"name": "Blitz: debug client-side",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "http://localhost:3000"
|
||||
},
|
||||
{
|
||||
"name": "Blitz: debug full stack",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "pnpm start:dev",
|
||||
"serverReadyAction": {
|
||||
"pattern": "started server on .+, url: (https?://.+)",
|
||||
"uriFormat": "%s",
|
||||
"action": "debugWithChrome"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -29,7 +29,7 @@
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@hookform/resolvers": "2.8.8",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:2.0.0-beta.2",
|
||||
"blitz": "workspace:2.0.0-beta.3",
|
||||
"next": "12.2.5",
|
||||
"prisma": "4.0.0",
|
||||
"react": "18.2.0",
|
||||
|
||||
@@ -20,5 +20,5 @@
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.e2e.ts", "cypress"],
|
||||
"include": ["blitz-env.d.ts", "**/*.ts", "**/*.tsx", "types"]
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "types"]
|
||||
}
|
||||
|
||||
2
integration-tests/get-initial-props/.env
Normal file
2
integration-tests/get-initial-props/.env
Normal file
@@ -0,0 +1,2 @@
|
||||
SESSION_SECRET_KEY=hsdenhJfpLHrGjgdgg3jdF8g2bYD2PaQ
|
||||
HEADLESS=true
|
||||
1
integration-tests/get-initial-props/.eslintrc.js
Normal file
1
integration-tests/get-initial-props/.eslintrc.js
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("@blitzjs/config/eslint")
|
||||
3
integration-tests/get-initial-props/.gitignore
vendored
Normal file
3
integration-tests/get-initial-props/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
# Keep environment variables out of version control
|
||||
*.sqlite
|
||||
14
integration-tests/get-initial-props/app/blitz-client.ts
Normal file
14
integration-tests/get-initial-props/app/blitz-client.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import {BlitzRpcPlugin} from "@blitzjs/rpc"
|
||||
import {setupBlitzClient} from "@blitzjs/next"
|
||||
import {AuthClientPlugin} from "@blitzjs/auth"
|
||||
|
||||
const {withBlitz} = setupBlitzClient({
|
||||
plugins: [
|
||||
AuthClientPlugin({
|
||||
cookiePrefix: "trailing-slash-tests-cookie-prefix",
|
||||
}),
|
||||
BlitzRpcPlugin({}),
|
||||
],
|
||||
})
|
||||
|
||||
export {withBlitz}
|
||||
16
integration-tests/get-initial-props/app/blitz-server.ts
Normal file
16
integration-tests/get-initial-props/app/blitz-server.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
|
||||
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import db from "../db"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [
|
||||
AuthServerPlugin({
|
||||
cookiePrefix: "trailing-slash-tests-cookie-prefix",
|
||||
storage: PrismaStorage(db),
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
@@ -0,0 +1,3 @@
|
||||
export default async function getBasic() {
|
||||
return "basic-result"
|
||||
}
|
||||
8
integration-tests/get-initial-props/db/index.ts
Normal file
8
integration-tests/get-initial-props/db/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import {enhancePrisma} from "blitz"
|
||||
import {PrismaClient} from "@prisma/client"
|
||||
|
||||
const EnhancedPrisma = enhancePrisma(PrismaClient)
|
||||
|
||||
export * from "@prisma/client"
|
||||
const prisma = new EnhancedPrisma()
|
||||
export default prisma
|
||||
@@ -0,0 +1,47 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "User" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"name" TEXT,
|
||||
"email" TEXT NOT NULL,
|
||||
"hashedPassword" TEXT,
|
||||
"role" TEXT NOT NULL DEFAULT 'user'
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Session" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"expiresAt" DATETIME,
|
||||
"handle" TEXT NOT NULL,
|
||||
"userId" INTEGER,
|
||||
"hashedSessionToken" TEXT,
|
||||
"antiCSRFToken" TEXT,
|
||||
"publicData" TEXT,
|
||||
"privateData" TEXT,
|
||||
CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Token" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"hashedToken" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"expiresAt" DATETIME NOT NULL,
|
||||
"sentTo" TEXT NOT NULL,
|
||||
"userId" INTEGER NOT NULL,
|
||||
CONSTRAINT "Token_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Session_handle_key" ON "Session"("handle");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Token_hashedToken_type_key" ON "Token"("hashedToken", "type");
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "sqlite"
|
||||
50
integration-tests/get-initial-props/db/schema.prisma
Normal file
50
integration-tests/get-initial-props/db/schema.prisma
Normal file
@@ -0,0 +1,50 @@
|
||||
datasource sqlite {
|
||||
provider = "sqlite"
|
||||
url = "file:./db.sqlite"
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
name String?
|
||||
email String @unique
|
||||
hashedPassword String?
|
||||
role String @default("user")
|
||||
|
||||
sessions Session[]
|
||||
tokens Token[]
|
||||
}
|
||||
|
||||
model Session {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
expiresAt DateTime?
|
||||
handle String @unique
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
userId Int?
|
||||
hashedSessionToken String?
|
||||
antiCSRFToken String?
|
||||
publicData String?
|
||||
privateData String?
|
||||
}
|
||||
|
||||
model Token {
|
||||
id Int @id @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
hashedToken String
|
||||
type String
|
||||
expiresAt DateTime
|
||||
sentTo String
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
|
||||
@@unique([hashedToken, type])
|
||||
}
|
||||
7
integration-tests/get-initial-props/db/seed.ts
Normal file
7
integration-tests/get-initial-props/db/seed.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import prisma from "./index"
|
||||
|
||||
const seed = async () => {
|
||||
await prisma.$reset()
|
||||
}
|
||||
|
||||
export default seed
|
||||
5
integration-tests/get-initial-props/next-env.d.ts
vendored
Normal file
5
integration-tests/get-initial-props/next-env.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
4
integration-tests/get-initial-props/next.config.js
Normal file
4
integration-tests/get-initial-props/next.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
const {withBlitz} = require("@blitzjs/next")
|
||||
module.exports = withBlitz({
|
||||
trailingSlash: true,
|
||||
})
|
||||
44
integration-tests/get-initial-props/package.json
Normal file
44
integration-tests/get-initial-props/package.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "test-trailing-slash",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start:dev": "pnpm run prisma:start && next dev",
|
||||
"test": "pnpm run prisma:start && vitest run",
|
||||
"test-watch": "vitest",
|
||||
"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:studio": "prisma studio"
|
||||
},
|
||||
"prisma": {
|
||||
"schema": "db/schema.prisma"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:*",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "12.2.5",
|
||||
"prisma": "4.0.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@types/express": "4.17.13",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
"@types/node-fetch": "2.6.1",
|
||||
"@types/react": "18.0.17",
|
||||
"b64-lite": "1.4.0",
|
||||
"eslint": "7.32.0",
|
||||
"fs-extra": "10.0.1",
|
||||
"get-port": "6.1.2",
|
||||
"node-fetch": "3.2.3",
|
||||
"typescript": "^4.5.3"
|
||||
}
|
||||
}
|
||||
46
integration-tests/get-initial-props/pages/_app.tsx
Normal file
46
integration-tests/get-initial-props/pages/_app.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import {ErrorFallbackProps, ErrorComponent, ErrorBoundary, AppProps} from "@blitzjs/next"
|
||||
import {AuthenticationError, AuthorizationError} from "blitz"
|
||||
import App, {AppContext} from "next/app"
|
||||
import React, {Suspense} from "react"
|
||||
import {withBlitz} from "../app/blitz-client"
|
||||
|
||||
function RootErrorFallback({error}: ErrorFallbackProps) {
|
||||
if (error instanceof AuthenticationError) {
|
||||
return <div>Error: You are not authenticated</div>
|
||||
} else if (error instanceof AuthorizationError) {
|
||||
return (
|
||||
<ErrorComponent
|
||||
statusCode={error.statusCode}
|
||||
title="Sorry, you are not authorized to access this"
|
||||
/>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<ErrorComponent
|
||||
statusCode={(error as any)?.statusCode || 400}
|
||||
title={error.message || error.name}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function MyApp({Component, pageProps, testProp}: AppProps & {testProp: any}) {
|
||||
return (
|
||||
<Suspense fallback="Loading...">
|
||||
<ErrorBoundary FallbackComponent={RootErrorFallback}>
|
||||
<Component {...pageProps} testProp={testProp} />
|
||||
</ErrorBoundary>
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
|
||||
MyApp.getInitialProps = async (context: AppContext) => {
|
||||
const props = await App.getInitialProps(context)
|
||||
|
||||
return {
|
||||
...props,
|
||||
testProp: "_app.tsx: testing getInitialProps",
|
||||
}
|
||||
}
|
||||
|
||||
export default withBlitz(MyApp)
|
||||
@@ -0,0 +1,4 @@
|
||||
import {rpcHandler} from "@blitzjs/rpc"
|
||||
import {api} from "../../../app/blitz-server"
|
||||
|
||||
export default api(rpcHandler({onError: console.log}))
|
||||
22
integration-tests/get-initial-props/pages/index.tsx
Normal file
22
integration-tests/get-initial-props/pages/index.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import {NextPage} from "next"
|
||||
import {Suspense} from "react"
|
||||
|
||||
const Page: NextPage = (props) => {
|
||||
return (
|
||||
<div id="page">
|
||||
<Suspense fallback={"Loading..."}>
|
||||
<div id="content">{JSON.stringify(props, null, 2)}</div>
|
||||
</Suspense>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Page.getInitialProps = async (context) => {
|
||||
return {
|
||||
props: {
|
||||
anotherTestProp: "index.tsx: testing getInitialProps",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default Page
|
||||
67
integration-tests/get-initial-props/test/index.test.ts
Normal file
67
integration-tests/get-initial-props/test/index.test.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import {describe, it, expect, beforeAll, afterAll} from "vitest"
|
||||
import {killApp, findPort, launchApp, nextBuild, nextStart} from "../../utils/next-test-utils"
|
||||
import webdriver from "../../utils/next-webdriver"
|
||||
|
||||
import {join} from "path"
|
||||
|
||||
let app: any
|
||||
let appPort: number
|
||||
const appDir = join(__dirname, "../")
|
||||
|
||||
const runTests = (mode?: string) => {
|
||||
describe("getInitialProps", () => {
|
||||
it(
|
||||
"should render a custom prop provided in getInitialProps in _app.tsx",
|
||||
async () => {
|
||||
const browser = await webdriver(appPort, "/")
|
||||
await browser.waitForElementByCss("#content", 0)
|
||||
const text = await browser.elementByCss("#content").text()
|
||||
expect(text).toMatch(/_app.tsx: testing getInitialProps/)
|
||||
if (browser) await browser.close()
|
||||
},
|
||||
5000 * 60 * 2,
|
||||
)
|
||||
it(
|
||||
"should render custom props provided in getInitialProps in both _app.tsx and index.tsx",
|
||||
async () => {
|
||||
const browser = await webdriver(appPort, "/")
|
||||
await browser.waitForElementByCss("#content", 0)
|
||||
const text = await browser.elementByCss("#content").text()
|
||||
expect(text).toMatch(/_app.tsx: testing getInitialProps/)
|
||||
expect(text).toMatch(/index.tsx: testing getInitialProps/)
|
||||
if (browser) await browser.close()
|
||||
},
|
||||
5000 * 60 * 2,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
describe("getInitialProps Tests", () => {
|
||||
describe("dev mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
appPort = await findPort()
|
||||
app = await launchApp(appDir, appPort, {cwd: process.cwd()})
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}, 5000 * 60 * 2)
|
||||
afterAll(async () => await killApp(app))
|
||||
runTests()
|
||||
})
|
||||
|
||||
describe("server mode", () => {
|
||||
beforeAll(async () => {
|
||||
try {
|
||||
await nextBuild(appDir)
|
||||
appPort = await findPort()
|
||||
app = await nextStart(appDir, appPort, {cwd: process.cwd()})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}, 5000 * 60 * 2)
|
||||
afterAll(async () => await killApp(app))
|
||||
|
||||
runTests()
|
||||
})
|
||||
})
|
||||
11
integration-tests/get-initial-props/tsconfig.json
Normal file
11
integration-tests/get-initial-props/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "@blitzjs/config/tsconfig.nextjs.json",
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "types"],
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"react": ["./node_modules/@types/react"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"baseUrl": "."
|
||||
}
|
||||
15
integration-tests/get-initial-props/types.ts
Normal file
15
integration-tests/get-initial-props/types.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {SimpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import {User} from "./db"
|
||||
|
||||
export type Role = "ADMIN" | "USER"
|
||||
|
||||
declare module "@blitzjs/auth" {
|
||||
export interface Session {
|
||||
isAuthorized: SimpleRolesIsAuthorized<Role>
|
||||
PublicData: {
|
||||
userId: User["id"]
|
||||
role: Role
|
||||
views?: number
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
# @blitzjs/auth
|
||||
|
||||
## 2.0.0-beta.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [638f2319]
|
||||
- blitz@2.0.0-beta.3
|
||||
|
||||
## 2.0.0-beta.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/auth",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"predev": "wait-on -d 250 ../blitz/dist/index-server.d.ts",
|
||||
@@ -26,7 +26,7 @@
|
||||
"@types/secure-password": "3.1.1",
|
||||
"b64-lite": "1.4.0",
|
||||
"bad-behavior": "1.0.1",
|
||||
"blitz": "2.0.0-beta.2",
|
||||
"blitz": "2.0.0-beta.3",
|
||||
"cookie": "0.4.1",
|
||||
"cookie-session": "2.0.0",
|
||||
"debug": "4.3.3",
|
||||
@@ -40,7 +40,7 @@
|
||||
"url": "0.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.2",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.3",
|
||||
"@testing-library/react": "13.0.0",
|
||||
"@testing-library/react-hooks": "7.0.2",
|
||||
"@types/cookie": "0.4.1",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @blitzjs/next
|
||||
|
||||
## 2.0.0-beta.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @blitzjs/rpc@2.0.0-beta.3
|
||||
|
||||
## 2.0.0-beta.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/next",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "pnpm predev && pnpm watch unbuild src --wait=0.2",
|
||||
@@ -24,7 +24,7 @@
|
||||
"eslint.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blitzjs/rpc": "2.0.0-beta.2",
|
||||
"@blitzjs/rpc": "2.0.0-beta.3",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"@types/hoist-non-react-statics": "3.3.1",
|
||||
"debug": "4.3.3",
|
||||
@@ -34,7 +34,7 @@
|
||||
"supports-color": "8.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.2",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.3",
|
||||
"@testing-library/dom": "8.13.0",
|
||||
"@testing-library/jest-dom": "5.16.3",
|
||||
"@testing-library/react": "13.0.0",
|
||||
@@ -44,7 +44,7 @@
|
||||
"@types/react": "18.0.17",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"@types/testing-library__react-hooks": "4.0.0",
|
||||
"blitz": "2.0.0-beta.2",
|
||||
"blitz": "2.0.0-beta.3",
|
||||
"cross-spawn": "7.0.3",
|
||||
"find-up": "4.1.0",
|
||||
"next": "12.2.5",
|
||||
|
||||
@@ -30,9 +30,10 @@ const buildWithBlitz = <TPlugins extends readonly ClientPlugin<object>[]>(plugin
|
||||
const providers = plugins.reduce((acc, plugin) => {
|
||||
return plugin.withProvider ? acc.concat(plugin.withProvider) : acc
|
||||
}, [] as BlitzProviderType[])
|
||||
|
||||
const withPlugins = compose(...providers)
|
||||
|
||||
return function withBlitzAppRoot(UserAppRoot: React.ComponentType<any>) {
|
||||
return function withBlitzAppRoot(UserAppRoot: React.ComponentType<AppProps>) {
|
||||
const BlitzOuterRoot = (props: AppProps) => {
|
||||
const component = React.useMemo(() => withPlugins(props.Component), [props.Component])
|
||||
|
||||
@@ -46,13 +47,14 @@ const buildWithBlitz = <TPlugins extends readonly ClientPlugin<object>[]>(plugin
|
||||
return (
|
||||
<BlitzProvider dehydratedState={props.pageProps?.dehydratedState}>
|
||||
<>
|
||||
{/* @ts-ignore todo */}
|
||||
{props.Component.suppressFirstRenderFlicker && <NoPageFlicker />}
|
||||
<UserAppRoot {...props} Component={component} />
|
||||
</>
|
||||
</BlitzProvider>
|
||||
)
|
||||
}
|
||||
|
||||
Object.assign(BlitzOuterRoot, UserAppRoot)
|
||||
return withSuperJSONPage(BlitzOuterRoot)
|
||||
}
|
||||
}
|
||||
@@ -146,10 +148,9 @@ const setupBlitzClient = <TPlugins extends readonly ClientPlugin<object>[]>({
|
||||
|
||||
// todo: finish this
|
||||
// Used to build BlitzPage type
|
||||
const types = {} as {plugins: typeof plugins}
|
||||
// const types = {} as {plugins: typeof plugins}
|
||||
|
||||
return {
|
||||
types,
|
||||
withBlitz,
|
||||
...(exports as PluginsExports<TPlugins>),
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @blitzjs/rpc
|
||||
|
||||
## 2.0.0-beta.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @blitzjs/auth@2.0.0-beta.3
|
||||
|
||||
## 2.0.0-beta.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/rpc",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"predev": "wait-on -d 250 ../blitz/dist/index-server.d.ts && wait-on -d 250 ../blitz-auth/dist/index-browser.d.ts",
|
||||
@@ -20,7 +20,7 @@
|
||||
"dist/**"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.2",
|
||||
"@blitzjs/auth": "2.0.0-beta.3",
|
||||
"@tanstack/react-query": "4.0.10",
|
||||
"b64-lite": "1.4.0",
|
||||
"bad-behavior": "1.0.1",
|
||||
@@ -30,11 +30,11 @@
|
||||
"supports-color": "8.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.2",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.3",
|
||||
"@types/debug": "4.1.7",
|
||||
"@types/react": "18.0.17",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"blitz": "2.0.0-beta.2",
|
||||
"blitz": "2.0.0-beta.3",
|
||||
"next": "12.2.5",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
|
||||
@@ -158,7 +158,7 @@ export function rpcHandler(config: RpcConfig) {
|
||||
const routePath = "/" + relativeRoutePath
|
||||
|
||||
const log = baseLogger().getChildLogger({
|
||||
prefix: [routePath.replace("/api/rpc/", "") + "()"],
|
||||
prefix: [routePath.replace(/(\/api\/rpc)?\//, "") + "()"],
|
||||
})
|
||||
const customChalk = new chalk.Instance({
|
||||
level: log.settings.type === "json" ? 0 : chalk.level,
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# blitz
|
||||
|
||||
## 2.0.0-beta.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 638f2319: Prevent `Minified react error #419` in production
|
||||
- Updated dependencies [b72d1215]
|
||||
- @blitzjs/generator@2.0.0-beta.3
|
||||
|
||||
## 2.0.0-beta.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blitz",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "watch unbuild src --wait=0.2",
|
||||
@@ -23,7 +23,7 @@
|
||||
"blitz": "bin/blitz"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/generator": "2.0.0-beta.2",
|
||||
"@blitzjs/generator": "2.0.0-beta.3",
|
||||
"arg": "5.0.1",
|
||||
"boxen": "7.0.0",
|
||||
"chalk": "^4.1.0",
|
||||
@@ -55,7 +55,7 @@
|
||||
"watchpack": "2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.2",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.3",
|
||||
"@types/cookie": "0.4.1",
|
||||
"@types/cross-spawn": "6.0.2",
|
||||
"@types/debug": "4.1.7",
|
||||
|
||||
@@ -19,7 +19,7 @@ export const codegenTasks = async () => {
|
||||
.toString()
|
||||
.replace(
|
||||
/ReactDOM\.hydrateRoot\(.*?\);/,
|
||||
`ReactDOM.hydrateRoot(domEl, reactEl, {onRecoverableError: (err) => err.toString().includes("could not finish this Suspense boundary") ? null : console.error(err)});`,
|
||||
`ReactDOM.hydrateRoot(domEl, reactEl, {onRecoverableError: (err) => (err.toString().includes("could not finish this Suspense boundary") || err.toString().includes("Minified React error #419")) ? null : console.error(err)});`,
|
||||
)
|
||||
await fs.writeFile(nextClientIndex, updatedFile)
|
||||
log.success("Next.js was successfully patched with a React Suspense fix")
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# @blitzjs/codemod
|
||||
|
||||
## 2.0.0-beta.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2313fa61: Fix upgrade-legacy codemod replacing identifiers with an invalid value. Previously new values were hardcoded to `NextApiRequest`. Now we're using correct values provided as `replaceIdentifiers` function argument.
|
||||
- 1bf185d6: Add a new codemod step to update the .eslintrc.js file
|
||||
- Updated dependencies [638f2319]
|
||||
- Updated dependencies [b72d1215]
|
||||
- blitz@2.0.0-beta.3
|
||||
- @blitzjs/generator@2.0.0-beta.3
|
||||
|
||||
## 2.0.0-beta.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/codemod",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "watch unbuild src --wait=0.2",
|
||||
@@ -25,9 +25,9 @@
|
||||
"@babel/plugin-proposal-class-properties": "7.17.12",
|
||||
"@babel/plugin-syntax-jsx": "7.17.12",
|
||||
"@babel/plugin-syntax-typescript": "7.17.12",
|
||||
"@blitzjs/generator": "2.0.0-beta.2",
|
||||
"@blitzjs/generator": "2.0.0-beta.3",
|
||||
"arg": "5.0.1",
|
||||
"blitz": "2.0.0-beta.2",
|
||||
"blitz": "2.0.0-beta.3",
|
||||
"chalk": "^4.1.0",
|
||||
"cross-spawn": "7.0.3",
|
||||
"debug": "4.3.3",
|
||||
|
||||
@@ -95,7 +95,7 @@ const upgradeLegacy = async () => {
|
||||
"=",
|
||||
j.identifier("const { withBlitz }"),
|
||||
j.callExpression(j.identifier("require"), [j.identifier(`"@blitzjs/next"`)]),
|
||||
)
|
||||
),
|
||||
)
|
||||
parsedProgram.value.program.body.unshift(importWithBlitz)
|
||||
config.remove()
|
||||
@@ -113,6 +113,31 @@ const upgradeLegacy = async () => {
|
||||
},
|
||||
})
|
||||
|
||||
steps.push({
|
||||
name: "update .eslintrc.js configuration",
|
||||
action: async (stepIndex) => {
|
||||
if (fs.existsSync(path.resolve(".eslintrc.js"))) {
|
||||
const program = getCollectionFromSource(".eslintrc.js")
|
||||
const parsedProgram = program.get()
|
||||
parsedProgram.value.program.body = []
|
||||
const moduleExport = j.expressionStatement(
|
||||
j.assignmentExpression(
|
||||
"=",
|
||||
j.memberExpression(j.identifier("module"), j.identifier("exports")),
|
||||
j.callExpression(j.identifier("require"), [j.identifier(`"@blitzjs/next/eslint"`)]),
|
||||
),
|
||||
)
|
||||
parsedProgram.value.program.body.push(moduleExport)
|
||||
fs.writeFileSync(path.resolve(".eslintrc.js"), program.toSource())
|
||||
} else {
|
||||
collectedErrors.push({
|
||||
message: ".eslintrc.js does not exist",
|
||||
step: stepIndex,
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
steps.push({
|
||||
name: "update dependencies in package.json",
|
||||
action: async () => {
|
||||
@@ -276,7 +301,7 @@ const upgradeLegacy = async () => {
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if (nextScript?.length) {
|
||||
nextScript.remove()
|
||||
program
|
||||
@@ -284,7 +309,7 @@ const upgradeLegacy = async () => {
|
||||
.value.program.body.unshift(
|
||||
j.importDeclaration(
|
||||
[j.importDefaultSpecifier(j.identifier("Script"))],
|
||||
j.stringLiteral("next/script"),
|
||||
j.stringLiteral("next/script"),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -1027,18 +1052,23 @@ const upgradeLegacy = async () => {
|
||||
// Remove the old import statements
|
||||
importStatements?.remove()
|
||||
|
||||
const documentHead = program
|
||||
.find(j.JSXElement, (node) => node.openingElement.name.name === "DocumentHead")
|
||||
.get()
|
||||
const document = program.find(
|
||||
j.JSXElement,
|
||||
(node) => node.openingElement.name.name === "DocumentHead",
|
||||
)
|
||||
|
||||
documentHead.value.openingElement.name.name = "Head"
|
||||
if (documentHead.value.closingElement) {
|
||||
documentHead.value.closingElement.name.name = "Head"
|
||||
if (document.length) {
|
||||
const documentHead = document.get()
|
||||
documentHead.value.openingElement.name.name = "Head"
|
||||
if (documentHead.value.closingElement) {
|
||||
documentHead.value.closingElement.name.name = "Head"
|
||||
}
|
||||
const blitzScript = program
|
||||
.find(j.Identifier, (node) => node.name === "BlitzScript")
|
||||
.get()
|
||||
blitzScript.value.name = "NextScript"
|
||||
}
|
||||
|
||||
const blitzScript = program.find(j.Identifier, (node) => node.name === "BlitzScript").get()
|
||||
blitzScript.value.name = "NextScript"
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(pagesDir, `_document.${isTypescript ? "tsx" : "jsx"}`),
|
||||
program.toSource(),
|
||||
@@ -1052,25 +1082,27 @@ const upgradeLegacy = async () => {
|
||||
action: async () => {
|
||||
const pagesDir = path.resolve("pages")
|
||||
getAllFiles(pagesDir, [], ["api"], [".ts", ".tsx", ".js", ".jsx"]).forEach((file) => {
|
||||
const program = getCollectionFromSource(file)
|
||||
|
||||
// 1. getServerSideProps
|
||||
const getServerSidePropsPath = findFunction(program, "getServerSideProps")
|
||||
if (getServerSidePropsPath) {
|
||||
getServerSidePropsPath.forEach((path) =>
|
||||
wrapDeclaration(path, "getServerSideProps", "gSSP"),
|
||||
)
|
||||
addNamedImport(program, "gSSP", "app/blitz-server")
|
||||
try {
|
||||
const program = getCollectionFromSource(file)
|
||||
// 1. getServerSideProps
|
||||
const getServerSidePropsPath = findFunction(program, "getServerSideProps")
|
||||
if (getServerSidePropsPath) {
|
||||
getServerSidePropsPath.forEach((path) =>
|
||||
wrapDeclaration(path, "getServerSideProps", "gSSP"),
|
||||
)
|
||||
addNamedImport(program, "gSSP", "app/blitz-server")
|
||||
}
|
||||
// 2. getStaticProps
|
||||
const getStaticPropsPath = findFunction(program, "getStaticProps")
|
||||
if (getStaticPropsPath) {
|
||||
getStaticPropsPath.forEach((path) => wrapDeclaration(path, "getStaticProps", "gSP"))
|
||||
addNamedImport(program, "gSP", "app/blitz-server")
|
||||
}
|
||||
fs.writeFileSync(path.join(path.resolve(file)), program.toSource())
|
||||
} catch (e:any) {
|
||||
log.error(`Error in wrapping getServerSideProps, getStaticProps in ${file}`)
|
||||
throw new Error(e)
|
||||
}
|
||||
|
||||
// 2. getStaticProps
|
||||
const getStaticPropsPath = findFunction(program, "getStaticProps")
|
||||
if (getStaticPropsPath) {
|
||||
getStaticPropsPath.forEach((path) => wrapDeclaration(path, "getStaticProps", "gSP"))
|
||||
addNamedImport(program, "gSP", "app/blitz-server")
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.join(path.resolve(file)), program.toSource())
|
||||
})
|
||||
|
||||
// 3. api
|
||||
@@ -1081,22 +1113,25 @@ const upgradeLegacy = async () => {
|
||||
["rpc"],
|
||||
[".ts", ".tsx", ".js", ".jsx"],
|
||||
).forEach((file) => {
|
||||
const program = getCollectionFromSource(file)
|
||||
try {
|
||||
const program = getCollectionFromSource(file)
|
||||
const defaultExportPath = findDefaultExportPath(program)
|
||||
if (defaultExportPath) {
|
||||
const {node} = defaultExportPath
|
||||
|
||||
const defaultExportPath = findDefaultExportPath(program)
|
||||
if (node.declaration.type === "Identifier") {
|
||||
node.declaration = j.callExpression(j.identifier("api"), [node.declaration as any])
|
||||
addNamedImport(program, "api", "app/blitz-server")
|
||||
} else if (node.declaration.type === "FunctionDeclaration") {
|
||||
node.declaration = j.template.expression`api(${node.declaration})`
|
||||
addNamedImport(program, "api", "app/blitz-server")
|
||||
}
|
||||
|
||||
if (defaultExportPath) {
|
||||
const {node} = defaultExportPath
|
||||
|
||||
if (node.declaration.type === "Identifier") {
|
||||
node.declaration = j.callExpression(j.identifier("api"), [node.declaration as any])
|
||||
addNamedImport(program, "api", "app/blitz-server")
|
||||
} else if (node.declaration.type === "FunctionDeclaration") {
|
||||
node.declaration = j.template.expression`api(${node.declaration})`
|
||||
addNamedImport(program, "api", "app/blitz-server")
|
||||
fs.writeFileSync(path.join(path.resolve(file)), program.toSource())
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.join(path.resolve(file)), program.toSource())
|
||||
} catch (e:any) {
|
||||
log.error(`Error in wrapping api in ${file}`)
|
||||
throw new Error(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ export function replaceIdentifiers(
|
||||
findIdentifier(program, identifier)
|
||||
.paths()
|
||||
.forEach((path) => {
|
||||
path.value.name = "NextApiRequest"
|
||||
path.value.name = newIdentifier
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# @blitzjs/config
|
||||
|
||||
## 2.0.0-beta.3
|
||||
|
||||
## 2.0.0-beta.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@blitzjs/config",
|
||||
"private": true,
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "5.9.1",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @blitzjs/generator
|
||||
|
||||
## 2.0.0-beta.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- b72d1215: Add vscode debugging configuration to new app templates
|
||||
|
||||
## 2.0.0-beta.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/generator",
|
||||
"version": "2.0.0-beta.2",
|
||||
"version": "2.0.0-beta.3",
|
||||
"scripts": {
|
||||
"dev": "watch unbuild src --wait=0.2",
|
||||
"build": "unbuild && pnpm build:templates",
|
||||
@@ -46,7 +46,7 @@
|
||||
"vinyl": "2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.2",
|
||||
"@blitzjs/config": "2.0.0-beta.3",
|
||||
"@juanm04/cpx": "2.0.1",
|
||||
"@types/babel__core": "7.1.19",
|
||||
"@types/diff": "5.0.2",
|
||||
|
||||
@@ -43,7 +43,7 @@ export class AppGenerator extends Generator<AppGeneratorOptions> {
|
||||
if (!this.options.useTs) {
|
||||
return [
|
||||
"tsconfig.json",
|
||||
"blitz-env.d.ts",
|
||||
"next-env.d.ts",
|
||||
"jest.config.ts",
|
||||
"package.ts.json",
|
||||
"pre-push-ts",
|
||||
|
||||
28
packages/generator/templates/app/.vscode/launch.json
vendored
Normal file
28
packages/generator/templates/app/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Blitz: debug server-side",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "npm run dev"
|
||||
},
|
||||
{
|
||||
"name": "Blitz: debug client-side",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "http://localhost:3000"
|
||||
},
|
||||
{
|
||||
"name": "Blitz: debug full stack",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "npm run dev",
|
||||
"serverReadyAction": {
|
||||
"pattern": "started server on .+, url: (https?://.+)",
|
||||
"uriFormat": "%s",
|
||||
"action": "debugWithChrome"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -20,5 +20,5 @@
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.e2e.ts", "cypress"],
|
||||
"include": ["blitz-env.d.ts", "**/*.ts", "**/*.tsx", "types"]
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "types"]
|
||||
}
|
||||
|
||||
28
packages/generator/templates/minimalapp/.vscode/launch.json
vendored
Normal file
28
packages/generator/templates/minimalapp/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Blitz: debug server-side",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "npm run dev"
|
||||
},
|
||||
{
|
||||
"name": "Blitz: debug client-side",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"url": "http://localhost:3000"
|
||||
},
|
||||
{
|
||||
"name": "Blitz: debug full stack",
|
||||
"type": "node-terminal",
|
||||
"request": "launch",
|
||||
"command": "npm run dev",
|
||||
"serverReadyAction": {
|
||||
"pattern": "started server on .+, url: (https?://.+)",
|
||||
"uriFormat": "%s",
|
||||
"action": "debugWithChrome"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -20,5 +20,5 @@
|
||||
"tsBuildInfoFile": ".tsbuildinfo"
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.e2e.ts", "cypress"],
|
||||
"include": ["blitz-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@typescript-eslint/parser": "5.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.2",
|
||||
"@blitzjs/config": "2.0.0-beta.3",
|
||||
"@types/react": "18.0.17",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"react": "18.2.0",
|
||||
|
||||
79
pnpm-lock.yaml
generated
79
pnpm-lock.yaml
generated
@@ -49,7 +49,7 @@ importers:
|
||||
"@types/preview-email": 2.0.1
|
||||
"@types/react": 18.0.17
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1
|
||||
blitz: workspace:2.0.0-beta.1
|
||||
blitz: workspace:2.0.0-beta.3
|
||||
eslint: 7.32.0
|
||||
eslint-config-next: 12.2.0
|
||||
eslint-config-prettier: 8.5.0
|
||||
@@ -196,6 +196,55 @@ importers:
|
||||
node-fetch: 3.2.3
|
||||
typescript: 4.6.3
|
||||
|
||||
integration-tests/get-initial-props:
|
||||
specifiers:
|
||||
"@blitzjs/auth": workspace:*
|
||||
"@blitzjs/config": workspace:*
|
||||
"@blitzjs/next": workspace:*
|
||||
"@blitzjs/rpc": workspace:*
|
||||
"@next/bundle-analyzer": 12.0.8
|
||||
"@prisma/client": 4.0.0
|
||||
"@types/express": 4.17.13
|
||||
"@types/fs-extra": 9.0.13
|
||||
"@types/node-fetch": 2.6.1
|
||||
"@types/react": 18.0.17
|
||||
b64-lite: 1.4.0
|
||||
blitz: workspace:*
|
||||
eslint: 7.32.0
|
||||
fs-extra: 10.0.1
|
||||
get-port: 6.1.2
|
||||
lowdb: 3.0.0
|
||||
next: 12.2.5
|
||||
node-fetch: 3.2.3
|
||||
prisma: 4.0.0
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0
|
||||
typescript: ^4.5.3
|
||||
dependencies:
|
||||
"@blitzjs/auth": link:../../packages/blitz-auth
|
||||
"@blitzjs/next": link:../../packages/blitz-next
|
||||
"@blitzjs/rpc": link:../../packages/blitz-rpc
|
||||
"@prisma/client": 4.0.0_prisma@4.0.0
|
||||
blitz: link:../../packages/blitz
|
||||
lowdb: 3.0.0
|
||||
next: 12.2.5_biqbaboplfbrettd7655fr4n2y
|
||||
prisma: 4.0.0
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0_react@18.2.0
|
||||
devDependencies:
|
||||
"@blitzjs/config": link:../../packages/config
|
||||
"@next/bundle-analyzer": 12.0.8
|
||||
"@types/express": 4.17.13
|
||||
"@types/fs-extra": 9.0.13
|
||||
"@types/node-fetch": 2.6.1
|
||||
"@types/react": 18.0.17
|
||||
b64-lite: 1.4.0
|
||||
eslint: 7.32.0
|
||||
fs-extra: 10.0.1
|
||||
get-port: 6.1.2
|
||||
node-fetch: 3.2.3
|
||||
typescript: 4.7.4
|
||||
|
||||
integration-tests/middleware:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:*
|
||||
@@ -524,8 +573,8 @@ importers:
|
||||
|
||||
packages/blitz:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-beta.1
|
||||
"@blitzjs/generator": 2.0.0-beta.1
|
||||
"@blitzjs/config": workspace:2.0.0-beta.3
|
||||
"@blitzjs/generator": 2.0.0-beta.3
|
||||
"@types/cookie": 0.4.1
|
||||
"@types/cross-spawn": 6.0.2
|
||||
"@types/debug": 4.1.7
|
||||
@@ -635,7 +684,7 @@ importers:
|
||||
|
||||
packages/blitz-auth:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-beta.1
|
||||
"@blitzjs/config": workspace:2.0.0-beta.3
|
||||
"@testing-library/react": 13.0.0
|
||||
"@testing-library/react-hooks": 7.0.2
|
||||
"@types/b64-lite": 1.3.0
|
||||
@@ -649,7 +698,7 @@ importers:
|
||||
"@types/secure-password": 3.1.1
|
||||
b64-lite: 1.4.0
|
||||
bad-behavior: 1.0.1
|
||||
blitz: 2.0.0-beta.1
|
||||
blitz: 2.0.0-beta.3
|
||||
cookie: 0.4.1
|
||||
cookie-session: 2.0.0
|
||||
debug: 4.3.3
|
||||
@@ -702,8 +751,8 @@ importers:
|
||||
|
||||
packages/blitz-next:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-beta.1
|
||||
"@blitzjs/rpc": 2.0.0-beta.1
|
||||
"@blitzjs/config": workspace:2.0.0-beta.3
|
||||
"@blitzjs/rpc": 2.0.0-beta.3
|
||||
"@tanstack/react-query": 4.0.10
|
||||
"@testing-library/dom": 8.13.0
|
||||
"@testing-library/jest-dom": 5.16.3
|
||||
@@ -715,7 +764,7 @@ importers:
|
||||
"@types/react": 18.0.17
|
||||
"@types/react-dom": 17.0.14
|
||||
"@types/testing-library__react-hooks": 4.0.0
|
||||
blitz: 2.0.0-beta.1
|
||||
blitz: 2.0.0-beta.3
|
||||
cross-spawn: 7.0.3
|
||||
debug: 4.3.3
|
||||
find-up: 4.1.0
|
||||
@@ -765,15 +814,15 @@ importers:
|
||||
|
||||
packages/blitz-rpc:
|
||||
specifiers:
|
||||
"@blitzjs/auth": 2.0.0-beta.1
|
||||
"@blitzjs/config": workspace:2.0.0-beta.1
|
||||
"@blitzjs/auth": 2.0.0-beta.3
|
||||
"@blitzjs/config": workspace:2.0.0-beta.3
|
||||
"@tanstack/react-query": 4.0.10
|
||||
"@types/debug": 4.1.7
|
||||
"@types/react": 18.0.17
|
||||
"@types/react-dom": 17.0.14
|
||||
b64-lite: 1.4.0
|
||||
bad-behavior: 1.0.1
|
||||
blitz: 2.0.0-beta.1
|
||||
blitz: 2.0.0-beta.3
|
||||
chalk: ^4.1.0
|
||||
debug: 4.3.3
|
||||
next: 12.2.5
|
||||
@@ -816,12 +865,12 @@ importers:
|
||||
"@babel/plugin-syntax-typescript": 7.17.12
|
||||
"@babel/preset-env": 7.12.10
|
||||
"@blitzjs/config": workspace:*
|
||||
"@blitzjs/generator": 2.0.0-beta.1
|
||||
"@blitzjs/generator": 2.0.0-beta.3
|
||||
"@types/jscodeshift": 0.11.2
|
||||
"@types/node": 17.0.16
|
||||
arg: 5.0.1
|
||||
ast-types: 0.14.2
|
||||
blitz: 2.0.0-beta.1
|
||||
blitz: 2.0.0-beta.3
|
||||
chalk: ^4.1.0
|
||||
cross-spawn: 7.0.3
|
||||
debug: 4.3.3
|
||||
@@ -876,7 +925,7 @@ importers:
|
||||
"@babel/plugin-transform-typescript": 7.12.1
|
||||
"@babel/preset-env": 7.12.10
|
||||
"@babel/types": 7.12.10
|
||||
"@blitzjs/config": 2.0.0-beta.1
|
||||
"@blitzjs/config": 2.0.0-beta.3
|
||||
"@juanm04/cpx": 2.0.1
|
||||
"@mrleebo/prisma-ast": 0.2.6
|
||||
"@types/babel__core": 7.1.19
|
||||
@@ -969,7 +1018,7 @@ importers:
|
||||
|
||||
packages/pkg-template:
|
||||
specifiers:
|
||||
"@blitzjs/config": 2.0.0-beta.1
|
||||
"@blitzjs/config": 2.0.0-beta.3
|
||||
"@types/react": 18.0.17
|
||||
"@types/react-dom": 17.0.14
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1
|
||||
|
||||
Reference in New Issue
Block a user