1
0
mirror of synced 2026-02-07 12:00:13 -05:00

Compare commits

..

4 Commits

Author SHA1 Message Date
Fran Zekan
946db95245 Fix package.json depend missing 2022-08-15 15:09:47 +02:00
Fran Zekan
15b95d3fd7 Fix lock file 2022-08-15 14:46:03 +02:00
Fran Zekan
a72897bcfe Add back whole config being returned 2022-08-15 14:39:37 +02:00
Fran Zekan
c3f79cea23 Extract codegen tasks and add patching nextjs validation config 2022-08-15 14:38:40 +02:00
70 changed files with 555 additions and 959 deletions

View File

@@ -3703,15 +3703,6 @@
"maintenance",
"doc"
]
},
{
"login": "corydeppen",
"name": "Cory Deppen",
"avatar_url": "https://avatars.githubusercontent.com/u/313264?v=4",
"profile": "https://github.com/corydeppen",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,

View File

@@ -1,13 +0,0 @@
---
"blitz": patch
"@blitzjs/auth": patch
"@blitzjs/next": patch
"@blitzjs/rpc": patch
"@blitzjs/codemod": patch
"@blitzjs/config": patch
"@blitzjs/generator": patch
---
Bump react, react-dom, @types/react and next versions
This fixes a console warning: `Warning: Received `true` for a non-boolean attribute `global`.` when using `styled-jsx`. Versions bump also fixes React Hydration error that happens on and off when using `redirectAuthenticatedTo`.

View File

@@ -1,5 +0,0 @@
---
"blitz": patch
---
Prevent `Minified react error #419` in production

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/codemod": patch
---
Change ES6 import for `withBlitz` during the codemod to the require syntax.

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/generator": patch
---
Add vscode debugging configuration to new app templates

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/generator": patch
---
Add `BlitzPage` types to auth pages in new app template

View File

@@ -1,5 +0,0 @@
---
"blitz": patch
---
Patch Next.js Suspense issue in all node environments. Previously we only patched it in the `development` environment, but now we make sure it gets patched in the `production` env (with the `blitz build` command) as well.

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/generator": patch
---
Include ResetPasswordPage in new app template

View File

@@ -1,5 +0,0 @@
---
"@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.

View File

@@ -22,7 +22,6 @@
"test-react-query-utils": "0.0.0"
},
"changesets": [
"afraid-dancers-juggle",
"big-phones-bow",
"blue-pigs-tan",
"breezy-cameras-double",
@@ -53,18 +52,14 @@
"fast-trainers-kneel",
"few-dogs-fetch",
"flat-bees-approve",
"fluffy-mangos-begin",
"forty-timers-rhyme",
"four-brooms-juggle",
"four-meals-fry",
"four-sheep-judge",
"fuzzy-bees-warn",
"fuzzy-jars-admire",
"gentle-dogs-reply",
"gold-horses-punch",
"good-apes-drum",
"good-insects-wink",
"gorgeous-birds-warn",
"gorgeous-buses-scream",
"gorgeous-games-obey",
"great-candles-stare",
@@ -80,12 +75,10 @@
"hungry-baboons-swim",
"kind-walls-suffer",
"late-steaks-give",
"lazy-maps-sort",
"lemon-games-press",
"lemon-seas-push",
"light-donkeys-double",
"long-bees-hope",
"long-lobsters-drop",
"lovely-berries-sell",
"lovely-colts-share",
"lucky-cows-try",
@@ -107,7 +100,6 @@
"olive-bees-buy",
"olive-feet-rhyme",
"olive-sheep-rhyme",
"orange-zebras-reflect",
"perfect-eyes-repeat",
"perfect-trains-double",
"plenty-bottles-swim",
@@ -118,7 +110,6 @@
"poor-walls-relax",
"popular-teachers-pay",
"pretty-games-march",
"purple-donkeys-smash",
"purple-singers-greet",
"quick-cycles-confess",
"quiet-feet-travel",
@@ -148,7 +139,6 @@
"sour-mails-lick",
"spicy-beds-float",
"spotty-dingos-stare",
"spotty-peas-hope",
"stale-jobs-drum",
"strong-apes-reply",
"stupid-walls-sell",
@@ -173,7 +163,6 @@
"two-eyes-knock",
"two-kiwis-help",
"two-tigers-type",
"two-turtles-poke",
"unlucky-avocados-fix",
"unlucky-papayas-sleep",
"violet-bags-leave",

View File

@@ -1,5 +0,0 @@
---
"blitz": patch
---
Exit CLI process after `blitz new` command is finished

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/codemod": patch
---
Add a new codemod step to update the .eslintrc.js file

View File

@@ -1,5 +0,0 @@
---
"@blitzjs/codemod": patch
---
Add `Script` as a default import from next.js during the codemod.

1
.gitignore vendored
View File

@@ -54,6 +54,7 @@ dist
**/.envrc
.blitz-*
.blitz-cli-cache
.vscode
.tsbuildinfo
.nvmrc
**/.test*

View File

@@ -6,7 +6,7 @@
<img alt="" src="https://img.shields.io/badge/Join%20our%20community-6700EB.svg?style=for-the-badge&labelColor=000000&logoWidth=20&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAQ9SURBVHgB7d3dVdtAEIbhcSpICUoH0IEogQqSVBBSAU4FSSpIOoAORAfQgSghHXzZ1U/YcMD4R9rZmf2ec3y448LyiNf27iLiGIAmPLrweC9Un3DhrzG6EarLNP09nlwJ1SOZ/lQr5N80/S/p2QMVCBf5N17XCfm1Y/rBHqjAG9PPHvBsz+mf9WAP+HLA9M/YA14cOP2payH7jpj+VCtk1wnTP+vj7xCy6cTpn7EHLMLp059iD1iD8eveJbVCNsSLheX1YA/YgOWnf8YeKB3Wmf7Ud6Fy4f/FHmtpxbl3YlC4MJ/Cj0bWdwPnPbARg+L0S54XQHS32WwuxClzd4CM0z9rPfeAuTtA5ulPXYQ7wZ04Y+oOoDD9KZc9YOoOoDj9s4dwFzgXR6w1wIPoOvPWA9buAHEJ173o3gWiy3AnuBUHLEbgmYwvAk1/wuM8vAgexThzbwPDkx7/DHwVXfFOxP2GmsKd4Ab6zPeAyU8CI7AHFmH2BRCBPXAyk18GzUrqAXCTiR4ssyj0VFw/oCU8+e+RZ33AWz6KMaYbIIWxB+JSLs1bsbkeMN0AqakHvoku9oA2sAfqBvbAQdw0QArsgb25aYBUQT3QgT2gB+yBuqGcHij2UCqXDZACe2Anlw2QYg/QAOyBuoE98CL3DZDCuK4/rh/Q7oGL6U+TOvcNkJoijN8X1C48+T+g75eQDrAH/qmqAVJgDwyqaoAUe4AGYA/UDZX3QLUNkEIZPRCd5+6BahsgVUgPROwBTSijB7jpVAvGHriHvmw9wAZ4BpX1ABvgmakHtPcbRuwBTWAPULgAV9D/jKDY9YRvwvgEaurD44uQHvAol7qBW7WKluVtIHiUS7GyvA0s6CiXDnxrpQfsgbqBS7GKk/2jYHCrVlGyfxTMrVo0ALdq1Q3sgSKofh0M9oA61a+D2QM0AHugbmAPqClmSRjK2apVVQ8UsySsoK1aHdgDesCtWnUDeyCrIpeFg1u3sylyWTi3btMA7IG6gT2wuuK3hoE9sKrit4YVslWLPaAN7IG6ocKt2zmY2h4O9sDiTG0PZw/QANy6XTewBxZj9ogYVHy025LMHhEz9cBn0We6B0yfERReBLfhx0/R1YQHPx/QBPbA0VwcEwf2wNFcHBPHHjiem3MC2QPHcXdSaJjA+KfgTPQ8hhfjBzHC40mhlzJ+Xq9lK4a4PCs43AVaGTed5mZq+iOXZwWHi3AnOj2wFWNcnxYe7gTxLtBKHuamP/J+Wnh8a5irB7ZC5Yk9gPX1QuXC+usHWqGyhYvUYR0a7zboUOFCNVhnk0krZAOW7wFOvzXhom2xnEbIHizTA1wEYhWW6YFGyC6c1gOcfg9wfA80Qj7g8B7g9HuCww+haIR8wf49wOn3Cvv9k8tGyC/s7gFOv3fY3QONkH+v9MBWqB7PeqDn9FcIT//kcitUn6kHOu/T/xfWzlQy3dEHhwAAAABJRU5ErkJggg==">
</a>
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-393-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
<a aria-label="All Contributors" href="#contributors-"><img alt="" src="https://img.shields.io/badge/all_contributors-391-17BB8A.svg?style=for-the-badge&labelColor=000000"></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<a aria-label="License" href="https://github.com/blitz-js/blitz/blob/main/LICENSE">
<img alt="" src="https://img.shields.io/npm/l/blitz.svg?style=for-the-badge&labelColor=000000&color=blue">
@@ -713,10 +713,7 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
<td align="center"><a href="oltdaniel.eu"><img src="https://avatars.githubusercontent.com/u/53529846?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Daniel Oltmanns</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=oltdaniel" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=oltdaniel" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/edrickleong"><img src="https://avatars.githubusercontent.com/u/10529706?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Edrick Leong</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=edrickleong" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=edrickleong" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=edrickleong" title="Tests">⚠️</a></td>
<td align="center"><a href="https://github.com/siddhsuresh"><img src="https://avatars.githubusercontent.com/u/83594610?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Siddharth Suresh</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=siddhsuresh" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=siddhsuresh" title="Code">💻</a></td>
<td align="center"><a href="http://jins.dev"><img src="https://avatars.githubusercontent.com/u/39466936?v=4?s=100" width="100px;" alt=""/><br /><sub><b>JH.Lee</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Tests">⚠️</a> <a href="#maintenance-orionmiz" title="Maintenance">🚧</a> <a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Documentation">📖</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/corydeppen"><img src="https://avatars.githubusercontent.com/u/313264?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cory Deppen</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=corydeppen" title="Documentation">📖</a></td>
<td align="center"><a href="http://jins.dev"><img src="https://avatars.githubusercontent.com/u/39466936?v=4" width="100px;" alt=""/><br /><sub><b>JH.Lee</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Code">💻</a> <a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Tests">⚠️</a> <a href="#maintenance-orionmiz" title="Maintenance">🚧</a> <a href="https://github.com/blitz-js/blitz/commits?author=orionmiz" title="Documentation">📖</a></td>
</tr>
</table>

View File

@@ -1,28 +0,0 @@
{
"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"
}
}
]
}

View File

@@ -13,7 +13,7 @@ type ResetPasswordMailer = {
export function forgotPasswordMailer({ to, token }: ResetPasswordMailer) {
// In production, set APP_ORIGIN to your production server origin
const origin = process.env.APP_ORIGIN || process.env.BLITZ_DEV_SERVER_ORIGIN
const resetUrl = `${origin}/auth/reset-password?token=${token}`
const resetUrl = `${origin}/reset-password?token=${token}`
const msg = {
from: "TODO@example.com",

View File

@@ -29,11 +29,11 @@
"@blitzjs/rpc": "workspace:*",
"@hookform/resolvers": "2.8.8",
"@prisma/client": "4.0.0",
"blitz": "workspace:2.0.0-beta.3",
"next": "12.2.5",
"blitz": "workspace:2.0.0-beta.1",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-hook-form": "7.29.0",
"ts-node": "10.7.0",
"zod": "3.17.3"
@@ -45,7 +45,7 @@
"@types/jest": "27.4.1",
"@types/node": "17.0.16",
"@types/preview-email": "2.0.1",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@typescript-eslint/eslint-plugin": "5.9.1",
"eslint": "7.32.0",
"eslint-config-next": "12.2.0",

View File

@@ -4,9 +4,8 @@ import { Form, FORM_ERROR } from "app/core/components/Form"
import { ForgotPassword } from "app/auth/validations"
import forgotPassword from "app/auth/mutations/forgotPassword"
import { useMutation } from "@blitzjs/rpc"
import { BlitzPage } from "@blitzjs/next"
const ForgotPasswordPage: BlitzPage = () => {
const ForgotPasswordPage = () => {
const [forgotPasswordMutation, { isSuccess }] = useMutation(forgotPassword)
return (

View File

@@ -1,9 +1,8 @@
import Layout from "app/core/layouts/Layout"
import { LoginForm } from "app/auth/components/LoginForm"
import { useRouter } from "next/router"
import { BlitzPage } from "@blitzjs/next"
const LoginPage: BlitzPage = () => {
const LoginPage = () => {
const router = useRouter()
return (

View File

@@ -1,66 +0,0 @@
import Layout from "app/core/layouts/Layout"
import { LabeledTextField } from "app/core/components/LabeledTextField"
import { Form, FORM_ERROR } from "app/core/components/Form"
import { ResetPassword } from "app/auth/validations"
import resetPassword from "app/auth/mutations/resetPassword"
import { BlitzPage, Routes } from "@blitzjs/next"
import { useRouter } from "next/router"
import { useMutation } from "@blitzjs/rpc"
import Link from "next/link"
const ResetPasswordPage: BlitzPage = () => {
const router = useRouter()
const [resetPasswordMutation, { isSuccess }] = useMutation(resetPassword)
return (
<div>
<h1>Set a New Password</h1>
{isSuccess ? (
<div>
<h2>Password Reset Successfully</h2>
<p>
Go to the <Link href={Routes.Home()}>homepage</Link>
</p>
</div>
) : (
<Form
submitText="Reset Password"
schema={ResetPassword}
initialValues={{
password: "",
passwordConfirmation: "",
token: router.query.token as string,
}}
onSubmit={async (values) => {
try {
await resetPasswordMutation(values)
} catch (error: any) {
if (error.name === "ResetPasswordError") {
return {
[FORM_ERROR]: error.message,
}
} else {
return {
[FORM_ERROR]: "Sorry, we had an unexpected error. Please try again.",
}
}
}
}}
>
<LabeledTextField name="password" label="New Password" type="password" />
<LabeledTextField
name="passwordConfirmation"
label="Confirm New Password"
type="password"
/>
</Form>
)}
</div>
)
}
ResetPasswordPage.redirectAuthenticatedTo = "/"
ResetPasswordPage.getLayout = (page) => <Layout title="Reset Your Password">{page}</Layout>
export default ResetPasswordPage

View File

@@ -1,9 +1,9 @@
import { useRouter } from "next/router"
import Layout from "app/core/layouts/Layout"
import { SignupForm } from "app/auth/components/SignupForm"
import { BlitzPage, Routes } from "@blitzjs/next"
import { Routes } from "@blitzjs/next"
const SignupPage: BlitzPage = () => {
const SignupPage = () => {
const router = useRouter()
return (

View File

@@ -25,17 +25,17 @@
"@types/passport-twitter": "1.0.37",
"blitz": "workspace:*",
"jest": "27.5.1",
"next": "12.2.5",
"next": "12.2.0",
"passport-mock-strategy": "2.0.0",
"passport-twitter": "1.0.4",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"ts-node": "10.7.0"
},
"devDependencies": {
"@next/bundle-analyzer": "12.0.8",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"eslint": "7.32.0",
"typescript": "^4.5.3"
}

View File

@@ -19,17 +19,17 @@
"@prisma/client": "4.0.0",
"blitz": "workspace:*",
"lowdb": "3.0.0",
"next": "12.2.5",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "18.0.0",
"react-dom": "18.0.0"
},
"devDependencies": {
"@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",
"@types/react": "18.0.1",
"b64-lite": "1.4.0",
"eslint": "7.32.0",
"fs-extra": "10.0.1",

View File

@@ -15,16 +15,16 @@
"@blitzjs/next": "workspace:*",
"@blitzjs/rpc": "workspace:*",
"blitz": "workspace:*",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0"
"next": "12.2.0",
"react": "18.0.0",
"react-dom": "18.0.0"
},
"devDependencies": {
"@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",
"@types/react": "18.0.1",
"eslint": "7.32.0",
"fs-extra": "10.0.1",
"get-port": "6.1.2",

View File

@@ -19,10 +19,10 @@
"@prisma/client": "4.0.0",
"blitz": "workspace:*",
"lowdb": "3.0.0",
"next": "12.2.5",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "18.0.0",
"react-dom": "18.0.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:*",
@@ -30,7 +30,7 @@
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"b64-lite": "1.4.0",
"eslint": "7.32.0",
"fs-extra": "10.0.1",

View File

@@ -15,14 +15,14 @@
"@prisma/client": "4.0.0",
"@tanstack/react-query": "4.0.10",
"blitz": "workspace:*",
"next": "12.2.5",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "18.0.0",
"react-dom": "18.0.0"
},
"devDependencies": {
"@testing-library/react": "13.0.0",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@vitejs/plugin-react": "1.3.0",
"delay": "5.0.0",
"eslint": "7.32.0",

View File

@@ -22,10 +22,10 @@
"@prisma/client": "4.0.0",
"blitz": "workspace:*",
"lowdb": "3.0.0",
"next": "12.2.5",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "18.0.0",
"react-dom": "18.0.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:*",
@@ -33,7 +33,7 @@
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"b64-lite": "1.4.0",
"eslint": "7.32.0",
"fs-extra": "10.0.1",

View File

@@ -12,15 +12,15 @@
"@blitzjs/next": "workspace:*",
"@blitzjs/rpc": "workspace:*",
"blitz": "workspace:*",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0"
"next": "12.2.0",
"react": "18.0.0",
"react-dom": "18.0.0"
},
"devDependencies": {
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"b64-lite": "1.4.0",
"eslint": "7.32.0",
"fs-extra": "10.0.1",

View File

@@ -22,10 +22,10 @@
"@prisma/client": "4.0.0",
"blitz": "workspace:*",
"lowdb": "3.0.0",
"next": "12.2.5",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "18.0.0",
"react-dom": "18.0.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:*",
@@ -33,7 +33,7 @@
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"b64-lite": "1.4.0",
"eslint": "7.32.0",
"fs-extra": "10.0.1",

View File

@@ -10,7 +10,7 @@
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@types/rimraf": "3.0.2",
"@types/selenium-webdriver": "4.0.18",
"chromedriver": "100.0.0",
@@ -22,8 +22,8 @@
"node-fetch": "3.2.3",
"pkg-dir": "5.0.0",
"playwright-chromium": "1.14.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"resolve-cwd": "3.0.0",
"resolve-from": "5.0.0",
"rimraf": "3.0.2",

View File

@@ -28,7 +28,7 @@
"husky": "7.0.4",
"jsdom": "^19.0.0",
"lint-staged": "12.1.7",
"next": "12.2.5",
"next": "12.2.0",
"only-allow": "1.1.0",
"prettier": "^2.5.1",
"prettier-plugin-prisma": "3.8.0",

View File

@@ -1,25 +1,5 @@
# @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
- db7233db: Bump react, react-dom, @types/react and next versions
This fixes a console warning: `Warning: Received`true`for a non-boolean attribute`global`.` when using `styled-jsx`. Versions bump also fixes React Hydration error that happens on and off when using `redirectAuthenticatedTo`.
- Updated dependencies [db7233db]
- Updated dependencies [0936cb38]
- Updated dependencies [3f9fe8f0]
- blitz@2.0.0-beta.2
## 2.0.0-beta.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/auth",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.1",
"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.3",
"blitz": "2.0.0-beta.1",
"cookie": "0.4.1",
"cookie-session": "2.0.0",
"debug": "4.3.3",
@@ -40,16 +40,16 @@
"url": "0.11.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.3",
"@blitzjs/config": "workspace:2.0.0-beta.1",
"@testing-library/react": "13.0.0",
"@testing-library/react-hooks": "7.0.2",
"@types/cookie": "0.4.1",
"@types/debug": "4.1.7",
"@types/jsonwebtoken": "8.5.8",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"typescript": "^4.5.3",
"unbuild": "0.7.6",
"watch": "1.0.2"

View File

@@ -1,22 +1,5 @@
# @blitzjs/next
## 2.0.0-beta.3
### Patch Changes
- @blitzjs/rpc@2.0.0-beta.3
## 2.0.0-beta.2
### Patch Changes
- db7233db: Bump react, react-dom, @types/react and next versions
This fixes a console warning: `Warning: Received`true`for a non-boolean attribute`global`.` when using `styled-jsx`. Versions bump also fixes React Hydration error that happens on and off when using `redirectAuthenticatedTo`.
- Updated dependencies [db7233db]
- @blitzjs/rpc@2.0.0-beta.2
## 2.0.0-beta.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/next",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.1",
"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.3",
"@blitzjs/rpc": "2.0.0-beta.1",
"@tanstack/react-query": "4.0.10",
"@types/hoist-non-react-statics": "3.3.1",
"debug": "4.3.3",
@@ -34,22 +34,22 @@
"supports-color": "8.1.1"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.3",
"@blitzjs/config": "workspace:2.0.0-beta.1",
"@testing-library/dom": "8.13.0",
"@testing-library/jest-dom": "5.16.3",
"@testing-library/react": "13.0.0",
"@testing-library/react-hooks": "7.0.2",
"@testing-library/user-event": "13.5.0",
"@types/node": "17.0.16",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"@types/testing-library__react-hooks": "4.0.0",
"blitz": "2.0.0-beta.3",
"blitz": "2.0.0-beta.1",
"cross-spawn": "7.0.3",
"find-up": "4.1.0",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "12.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"resolve-from": "5.0.0",
"ts-jest": "27.1.4",
"typescript": "^4.5.3",

View File

@@ -46,6 +46,7 @@ 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} />
</>

View File

@@ -240,8 +240,7 @@ export function withBlitz(nextConfig: BlitzConfig = {}) {
},
})
const {blitz, ...rest} = config
return rest
return config
}
export type PrefetchQueryFn = <T extends AsyncFunc, TInput = FirstParam<T>>(

View File

@@ -1,22 +1,5 @@
# @blitzjs/rpc
## 2.0.0-beta.3
### Patch Changes
- @blitzjs/auth@2.0.0-beta.3
## 2.0.0-beta.2
### Patch Changes
- db7233db: Bump react, react-dom, @types/react and next versions
This fixes a console warning: `Warning: Received`true`for a non-boolean attribute`global`.` when using `styled-jsx`. Versions bump also fixes React Hydration error that happens on and off when using `redirectAuthenticatedTo`.
- Updated dependencies [db7233db]
- @blitzjs/auth@2.0.0-beta.2
## 2.0.0-beta.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/rpc",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.1",
"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.3",
"@blitzjs/auth": "2.0.0-beta.1",
"@tanstack/react-query": "4.0.10",
"b64-lite": "1.4.0",
"bad-behavior": "1.0.1",
@@ -30,14 +30,14 @@
"supports-color": "8.1.1"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.3",
"@blitzjs/config": "workspace:2.0.0-beta.1",
"@types/debug": "4.1.7",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"blitz": "2.0.0-beta.3",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"blitz": "2.0.0-beta.1",
"next": "12.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"typescript": "^4.5.3",
"unbuild": "0.7.6",
"watch": "1.0.2",

View File

@@ -1,28 +1,5 @@
# 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
- db7233db: Bump react, react-dom, @types/react and next versions
This fixes a console warning: `Warning: Received`true`for a non-boolean attribute`global`.` when using `styled-jsx`. Versions bump also fixes React Hydration error that happens on and off when using `redirectAuthenticatedTo`.
- 0936cb38: Patch Next.js Suspense issue in all node environments. Previously we only patched it in the `development` environment, but now we make sure it gets patched in the `production` env (with the `blitz build` command) as well.
- 3f9fe8f0: Exit CLI process after `blitz new` command is finished
- Updated dependencies [db7233db]
- Updated dependencies [eb971568]
- Updated dependencies [8ada2c26]
- @blitzjs/generator@2.0.0-beta.2
## 2.0.0-beta.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "blitz",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.1",
"scripts": {
"build": "unbuild",
"dev": "watch unbuild src --wait=0.2",
@@ -23,7 +23,7 @@
"blitz": "bin/blitz"
},
"dependencies": {
"@blitzjs/generator": "2.0.0-beta.3",
"@blitzjs/generator": "2.0.0-beta.1",
"arg": "5.0.1",
"boxen": "7.0.0",
"chalk": "^4.1.0",
@@ -47,6 +47,7 @@
"prompts": "2.4.2",
"resolve-cwd": "3.0.0",
"resolve-from": "5.0.0",
"semver": "7.3.7",
"superjson": "1.8.0",
"supports-color": "8.1.1",
"ts-node": "10.7.0",
@@ -55,7 +56,7 @@
"watchpack": "2.1.1"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-beta.3",
"@blitzjs/config": "workspace:2.0.0-beta.1",
"@types/cookie": "0.4.1",
"@types/cross-spawn": "6.0.2",
"@types/debug": "4.1.7",
@@ -67,12 +68,12 @@
"@types/node-fetch": "2.6.1",
"@types/npm-which": "3.0.1",
"@types/prompts": "2.0.14",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"@types/test-listen": "1.1.0",
"@types/watchpack": "1.1.1",
"express": "4.17.3",
"react": "18.2.0",
"react": "18.0.0",
"test-listen": "1.1.0",
"typescript": "^4.5.3",
"unbuild": "0.7.6",

View File

@@ -300,10 +300,8 @@ const newApp: CliCommand = async (argv) => {
console.log(chalk.yellow(` ${index + 1}. ${step}`))
})
console.log("") // new line
process.exit(0)
} catch (error) {
console.error(error)
process.exit(1)
}
}

View File

@@ -1,54 +0,0 @@
import {generateManifest} from "./routes-manifest"
import {log} from "../../logging"
import resolveCwd from "resolve-cwd"
import {join} from "path"
import fs from "fs-extra"
import {getPackageJson} from "./get-package-json"
import {runPrisma} from "../../utils/run-prisma"
export const codegenTasks = async () => {
try {
/*
Updates the user's nextjs file and adds onRecoverableError to the hydrateRoot 3rd parameter object.
We can remove this when https://github.com/vercel/next.js/pull/38207 is merged into next.js
*/
const nextDir = await resolveCwd("next")
const nextClientIndex = join(nextDir, "../..", "client", "index.js")
const readFile = await fs.readFile(nextClientIndex)
const updatedFile = readFile
.toString()
.replace(
/ReactDOM\.hydrateRoot\(.*?\);/,
`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")
} catch (err) {
log.error(JSON.stringify(err, null, 2))
}
try {
await generateManifest()
log.success("Routes manifest was successfully generated")
const {dependencies, devDependencies} = await getPackageJson()
const hasPrisma = Object.keys({...dependencies, ...devDependencies}).some(
(name) => name === "prisma",
)
if (hasPrisma) {
let prismaSpinner = log.spinner(`Generating Prisma client`).start()
const result = await runPrisma(["generate"], true)
if (result.success) {
prismaSpinner.succeed(log.greenText("Generated Prisma client"))
} else {
prismaSpinner.fail()
console.log("\n" + result.stderr)
process.exit(1)
}
}
} catch (err) {
log.error(JSON.stringify(err, null, 2))
}
}

View File

@@ -0,0 +1,22 @@
import {log} from "../../../logging"
import {runPrisma} from "../../../utils/run-prisma"
import {getPackageJson} from "../get-package-json"
export const generatePrismaClient = async () => {
const {dependencies, devDependencies} = await getPackageJson()
const hasPrisma = Object.keys({...dependencies, ...devDependencies}).some(
(name) => name === "prisma",
)
if (hasPrisma) {
let prismaSpinner = log.spinner(`Generating Prisma client`).start()
const result = await runPrisma(["generate"], true)
if (result.success) {
prismaSpinner.succeed(log.greenText("Generated Prisma client"))
} else {
prismaSpinner.fail()
console.log("\n" + result.stderr)
process.exit(1)
}
}
}

View File

@@ -0,0 +1,25 @@
import {generateManifest} from "../routes-manifest"
import {log} from "../../../logging"
import {generatePrismaClient} from "./generatePrisma"
import {patchNextSuspenseBug, patchNextConfigWarning} from "./patchNextJs"
const _tryCatch = async (fn: () => Promise<unknown>) => {
try {
await fn()
} catch (err) {
log.error(JSON.stringify(err, null, 2))
}
}
export const codegenTasks = async () => {
await _tryCatch(patchNextSuspenseBug)
await _tryCatch(patchNextConfigWarning)
await _tryCatch(async () => {
await generateManifest()
log.success("Routes manifest was successfully generated")
})
await _tryCatch(generatePrismaClient)
}

View File

@@ -0,0 +1,63 @@
import {join} from "path"
import semver from "semver"
import resolveCwd from "resolve-cwd"
import fs from "fs-extra"
import {log} from "../../../logging"
import {getPackageJson} from "../get-package-json"
const modifyNextFile = async (
path: string,
replacer: (str: string) => string,
semverCheck?: (version: string) => boolean,
) => {
const nextDir = resolveCwd("next")
if (semverCheck) {
const pkgJson = await getPackageJson(nextDir)
if (!semverCheck(pkgJson.version)) {
return
}
}
const nextClientIndex = join(nextDir, path)
const readFile = await fs.readFile(nextClientIndex)
const updatedFile = replacer(readFile.toString())
await fs.writeFile(nextClientIndex, updatedFile)
}
export const patchNextSuspenseBug = async () => {
/*
Updates the user's nextjs file and adds onRecoverableError to the hydrateRoot 3rd parameter object.
We can remove this when https://github.com/vercel/next.js/pull/38207 is merged into next.js
*/
await modifyNextFile("../../client/index.js", (str) => {
return str.replace(
/ReactDOM\.hydrateRoot\(.*?\);/,
`ReactDOM.hydrateRoot(domEl, reactEl, process.env.NODE_ENV === 'development' ? {onRecoverableError: (err) => err.toString().includes("could not finish this Suspense boundary") ? null : console.error(err)} : undefined);`,
)
})
log.success("Next.js was successfully patched with a React Suspense fix")
}
export const patchNextConfigWarning = async () => {
/*
Updates the user's nextjs config validation to add blitz as a valid prop in the config schema
We can remove this when https://github.com/vercel/next.js/issues/39606 issue gets resolved
*/
await modifyNextFile(
"../../client/index.js",
(str) => {
return str.replace(
/type:"object",additionalProperties:false,properties:{amp:{/,
`type:"object",additionalProperties:false,properties:{blitz:{type:"any"},amp:{`,
)
},
(version) => semver.gte(version, "12.2.3"),
)
log.success("Next.js was successfully patched with config warning fix")
}

View File

@@ -2,8 +2,8 @@ import {existsSync} from "fs"
import {readJSON} from "fs-extra"
import {join} from "path"
export const getPackageJson = async () => {
const pkgJsonPath = join(process.cwd(), "package.json")
export const getPackageJson = async (path = process.cwd()) => {
const pkgJsonPath = join(path, "package.json")
if (existsSync(pkgJsonPath)) {
return readJSON(pkgJsonPath)
}

View File

@@ -104,6 +104,7 @@ export function compose(middleware: RequestMiddleware<any, any>[]) {
}
try {
console.log(`[${handler.name}] Starting handler...`)
return Promise.resolve(handler(req, res, dispatch.bind(null, i + 1)))
} catch (err) {
return Promise.reject(err)

View File

@@ -1,34 +1,5 @@
# @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
- db7233db: Bump react, react-dom, @types/react and next versions
This fixes a console warning: `Warning: Received`true`for a non-boolean attribute`global`.` when using `styled-jsx`. Versions bump also fixes React Hydration error that happens on and off when using `redirectAuthenticatedTo`.
- a3b5fdd0: Change ES6 import for `withBlitz` during the codemod to the require syntax.
- ebfb562b: Add `Script` as a default import from next.js during the codemod.
- Updated dependencies [db7233db]
- Updated dependencies [eb971568]
- Updated dependencies [0936cb38]
- Updated dependencies [8ada2c26]
- Updated dependencies [3f9fe8f0]
- blitz@2.0.0-beta.2
- @blitzjs/generator@2.0.0-beta.2
## 2.0.0-beta.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/codemod",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.1",
"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.3",
"@blitzjs/generator": "2.0.0-beta.1",
"arg": "5.0.1",
"blitz": "2.0.0-beta.3",
"blitz": "2.0.0-beta.1",
"chalk": "^4.1.0",
"cross-spawn": "7.0.3",
"debug": "4.3.3",

View File

@@ -90,14 +90,8 @@ const upgradeLegacy = async () => {
},
})
let createdConfig = config.get().value.right
let importWithBlitz = j.expressionStatement(
j.assignmentExpression(
"=",
j.identifier("const { withBlitz }"),
j.callExpression(j.identifier("require"), [j.identifier(`"@blitzjs/next"`)]),
),
)
parsedProgram.value.program.body.unshift(importWithBlitz)
addNamedImport(program, "withBlitz", "@blitzjs/next")
config.remove()
let moduleExportStatement = j.expressionStatement(
@@ -113,31 +107,6 @@ 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 () => {
@@ -288,7 +257,6 @@ const upgradeLegacy = async () => {
const nextLink = findImport(program, "next/link")
const nextHead = findImport(program, "next/head")
const dynamic = findImport(program, "next/dynamic")
const nextScript = findImport(program, "next/script")
if (nextImage?.length) {
nextImage.remove()
@@ -302,18 +270,6 @@ const upgradeLegacy = async () => {
)
}
if (nextScript?.length) {
nextScript.remove()
program
.get()
.value.program.body.unshift(
j.importDeclaration(
[j.importDefaultSpecifier(j.identifier("Script"))],
j.stringLiteral("next/script"),
),
)
}
if (nextLink?.length) {
nextLink.remove()
program
@@ -1052,23 +1008,18 @@ const upgradeLegacy = async () => {
// Remove the old import statements
importStatements?.remove()
const document = program.find(
j.JSXElement,
(node) => node.openingElement.name.name === "DocumentHead",
)
const documentHead = program
.find(j.JSXElement, (node) => node.openingElement.name.name === "DocumentHead")
.get()
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"
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"
fs.writeFileSync(
path.join(pagesDir, `_document.${isTypescript ? "tsx" : "jsx"}`),
program.toSource(),
@@ -1082,27 +1033,25 @@ const upgradeLegacy = async () => {
action: async () => {
const pagesDir = path.resolve("pages")
getAllFiles(pagesDir, [], ["api"], [".ts", ".tsx", ".js", ".jsx"]).forEach((file) => {
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)
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())
})
// 3. api
@@ -1113,25 +1062,22 @@ const upgradeLegacy = async () => {
["rpc"],
[".ts", ".tsx", ".js", ".jsx"],
).forEach((file) => {
try {
const program = getCollectionFromSource(file)
const defaultExportPath = findDefaultExportPath(program)
if (defaultExportPath) {
const {node} = defaultExportPath
const program = getCollectionFromSource(file)
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")
}
const defaultExportPath = findDefaultExportPath(program)
fs.writeFileSync(path.join(path.resolve(file)), program.toSource())
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")
}
} catch (e:any) {
log.error(`Error in wrapping api in ${file}`)
throw new Error(e)
fs.writeFileSync(path.join(path.resolve(file)), program.toSource())
}
})
}

View File

@@ -325,7 +325,7 @@ export function replaceIdentifiers(
findIdentifier(program, identifier)
.paths()
.forEach((path) => {
path.value.name = newIdentifier
path.value.name = "NextApiRequest"
})
}

View File

@@ -1,15 +1,5 @@
# @blitzjs/config
## 2.0.0-beta.3
## 2.0.0-beta.2
### Patch Changes
- db7233db: Bump react, react-dom, @types/react and next versions
This fixes a console warning: `Warning: Received`true`for a non-boolean attribute`global`.` when using `styled-jsx`. Versions bump also fixes React Hydration error that happens on and off when using `redirectAuthenticatedTo`.
## 2.0.0-beta.1
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@blitzjs/config",
"private": true,
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.1",
"license": "MIT",
"dependencies": {
"@typescript-eslint/eslint-plugin": "5.9.1",

View File

@@ -1,22 +1,5 @@
# @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
- db7233db: Bump react, react-dom, @types/react and next versions
This fixes a console warning: `Warning: Received`true`for a non-boolean attribute`global`.` when using `styled-jsx`. Versions bump also fixes React Hydration error that happens on and off when using `redirectAuthenticatedTo`.
- eb971568: Add `BlitzPage` types to auth pages in new app template
- 8ada2c26: Include ResetPasswordPage in new app template
## 2.0.0-beta.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/generator",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.1",
"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.3",
"@blitzjs/config": "2.0.0-beta.1",
"@juanm04/cpx": "2.0.1",
"@types/babel__core": "7.1.19",
"@types/diff": "5.0.2",
@@ -56,7 +56,7 @@
"@types/mem-fs-editor": "7.0.1",
"@types/pluralize": "0.0.29",
"@types/prettier": "2.4.4",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"@types/vinyl": "2.0.6",
"@typescript-eslint/eslint-plugin": "5.9.1",
@@ -64,7 +64,7 @@
"babylon": "6.18.0",
"debug": "4.3.3",
"eslint": "7.32.0",
"react": "18.2.0",
"react": "18.0.0",
"typescript": "^4.5.3",
"unbuild": "0.6.9",
"watch": "1.0.2"

View File

@@ -1,28 +0,0 @@
{
"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"
}
}
]
}

View File

@@ -13,7 +13,7 @@ type ResetPasswordMailer = {
export function forgotPasswordMailer({ to, token }: ResetPasswordMailer) {
// In production, set APP_ORIGIN to your production server origin
const origin = process.env.APP_ORIGIN || process.env.BLITZ_DEV_SERVER_ORIGIN
const resetUrl = `${origin}/auth/reset-password?token=${token}`
const resetUrl = `${origin}/reset-password?token=${token}`
const msg = {
from: "TODO@example.com",

View File

@@ -27,10 +27,10 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "4.0.0",
"blitz": "latest",
"next": "12.2.5",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"zod": "3.17.3"
},
"devDependencies": {
@@ -39,7 +39,7 @@
"@types/jest": "27.4.1",
"@types/node": "17.0.16",
"@types/preview-email": "2.0.1",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"eslint": "7.32.0",
"eslint-config-next": "12.2.0",
"eslint-config-prettier": "8.5.0",

View File

@@ -27,10 +27,10 @@
"@blitzjs/rpc": "latest",
"@prisma/client": "4.0.0",
"blitz": "latest",
"next": "12.2.5",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"zod": "3.17.3"
},
"devDependencies": {
@@ -39,7 +39,7 @@
"@types/jest": "27.4.1",
"@types/node": "17.0.16",
"@types/preview-email": "2.0.1",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@typescript-eslint/eslint-plugin": "5.30.5",
"eslint": "7.32.0",
"eslint-config-next": "12.2.0",

View File

@@ -4,9 +4,8 @@ import { Form, FORM_ERROR } from "app/core/components/Form"
import { ForgotPassword } from "app/auth/validations"
import forgotPassword from "app/auth/mutations/forgotPassword"
import { useMutation } from "@blitzjs/rpc"
import { BlitzPage } from "@blitzjs/next"
const ForgotPasswordPage: BlitzPage = () => {
const ForgotPasswordPage = () => {
const [forgotPasswordMutation, { isSuccess }] = useMutation(forgotPassword)
return (

View File

@@ -1,9 +1,8 @@
import { BlitzPage } from "@blitzjs/next"
import Layout from "app/core/layouts/Layout"
import { LoginForm } from "app/auth/components/LoginForm"
import { useRouter } from "next/router"
const LoginPage: BlitzPage = () => {
const LoginPage = () => {
const router = useRouter()
return (

View File

@@ -1,62 +0,0 @@
import Layout from "app/core/layouts/Layout"
import { LabeledTextField } from "app/core/components/LabeledTextField"
import { Form, FORM_ERROR } from "app/core/components/Form"
import { ResetPassword } from "app/auth/validations"
import resetPassword from "app/auth/mutations/resetPassword"
import { BlitzPage, Routes } from "@blitzjs/next"
import { useRouter } from "next/router"
import { useMutation } from "@blitzjs/rpc"
import Link from "next/link"
const ResetPasswordPage: BlitzPage = () => {
const router = useRouter()
const [resetPasswordMutation, { isSuccess }] = useMutation(resetPassword)
return (
<div>
<h1>Set a New Password</h1>
{isSuccess ? (
<div>
<h2>Password Reset Successfully</h2>
<p>
Go to the <Link href={Routes.Home()}>homepage</Link>
</p>
</div>
) : (
<Form
submitText="Reset Password"
schema={ResetPassword}
initialValues={{ password: "", passwordConfirmation: "", token: router.query.token as string }}
onSubmit={async (values) => {
try {
await resetPasswordMutation(values)
} catch (error: any) {
if (error.name === "ResetPasswordError") {
return {
[FORM_ERROR]: error.message,
}
} else {
return {
[FORM_ERROR]: "Sorry, we had an unexpected error. Please try again.",
}
}
}
}}
>
<LabeledTextField name="password" label="New Password" type="password" />
<LabeledTextField
name="passwordConfirmation"
label="Confirm New Password"
type="password"
/>
</Form>
)}
</div>
)
}
ResetPasswordPage.redirectAuthenticatedTo = "/"
ResetPasswordPage.getLayout = (page) => <Layout title="Reset Your Password">{page}</Layout>
export default ResetPasswordPage

View File

@@ -1,9 +1,9 @@
import { useRouter } from "next/router"
import Layout from "app/core/layouts/Layout"
import { SignupForm } from "app/auth/components/SignupForm"
import { BlitzPage, Routes } from "@blitzjs/next"
import { Routes } from "@blitzjs/next"
const SignupPage: BlitzPage = () => {
const SignupPage = () => {
const router = useRouter()
return (

View File

@@ -1,28 +0,0 @@
{
"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"
}
}
]
}

View File

@@ -20,9 +20,9 @@
"dependencies": {
"@blitzjs/next": "latest",
"blitz": "latest",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "12.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"ts-node": "10.7.0"
},
"devDependencies": {
@@ -30,7 +30,7 @@
"@testing-library/jest-dom": "5.16.3",
"@types/jest": "27.4.1",
"@types/node": "17.0.16",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"eslint": "7.32.0",
"eslint-config-next": "12.2.0",
"eslint-config-prettier": "8.5.0",

View File

@@ -22,9 +22,9 @@
"dependencies": {
"@blitzjs/next": "latest",
"blitz": "latest",
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "12.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"ts-node": "10.7.0"
},
"devDependencies": {
@@ -32,7 +32,7 @@
"@testing-library/jest-dom": "5.16.3",
"@types/jest": "27.4.1",
"@types/node": "17.0.16",
"@types/react": "18.0.17",
"@types/react": "18.0.1",
"@typescript-eslint/eslint-plugin": "5.30.5",
"eslint": "7.32.0",
"eslint-config-prettier": "8.5.0",

View File

@@ -25,10 +25,10 @@
"@typescript-eslint/parser": "5.9.1"
},
"devDependencies": {
"@blitzjs/config": "2.0.0-beta.3",
"@types/react": "18.0.17",
"@blitzjs/config": "2.0.0-beta.1",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"react": "18.2.0",
"react": "18.0.0",
"typescript": "^4.5.3",
"unbuild": "0.7.6",
"watch": "1.0.2"

548
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff