Compare commits
12 Commits
@blitzjs/c
...
@blitzjs/a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d73b1d76ab | ||
|
|
78fd5c489b | ||
|
|
60de057477 | ||
|
|
0a8b0cb350 | ||
|
|
5476139375 | ||
|
|
81dd346c85 | ||
|
|
6f4349896f | ||
|
|
a6e81f156b | ||
|
|
4e26ae21bc | ||
|
|
70ca39e059 | ||
|
|
7b63f0f1f2 | ||
|
|
2e5d7ae40c |
@@ -3723,6 +3723,16 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "janvennemann",
|
||||
"name": "Jan Vennemann",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1406024?v=4",
|
||||
"profile": "https://github.com/janvennemann",
|
||||
"contributions": [
|
||||
"doc",
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
5
.changeset/chilly-nails-nail.md
Normal file
5
.changeset/chilly-nails-nail.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Remove unnecessary `as number` assertions from new app templates
|
||||
6
.changeset/giant-mails-tap.md
Normal file
6
.changeset/giant-mails-tap.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"blitz": patch
|
||||
"@blitzjs/next": patch
|
||||
---
|
||||
|
||||
Add BlitzLogger plugin and allow customizing logging
|
||||
5
.changeset/honest-comics-vanish.md
Normal file
5
.changeset/honest-comics-vanish.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fix Blitz Install issue that gets stuck on "Generating file diff"
|
||||
5
.changeset/khaki-ducks-cheer.md
Normal file
5
.changeset/khaki-ducks-cheer.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/rpc": patch
|
||||
---
|
||||
|
||||
Allow the updater function in setQueryData to return undefined to match react-query typings
|
||||
5
.changeset/lemon-pillows-switch.md
Normal file
5
.changeset/lemon-pillows-switch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Fix reset token being undefined when passed to the resetPassword mutation
|
||||
5
.changeset/little-pears-ring.md
Normal file
5
.changeset/little-pears-ring.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fix "Ambiguous class detected" errors reported by SuperJson by removing duplicated export from errors.ts file
|
||||
6
.changeset/lucky-years-turn.md
Normal file
6
.changeset/lucky-years-turn.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@blitzjs/config": patch
|
||||
"@blitzjs/generator": patch
|
||||
---
|
||||
|
||||
Upgrade eslint-config-next in new app templates to fix linting issues on blitz build
|
||||
5
.changeset/moody-spoons-rhyme.md
Normal file
5
.changeset/moody-spoons-rhyme.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"blitz": patch
|
||||
---
|
||||
|
||||
Fix Custom Server TS error - add `es6` target config to esbuild
|
||||
@@ -61,6 +61,7 @@
|
||||
"calm-nails-wait",
|
||||
"calm-tomatoes-drive",
|
||||
"chilled-carrots-own",
|
||||
"chilly-nails-nail",
|
||||
"clean-hats-pump",
|
||||
"clean-walls-wink",
|
||||
"clever-radios-lie",
|
||||
@@ -98,6 +99,7 @@
|
||||
"fuzzy-jars-admire",
|
||||
"gentle-dogs-reply",
|
||||
"gentle-lions-explode",
|
||||
"giant-mails-tap",
|
||||
"gold-horses-punch",
|
||||
"good-apes-drum",
|
||||
"good-insects-wink",
|
||||
@@ -118,18 +120,22 @@
|
||||
"hip-buttons-dance",
|
||||
"honest-candles-yawn",
|
||||
"honest-cherries-push",
|
||||
"honest-comics-vanish",
|
||||
"hot-cups-rhyme",
|
||||
"hot-drinks-approve",
|
||||
"hungry-baboons-swim",
|
||||
"hungry-pens-collect",
|
||||
"itchy-houses-marry",
|
||||
"itchy-spoons-tan",
|
||||
"khaki-ducks-cheer",
|
||||
"kind-walls-suffer",
|
||||
"late-steaks-give",
|
||||
"lazy-maps-sort",
|
||||
"lemon-games-press",
|
||||
"lemon-pillows-switch",
|
||||
"lemon-seas-push",
|
||||
"light-donkeys-double",
|
||||
"little-pears-ring",
|
||||
"long-bees-hope",
|
||||
"long-dancers-jog",
|
||||
"long-lobsters-drop",
|
||||
@@ -137,10 +143,12 @@
|
||||
"lovely-colts-share",
|
||||
"lucky-cows-try",
|
||||
"lucky-months-guess",
|
||||
"lucky-years-turn",
|
||||
"mean-gorillas-reply",
|
||||
"modern-cameras-pull",
|
||||
"modern-ligers-behave",
|
||||
"moody-bags-walk",
|
||||
"moody-spoons-rhyme",
|
||||
"moody-squids-cheer",
|
||||
"nasty-suns-wash",
|
||||
"nervous-beds-travel",
|
||||
|
||||
2
.github/workflows/changeset_check.yml
vendored
2
.github/workflows/changeset_check.yml
vendored
@@ -10,7 +10,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
changeset:
|
||||
if: ${{ github.event.label.name != 'no-changeset' }}
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changeset') && github.event.pull_request.merged == false }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
|
||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -129,7 +129,7 @@ jobs:
|
||||
cd ./integration-tests
|
||||
tree -J -d -L 1 | jq -c '.[0].contents | map(.name | tostring) | map(select(. != "utils"))'
|
||||
folders=$(tree -J -d -L 1 | jq -c '.[0].contents | map(.name | tostring) | map(select(. != "utils"))')
|
||||
echo "::set-output name=folders::$folders"
|
||||
echo "folders=$folders" >> $GITHUB_OUTPUT
|
||||
|
||||
Integration-Tests:
|
||||
name: "Integration Test: ${{matrix.folder}} @ ${{ matrix.os }} "
|
||||
|
||||
@@ -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-394-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-395-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">
|
||||
@@ -729,6 +729,7 @@ Thanks to these wonderful people ([emoji key](https://allcontributors.org/docs/e
|
||||
<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="https://github.com/oloost"><img src="https://avatars.githubusercontent.com/u/72395941?v=4?s=100" width="100px;" alt=""/><br /><sub><b>oloost</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=oloost" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/janvennemann"><img src="https://avatars.githubusercontent.com/u/1406024?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jan Vennemann</b></sub></a><br /><a href="https://github.com/blitz-js/blitz/commits?author=janvennemann" title="Documentation">📖</a> <a href="https://github.com/blitz-js/blitz/commits?author=janvennemann" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export default resolver.pipe(
|
||||
resolver.zod(ChangePassword),
|
||||
resolver.authorize(),
|
||||
async ({ currentPassword, newPassword }, ctx) => {
|
||||
const user = await db.user.findFirst({ where: { id: ctx.session.userId as number } })
|
||||
const user = await db.user.findFirst({ where: { id: ctx.session.userId } })
|
||||
if (!user) throw new NotFoundError()
|
||||
|
||||
await authenticateUser(user.email, currentPassword)
|
||||
|
||||
@@ -2,6 +2,7 @@ import { setupBlitzServer } from "@blitzjs/next"
|
||||
import { AuthServerPlugin, PrismaStorage } from "@blitzjs/auth"
|
||||
import db from "db"
|
||||
import { simpleRolesIsAuthorized } from "@blitzjs/auth"
|
||||
import { BlitzLogger } from "blitz"
|
||||
|
||||
const { gSSP, gSP, api } = setupBlitzServer({
|
||||
plugins: [
|
||||
@@ -11,6 +12,7 @@ const { gSSP, gSP, api } = setupBlitzServer({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
export { gSSP, gSP, api }
|
||||
|
||||
@@ -5,7 +5,7 @@ export default async function getCurrentUser(_ = null, { session }: Ctx) {
|
||||
if (!session.userId) return null
|
||||
|
||||
const user = await db.user.findFirst({
|
||||
where: { id: session.userId as number },
|
||||
where: { id: session.userId },
|
||||
select: { id: true, name: true, email: true, role: true },
|
||||
})
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@hookform/resolvers": "2.8.8",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "workspace:2.0.0-beta.14",
|
||||
"next": "12.2.5",
|
||||
"openid-client": "5.1.8",
|
||||
"prisma": "4.0.0",
|
||||
@@ -49,7 +49,7 @@
|
||||
"@types/react": "18.0.17",
|
||||
"@typescript-eslint/eslint-plugin": "5.9.1",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-next": "12.2.0",
|
||||
"eslint-config-next": "12.3.1",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"husky": "7.0.4",
|
||||
"jest": "27.5.1",
|
||||
|
||||
@@ -9,7 +9,7 @@ export default resolver.pipe(
|
||||
resolver.zod(ChangePassword),
|
||||
resolver.authorize(),
|
||||
async ({ currentPassword, newPassword }, ctx) => {
|
||||
const user = await db.user.findFirst({ where: { id: ctx.session.userId as number } })
|
||||
const user = await db.user.findFirst({ where: { id: ctx.session.userId } })
|
||||
if (!user) throw new NotFoundError()
|
||||
|
||||
await authenticateUser(user.email, currentPassword)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { setupBlitzServer } from "@blitzjs/next"
|
||||
import { AuthServerPlugin, PrismaStorage } from "@blitzjs/auth"
|
||||
import db from "db"
|
||||
import { simpleRolesIsAuthorized } from "@blitzjs/auth"
|
||||
import { BlitzLogger } from "blitz"
|
||||
|
||||
const { gSSP, gSP, api } = setupBlitzServer({
|
||||
plugins: [
|
||||
@@ -12,6 +13,7 @@ const { gSSP, gSP, api } = setupBlitzServer({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
export { gSSP, gSP, api }
|
||||
|
||||
@@ -5,7 +5,7 @@ export default async function getCurrentUser(_ = null, { session }: Ctx) {
|
||||
if (!session.userId) return null
|
||||
|
||||
const user = await db.user.findFirst({
|
||||
where: { id: session.userId as number },
|
||||
where: { id: session.userId },
|
||||
select: { id: true, name: true, email: true, role: true },
|
||||
})
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"@blitzjs/rpc": "workspace:*",
|
||||
"@hookform/resolvers": "2.8.8",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "workspace:2.0.0-beta.14",
|
||||
"next": "12.2.5",
|
||||
"prisma": "4.0.0",
|
||||
"react": "18.2.0",
|
||||
@@ -48,7 +48,7 @@
|
||||
"@types/react": "18.0.17",
|
||||
"@typescript-eslint/eslint-plugin": "5.9.1",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-next": "12.2.0",
|
||||
"eslint-config-next": "12.3.1",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"husky": "7.0.4",
|
||||
"jest": "27.5.1",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useEffect, useState } from "react"
|
||||
import Layout from "app/core/layouts/Layout"
|
||||
import { LabeledTextField } from "app/core/components/LabeledTextField"
|
||||
import { Form, FORM_ERROR } from "app/core/components/Form"
|
||||
@@ -9,9 +10,14 @@ import { useMutation } from "@blitzjs/rpc"
|
||||
import Link from "next/link"
|
||||
|
||||
const ResetPasswordPage: BlitzPage = () => {
|
||||
const [token, setToken] = useState("")
|
||||
const router = useRouter()
|
||||
const [resetPasswordMutation, { isSuccess }] = useMutation(resetPassword)
|
||||
|
||||
useEffect(() => {
|
||||
setToken(router.query.token as string)
|
||||
}, [router.isReady])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Set a New Password</h1>
|
||||
@@ -30,11 +36,11 @@ const ResetPasswordPage: BlitzPage = () => {
|
||||
initialValues={{
|
||||
password: "",
|
||||
passwordConfirmation: "",
|
||||
token: router.query.token as string,
|
||||
token,
|
||||
}}
|
||||
onSubmit={async (values) => {
|
||||
try {
|
||||
await resetPasswordMutation(values)
|
||||
await resetPasswordMutation({ ...values, token })
|
||||
} catch (error: any) {
|
||||
if (error.name === "ResetPasswordError") {
|
||||
return {
|
||||
|
||||
@@ -7,6 +7,7 @@ import logout from "app/auth/mutations/logout"
|
||||
import logo from "public/logo.png"
|
||||
import { useMutation } from "@blitzjs/rpc"
|
||||
import { Routes, BlitzPage } from "@blitzjs/next"
|
||||
import { getSession, useSession } from "@blitzjs/auth"
|
||||
|
||||
/*
|
||||
* This file is just for a pleasant getting started page for your new app.
|
||||
@@ -271,6 +272,4 @@ const Home: BlitzPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
Home.authenticate = true
|
||||
|
||||
export default Home
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
|
||||
import db from "db"
|
||||
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import {BlitzLogger} from "blitz"
|
||||
import db from "db"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [
|
||||
@@ -11,6 +12,10 @@ const {gSSP, gSP, api} = setupBlitzServer({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({
|
||||
colorizePrettyLogs: true,
|
||||
prefix: ["[blitz]>>>>>"],
|
||||
}),
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
|
||||
@@ -2,6 +2,7 @@ import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
|
||||
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import db from "../db/index"
|
||||
import {BlitzLogger} from "blitz"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [
|
||||
@@ -11,6 +12,7 @@ const {gSSP, gSP, api} = setupBlitzServer({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@blitzjs/config": "workspace:*",
|
||||
"@blitzjs/next": "workspace:*",
|
||||
"@prisma/client": "4.0.0",
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "workspace:2.0.0-beta.14",
|
||||
"lowdb": "3.0.0",
|
||||
"next": "12.2.5",
|
||||
"prisma": "4.0.0",
|
||||
|
||||
@@ -2,6 +2,7 @@ import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
|
||||
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import db from "../db"
|
||||
import {BlitzLogger} from "blitz"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [
|
||||
@@ -11,6 +12,7 @@ const {gSSP, gSP, api} = setupBlitzServer({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {BlitzLogger} from "blitz"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
|
||||
@@ -2,6 +2,7 @@ import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
|
||||
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import db from "../db/index"
|
||||
import {BlitzLogger} from "blitz"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [
|
||||
@@ -11,6 +12,7 @@ const {gSSP, gSP, api} = setupBlitzServer({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
|
||||
@@ -2,6 +2,7 @@ import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
|
||||
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import db from "../db"
|
||||
import {BlitzLogger} from "blitz"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [
|
||||
@@ -11,6 +12,7 @@ const {gSSP, gSP, api} = setupBlitzServer({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
|
||||
@@ -2,6 +2,7 @@ import {setupBlitzServer} from "@blitzjs/next"
|
||||
import {AuthServerPlugin, PrismaStorage} from "@blitzjs/auth"
|
||||
import {simpleRolesIsAuthorized} from "@blitzjs/auth"
|
||||
import db from "../db"
|
||||
import {BlitzLogger} from "blitz"
|
||||
|
||||
const {gSSP, gSP, api} = setupBlitzServer({
|
||||
plugins: [
|
||||
@@ -11,6 +12,7 @@ const {gSSP, gSP, api} = setupBlitzServer({
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
logger: BlitzLogger({}),
|
||||
})
|
||||
|
||||
export {gSSP, gSP, api}
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @blitzjs/auth
|
||||
|
||||
## 2.0.0-beta.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [78fd5c48]
|
||||
- Updated dependencies [0a8b0cb3]
|
||||
- blitz@2.0.0-beta.14
|
||||
|
||||
## 2.0.0-beta.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a6e81f15]
|
||||
- Updated dependencies [6f434989]
|
||||
- blitz@2.0.0-beta.13
|
||||
|
||||
## 2.0.0-beta.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/auth",
|
||||
"version": "2.0.0-beta.12",
|
||||
"version": "2.0.0-beta.14",
|
||||
"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.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"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.12",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.14",
|
||||
"@testing-library/react": "13.0.0",
|
||||
"@testing-library/react-hooks": "7.0.2",
|
||||
"@types/cookie": "0.4.1",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# @blitzjs/next
|
||||
|
||||
## 2.0.0-beta.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @blitzjs/rpc@2.0.0-beta.14
|
||||
|
||||
## 2.0.0-beta.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a6e81f15: Add BlitzLogger plugin and allow customizing logging
|
||||
- Updated dependencies [7b63f0f1]
|
||||
- @blitzjs/rpc@2.0.0-beta.13
|
||||
|
||||
## 2.0.0-beta.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/next",
|
||||
"version": "2.0.0-beta.12",
|
||||
"version": "2.0.0-beta.14",
|
||||
"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.12",
|
||||
"@blitzjs/rpc": "2.0.0-beta.14",
|
||||
"@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.12",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.14",
|
||||
"@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.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"cross-spawn": "7.0.3",
|
||||
"find-up": "4.1.0",
|
||||
"next": "12.2.5",
|
||||
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
NextApiRequest,
|
||||
NextApiResponse,
|
||||
} from "next"
|
||||
import type {
|
||||
import {
|
||||
AddParameters,
|
||||
AsyncFunc,
|
||||
BlitzServerPlugin,
|
||||
@@ -15,6 +15,8 @@ import type {
|
||||
FirstParam,
|
||||
RequestMiddleware,
|
||||
MiddlewareResponse,
|
||||
BlitzLogger,
|
||||
initializeLogger,
|
||||
} from "blitz"
|
||||
import {handleRequestWithMiddleware, startWatcher, stopWatcher} from "blitz"
|
||||
import {
|
||||
@@ -50,6 +52,7 @@ export type NextApiHandler<TResult> = (
|
||||
type SetupBlitzOptions = {
|
||||
plugins: BlitzServerPlugin<RequestMiddleware, Ctx>[]
|
||||
onError?: (err: Error) => void
|
||||
logger: ReturnType<typeof BlitzLogger>
|
||||
}
|
||||
|
||||
export type Redirect =
|
||||
@@ -127,7 +130,9 @@ const prefetchQueryFactory = (
|
||||
}
|
||||
}
|
||||
|
||||
export const setupBlitzServer = ({plugins, onError}: SetupBlitzOptions) => {
|
||||
export const setupBlitzServer = ({plugins, onError, logger}: SetupBlitzOptions) => {
|
||||
initializeLogger(logger)
|
||||
|
||||
const middlewares = plugins.flatMap((p) => p.requestMiddlewares)
|
||||
const contextMiddleware = plugins.flatMap((p) => p.contextMiddleware).filter(Boolean)
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# @blitzjs/rpc
|
||||
|
||||
## 2.0.0-beta.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- @blitzjs/auth@2.0.0-beta.14
|
||||
|
||||
## 2.0.0-beta.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 7b63f0f1: Allow the updater function in setQueryData to return undefined to match react-query typings
|
||||
- @blitzjs/auth@2.0.0-beta.13
|
||||
|
||||
## 2.0.0-beta.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/rpc",
|
||||
"version": "2.0.0-beta.12",
|
||||
"version": "2.0.0-beta.14",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"predev": "wait-on -d 400 ../blitz/dist/index-server.d.ts && wait-on -d 400 ../blitz-auth/dist/index-browser.d.ts",
|
||||
@@ -20,7 +20,7 @@
|
||||
"dist/**"
|
||||
],
|
||||
"dependencies": {
|
||||
"@blitzjs/auth": "2.0.0-beta.12",
|
||||
"@blitzjs/auth": "2.0.0-beta.14",
|
||||
"@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.12",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.14",
|
||||
"@types/debug": "4.1.7",
|
||||
"@types/react": "18.0.17",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"blitz": "2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"next": "12.2.5",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
|
||||
@@ -186,7 +186,7 @@ export const invalidateQuery: InvalidateQueryType = (resolver, ...params: []) =>
|
||||
export function setQueryData<TInput, TResult, T extends AsyncFunc>(
|
||||
resolver: T | Resolver<TInput, TResult> | RpcClient<TInput, TResult>,
|
||||
params: TInput,
|
||||
newData: TResult | ((oldData: TResult | undefined) => TResult),
|
||||
newData: TResult | ((oldData: TResult | undefined) => TResult | undefined),
|
||||
opts: MutateOptions = {refetch: true},
|
||||
): Promise<void | ReturnType<ReturnType<typeof getQueryClient>["invalidateQueries"]>> {
|
||||
if (typeof resolver === "undefined") {
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
# blitz
|
||||
|
||||
## 2.0.0-beta.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 78fd5c48: Fix Blitz Install issue that gets stuck on "Generating file diff"
|
||||
- 0a8b0cb3: Fix Custom Server TS error - add `es6` target config to esbuild
|
||||
- Updated dependencies [54761393]
|
||||
- Updated dependencies [60de0574]
|
||||
- @blitzjs/generator@2.0.0-beta.14
|
||||
|
||||
## 2.0.0-beta.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a6e81f15: Add BlitzLogger plugin and allow customizing logging
|
||||
- 6f434989: Fix "Ambiguous class detected" errors reported by SuperJson by removing duplicated export from errors.ts file
|
||||
- Updated dependencies [4e26ae21]
|
||||
- @blitzjs/generator@2.0.0-beta.13
|
||||
|
||||
## 2.0.0-beta.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blitz",
|
||||
"version": "2.0.0-beta.12",
|
||||
"version": "2.0.0-beta.14",
|
||||
"scripts": {
|
||||
"build": "unbuild",
|
||||
"dev": "pnpm run predev && watch unbuild src --wait=0.2",
|
||||
@@ -25,7 +25,7 @@
|
||||
"blitz": "bin/blitz"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/generator": "2.0.0-beta.12",
|
||||
"@blitzjs/generator": "2.0.0-beta.14",
|
||||
"@mrleebo/prisma-ast": "0.2.6",
|
||||
"@types/global-agent": "2.1.1",
|
||||
"arg": "5.0.1",
|
||||
@@ -63,6 +63,7 @@
|
||||
"recast": "0.20.5",
|
||||
"resolve-cwd": "3.0.0",
|
||||
"resolve-from": "5.0.0",
|
||||
"rimraf": "3.0.2",
|
||||
"superjson": "1.9.1",
|
||||
"supports-color": "8.1.1",
|
||||
"tar": "6.1.11",
|
||||
@@ -72,7 +73,7 @@
|
||||
"watchpack": "2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.12",
|
||||
"@blitzjs/config": "workspace:2.0.0-beta.14",
|
||||
"@types/cookie": "0.4.1",
|
||||
"@types/cross-spawn": "6.0.2",
|
||||
"@types/debug": "4.1.7",
|
||||
|
||||
@@ -4,11 +4,14 @@ import prompts from "prompts"
|
||||
import {bootstrap} from "global-agent"
|
||||
import {baseLogger, log} from "../../logging"
|
||||
const debug = require("debug")("blitz:cli")
|
||||
import {join, resolve} from "path"
|
||||
import {join, resolve, dirname} from "path"
|
||||
import {Stream} from "stream"
|
||||
import {promisify} from "util"
|
||||
import {RecipeCLIFlags, RecipeExecutor} from "../../installer"
|
||||
import {setupTsnode} from "../utils/setup-ts-node"
|
||||
import {isInternalBlitzMonorepoDevelopment} from "../utils/helpers"
|
||||
import findUp from "find-up"
|
||||
import resolveFrom from "resolve-from"
|
||||
|
||||
interface GlobalAgent {
|
||||
HTTP_PROXY?: string
|
||||
@@ -62,8 +65,9 @@ const requireJSON = (file: string) => {
|
||||
return JSON.parse(require("fs-extra").readFileSync(file).toString("utf-8"))
|
||||
}
|
||||
|
||||
const checkLockFileExists = (filename: string) => {
|
||||
return require("fs-extra").existsSync(resolve(filename))
|
||||
const checkLockFileExists = async (filename: string) => {
|
||||
const dotBlitz = join(await findNodeModulesRoot(process.cwd()), ".blitz")
|
||||
return require("fs-extra").existsSync(resolve(join(dotBlitz, "..", "..", filename)))
|
||||
}
|
||||
|
||||
const GH_ROOT = "https://github.com/"
|
||||
@@ -153,13 +157,39 @@ const normalizeRecipePath = (recipeArg: string): RecipeMeta => {
|
||||
}
|
||||
}
|
||||
|
||||
async function findNodeModulesRoot(src: string) {
|
||||
let root: string
|
||||
if (isInternalBlitzMonorepoDevelopment) {
|
||||
root = join(__dirname, "..", "..", "..", "..", "/node_modules")
|
||||
} else {
|
||||
const blitzPkgLocation = dirname(
|
||||
(await findUp("package.json", {
|
||||
cwd: resolveFrom(src, "blitz"),
|
||||
})) ?? "",
|
||||
)
|
||||
|
||||
if (!blitzPkgLocation) {
|
||||
throw new Error("Internal Blitz Error: unable to find 'blitz' package location")
|
||||
}
|
||||
|
||||
if (blitzPkgLocation.includes(".pnpm")) {
|
||||
root = join(blitzPkgLocation, "../../../../")
|
||||
} else {
|
||||
root = join(blitzPkgLocation, "../")
|
||||
}
|
||||
}
|
||||
|
||||
return root
|
||||
}
|
||||
|
||||
const cloneRepo = async (
|
||||
repoFullName: string,
|
||||
defaultBranch: string,
|
||||
subdirectory?: string,
|
||||
): Promise<string> => {
|
||||
debug("[cloneRepo] starting...")
|
||||
const recipeDir = join(process.cwd(), ".blitz", "recipe-install")
|
||||
const dotBlitz = join(await findNodeModulesRoot(process.cwd()), ".blitz")
|
||||
const recipeDir = join(dotBlitz, "..", "..", "recipe-install")
|
||||
// clean up from previous run in case of error
|
||||
require("rimraf").sync(recipeDir)
|
||||
require("fs-extra").mkdirsSync(recipeDir)
|
||||
@@ -206,7 +236,6 @@ const setupProxySupport = async () => {
|
||||
|
||||
const install: CliCommand = async () => {
|
||||
setupTsnode()
|
||||
|
||||
let selectedRecipe: string | null = args._[1] ? `${args._[1]}` : null
|
||||
await setupProxySupport()
|
||||
|
||||
@@ -281,10 +310,10 @@ ${chalk.dim("- Available recipes listed at https://github.com/blitz-js/blitz/tre
|
||||
let pkgManager = "npm"
|
||||
let installArgs = ["install", "--legacy-peer-deps", "--ignore-scripts"]
|
||||
|
||||
if (checkLockFileExists("yarn.lock")) {
|
||||
if (await checkLockFileExists("yarn.lock")) {
|
||||
pkgManager = "yarn"
|
||||
installArgs = ["install", "--ignore-scripts"]
|
||||
} else if (checkLockFileExists("pnpm-lock.yaml")) {
|
||||
} else if (await checkLockFileExists("pnpm-lock.yaml")) {
|
||||
pkgManager = "pnpm"
|
||||
installArgs = ["install", "--ignore-scripts"]
|
||||
}
|
||||
@@ -297,7 +326,7 @@ ${chalk.dim("- Available recipes listed at https://github.com/blitz-js/blitz/tre
|
||||
|
||||
const recipePackageMain = requireJSON("./package.json").main
|
||||
const recipeEntry = resolve(recipePackageMain)
|
||||
process.chdir(process.cwd())
|
||||
process.chdir(join(process.cwd(), ".."))
|
||||
|
||||
await installRecipeAtPath(recipeEntry, cliArgs, cliFlags)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import os from "os"
|
||||
import path from "path"
|
||||
import * as REPL from "repl"
|
||||
import {REPLCommand, REPLServer} from "repl"
|
||||
// eslint-disable-next-line @next/next/no-assign-module-variable
|
||||
const debug = require("debug")("blitz:repl")
|
||||
import ProgressBar from "progress"
|
||||
import {log} from "../../logging"
|
||||
@@ -58,6 +59,7 @@ export const forceRequire = (modulePath: string) => {
|
||||
})
|
||||
|
||||
if (isTypeScript) {
|
||||
// eslint-disable-next-line @next/next/no-assign-module-variable
|
||||
const module = require(modulePath)
|
||||
unregister()
|
||||
return module
|
||||
@@ -115,6 +117,7 @@ export const loadBlitz = async (onlyDb: boolean, module = "") => {
|
||||
|
||||
try {
|
||||
debug("Loading", modulePath)
|
||||
// eslint-disable-next-line @next/next/no-assign-module-variable
|
||||
const module = forceRequire(modulePath)
|
||||
const contextObj = module.default || module
|
||||
// debug("ContextObj", contextObj)
|
||||
@@ -172,7 +175,7 @@ const setupSelfRolledHistory = (repl: any, path: string) => {
|
||||
const history = fs.readFileSync(path, {encoding: "utf8"})
|
||||
const nonEmptyLines = history.split(os.EOL).filter((line) => line.trim())
|
||||
repl.history.push(...nonEmptyLines.reverse())
|
||||
} catch (err: any) {
|
||||
} catch (err) {
|
||||
if (err.code !== "ENOENT") {
|
||||
throw err
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ const getEsbuildOptions = (): esbuild.BuildOptions => {
|
||||
entryPoints: [getCustomServerPath()],
|
||||
outfile: getCustomServerBuildPath(),
|
||||
format: "cjs",
|
||||
target: "es6",
|
||||
bundle: true,
|
||||
platform: "node",
|
||||
external: [
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
import "./global"
|
||||
import {ComponentType} from "react"
|
||||
import {IncomingMessage, ServerResponse} from "http"
|
||||
import {AuthenticationError, AuthorizationError, NotFoundError, RedirectError} from "./errors"
|
||||
import {
|
||||
AuthenticationError,
|
||||
AuthorizationError,
|
||||
CSRFTokenMismatchError,
|
||||
NotFoundError,
|
||||
PaginationArgumentError,
|
||||
RedirectError,
|
||||
} from "./errors"
|
||||
export {
|
||||
AuthenticationError,
|
||||
AuthorizationError,
|
||||
CSRFTokenMismatchError,
|
||||
NotFoundError,
|
||||
PaginationArgumentError,
|
||||
RedirectError,
|
||||
}
|
||||
|
||||
export type BlitzProviderComponentType = <TProps = any>(
|
||||
component: ComponentType<TProps>,
|
||||
@@ -80,6 +95,5 @@ if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
||||
|
||||
export * from "./utils"
|
||||
export * from "./types"
|
||||
export * from "./errors"
|
||||
export * from "./utils/zod"
|
||||
export * from "./utils/prisma"
|
||||
|
||||
@@ -7,7 +7,7 @@ export * from "./types"
|
||||
export * from "./utils/run-prisma"
|
||||
export * from "./middleware"
|
||||
export * from "./paginate"
|
||||
export {baseLogger, newLine, log} from "./logging"
|
||||
export * from "./logging"
|
||||
export {startWatcher, stopWatcher} from "./cli/utils/routes-manifest"
|
||||
|
||||
export interface MiddlewareResponse<C extends Ctx = Ctx> extends ServerResponse {
|
||||
|
||||
@@ -1,47 +1,29 @@
|
||||
import {ISettingsParam, Logger} from "tslog"
|
||||
import {ISettingsParam, Logger, TLogLevelName} from "tslog"
|
||||
import c from "chalk"
|
||||
import {Table} from "console-table-printer"
|
||||
import ora from "ora"
|
||||
import readline from "readline"
|
||||
|
||||
export type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal"
|
||||
export type BlitzLoggerSettings = ISettingsParam
|
||||
export type BlitzLogLevel = TLogLevelName
|
||||
|
||||
declare module globalThis {
|
||||
declare namespace globalThis {
|
||||
let _blitz_baseLogger: Logger
|
||||
let _blitz_logLevel: LogLevel
|
||||
let _blitz_logLevel: BlitzLogLevel
|
||||
}
|
||||
|
||||
export const newLine = () => {
|
||||
const logLevel: LogLevel = globalThis._blitz_logLevel
|
||||
|
||||
switch (logLevel) {
|
||||
case "trace":
|
||||
case "debug":
|
||||
case "info":
|
||||
console.log(" ")
|
||||
break
|
||||
case "warn":
|
||||
case "error":
|
||||
case "fatal":
|
||||
default:
|
||||
//nothing
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
export const baseLogger = (options?: ISettingsParam): Logger => {
|
||||
export const baseLogger = (options: BlitzLoggerSettings = {}): Logger => {
|
||||
if (globalThis._blitz_baseLogger) return globalThis._blitz_baseLogger
|
||||
|
||||
let config
|
||||
try {
|
||||
config = {} as any // todo: loadConfigAtRuntime()
|
||||
} catch {
|
||||
config = {}
|
||||
}
|
||||
globalThis._blitz_baseLogger = BlitzLogger(options)
|
||||
|
||||
globalThis._blitz_baseLogger = new Logger({
|
||||
minLevel: config?.log?.level || "info",
|
||||
type: config?.log?.type || "pretty",
|
||||
return globalThis._blitz_baseLogger
|
||||
}
|
||||
|
||||
export const BlitzLogger = (settings: BlitzLoggerSettings = {}) => {
|
||||
const baseLogger = new Logger({
|
||||
minLevel: "info",
|
||||
type: "pretty",
|
||||
dateTimePattern:
|
||||
process.env.NODE_ENV === "production"
|
||||
? "year-month-day hour:minute:second.millisecond"
|
||||
@@ -61,10 +43,14 @@ export const baseLogger = (options?: ISettingsParam): Logger => {
|
||||
},
|
||||
maskValuesOfKeys: ["password", "passwordConfirmation"],
|
||||
exposeErrorCodeFrame: process.env.NODE_ENV !== "production",
|
||||
...options,
|
||||
...settings,
|
||||
})
|
||||
|
||||
return globalThis._blitz_baseLogger
|
||||
return baseLogger
|
||||
}
|
||||
|
||||
export const initializeLogger = (logger: Logger) => {
|
||||
globalThis._blitz_baseLogger = logger
|
||||
}
|
||||
|
||||
export const table = Table
|
||||
@@ -76,6 +62,24 @@ const blitzBrightBrandColor = "8a3df0"
|
||||
// Using bright brand color so it's better for dark terminals
|
||||
const brandColor = blitzBrightBrandColor
|
||||
|
||||
export const newLine = () => {
|
||||
const logLevel: BlitzLogLevel = globalThis._blitz_logLevel
|
||||
|
||||
switch (logLevel) {
|
||||
case "trace":
|
||||
case "debug":
|
||||
case "info":
|
||||
console.log(" ")
|
||||
break
|
||||
case "warn":
|
||||
case "error":
|
||||
case "fatal":
|
||||
default:
|
||||
//nothing
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const withBrand = (str: string) => {
|
||||
return c.hex(brandColor).bold(str)
|
||||
}
|
||||
|
||||
@@ -56,61 +56,6 @@ export async function handleRequestWithMiddleware<
|
||||
}
|
||||
}
|
||||
|
||||
// export type InvokeWithMiddlewareConfig = {
|
||||
// req: IncomingMessage
|
||||
// res: ServerResponse
|
||||
// middleware?: Middleware[]
|
||||
// [prop: string]: any
|
||||
// }
|
||||
|
||||
// export async function invokeWithMiddleware<
|
||||
// T extends AsyncFunc,
|
||||
// TInput = FirstParam<T>,
|
||||
// TResult = PromiseReturnType<T>
|
||||
// >(
|
||||
// resolver: T,
|
||||
// params: TInput,
|
||||
// ctx: InvokeWithMiddlewareConfig
|
||||
// ): Promise<TResult> {
|
||||
// if (!ctx.req) {
|
||||
// throw new Error(
|
||||
// 'You must provide `req` in third argument of invokeWithMiddleware()'
|
||||
// )
|
||||
// }
|
||||
// if (!ctx.res) {
|
||||
// throw new Error(
|
||||
// 'You must provide `res` in third argument of invokeWithMiddleware()'
|
||||
// )
|
||||
// }
|
||||
|
||||
// const rpcResolver = (resolver as unknown) as any // todo: as RpcResolver
|
||||
|
||||
// const resolverName =
|
||||
// rpcResolver._resolverName ?? (rpcResolver as any).default?._resolverName
|
||||
|
||||
// try {
|
||||
// // todo
|
||||
// // const log = baseLogger().getChildLogger({
|
||||
// // prefix: [resolverName + '()'],
|
||||
// // })
|
||||
// console.log("\n")
|
||||
// console.info(chalk.dim('Starting with input:'), params)
|
||||
// const startTime = Date.now()
|
||||
|
||||
// const result = await interopDefault(rpcResolver)(params, res.blitzCtx)
|
||||
|
||||
// const duration = Date.now() - startTime
|
||||
// console.info(chalk.dim(`Finished in ${prettyMs(duration)}`))
|
||||
// console.log("/n")
|
||||
|
||||
// res.blitzResult = result // todo: remove?
|
||||
// } catch (error) {
|
||||
// throw error
|
||||
// }
|
||||
|
||||
// return (ctx.res as MiddlewareResponse).blitzResult as TResult
|
||||
// }
|
||||
|
||||
/**
|
||||
* If the middleware function doesn't declare receiving the `next` callback
|
||||
* assume that it's synchronous and invoke `next` ourselves
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
# @blitzjs/codemod
|
||||
|
||||
## 2.0.0-beta.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [54761393]
|
||||
- Updated dependencies [78fd5c48]
|
||||
- Updated dependencies [60de0574]
|
||||
- Updated dependencies [0a8b0cb3]
|
||||
- @blitzjs/generator@2.0.0-beta.14
|
||||
- blitz@2.0.0-beta.14
|
||||
|
||||
## 2.0.0-beta.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [a6e81f15]
|
||||
- Updated dependencies [6f434989]
|
||||
- Updated dependencies [4e26ae21]
|
||||
- blitz@2.0.0-beta.13
|
||||
- @blitzjs/generator@2.0.0-beta.13
|
||||
|
||||
## 2.0.0-beta.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/codemod",
|
||||
"version": "2.0.0-beta.12",
|
||||
"version": "2.0.0-beta.14",
|
||||
"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.12",
|
||||
"@blitzjs/generator": "2.0.0-beta.14",
|
||||
"arg": "5.0.1",
|
||||
"blitz": "2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"chalk": "^4.1.0",
|
||||
"cross-spawn": "7.0.3",
|
||||
"debug": "4.3.3",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @blitzjs/config
|
||||
|
||||
## 2.0.0-beta.14
|
||||
|
||||
## 2.0.0-beta.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4e26ae21: Upgrade eslint-config-next in new app templates to fix linting issues on blitz build
|
||||
|
||||
## 2.0.0-beta.12
|
||||
|
||||
## 2.0.0-beta.11
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@blitzjs/config",
|
||||
"private": true,
|
||||
"version": "2.0.0-beta.12",
|
||||
"version": "2.0.0-beta.14",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "5.9.1",
|
||||
"@typescript-eslint/parser": "5.9.1",
|
||||
"eslint-config-next": "12.2.0",
|
||||
"eslint-config-next": "12.3.1",
|
||||
"eslint-config-prettier": "8.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# @blitzjs/generator
|
||||
|
||||
## 2.0.0-beta.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 54761393: Remove unnecessary `as number` assertions from new app templates
|
||||
- 60de0574: Fix reset token being undefined when passed to the resetPassword mutation
|
||||
|
||||
## 2.0.0-beta.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 4e26ae21: Upgrade eslint-config-next in new app templates to fix linting issues on blitz build
|
||||
|
||||
## 2.0.0-beta.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@blitzjs/generator",
|
||||
"version": "2.0.0-beta.12",
|
||||
"version": "2.0.0-beta.14",
|
||||
"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.12",
|
||||
"@blitzjs/config": "2.0.0-beta.14",
|
||||
"@juanm04/cpx": "2.0.1",
|
||||
"@types/babel__core": "7.1.19",
|
||||
"@types/diff": "5.0.2",
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import { NotFoundError, AuthenticationError } from "blitz"
|
||||
import { resolver } from "@blitzjs/rpc"
|
||||
import { SecurePassword } from "@blitzjs/auth"
|
||||
import db from "db"
|
||||
import { authenticateUser } from "./login"
|
||||
import { ChangePassword } from "../validations"
|
||||
import { NotFoundError, AuthenticationError } from 'blitz'
|
||||
import { resolver } from '@blitzjs/rpc'
|
||||
import { SecurePassword } from '@blitzjs/auth'
|
||||
import db from 'db'
|
||||
import { authenticateUser } from './login'
|
||||
import { ChangePassword } from '../validations'
|
||||
|
||||
export default resolver.pipe(
|
||||
resolver.zod(ChangePassword),
|
||||
resolver.authorize(),
|
||||
async ({ currentPassword, newPassword }, ctx) => {
|
||||
const user = await db.user.findFirst({ where: { id: ctx.session.userId as number } })
|
||||
const user = await db.user.findFirst({ where: { id: ctx.session.userId } })
|
||||
if (!user) throw new NotFoundError()
|
||||
|
||||
try {
|
||||
try {
|
||||
await authenticateUser(user.email, currentPassword)
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
if (error instanceof AuthenticationError) {
|
||||
throw new Error("Invalid Password")
|
||||
throw new Error('Invalid Password')
|
||||
}
|
||||
throw error
|
||||
}
|
||||
@@ -28,5 +28,5 @@ export default resolver.pipe(
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import { setupBlitzServer } from "@blitzjs/next"
|
||||
import { AuthServerPlugin, PrismaStorage } from "@blitzjs/auth"
|
||||
import { simpleRolesIsAuthorized } from "@blitzjs/auth"
|
||||
import db from "db"
|
||||
import { authConfig } from "./blitz-client"
|
||||
import { setupBlitzServer } from '@blitzjs/next';
|
||||
import { AuthServerPlugin, PrismaStorage } from '@blitzjs/auth';
|
||||
import { simpleRolesIsAuthorized } from '@blitzjs/auth';
|
||||
import { BlitzLogger } from 'blitz';
|
||||
import db from 'db';
|
||||
import { authConfig } from './blitz-client';
|
||||
|
||||
export const { gSSP, gSP, api } = setupBlitzServer({
|
||||
plugins: [
|
||||
AuthServerPlugin({
|
||||
...authConfig,
|
||||
storage: PrismaStorage(db),
|
||||
isAuthorized: simpleRolesIsAuthorized,
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
plugins: [
|
||||
AuthServerPlugin({
|
||||
...authConfig,
|
||||
storage: PrismaStorage(db),
|
||||
isAuthorized: simpleRolesIsAuthorized
|
||||
})
|
||||
],
|
||||
logger: BlitzLogger({})
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Ctx } from "blitz"
|
||||
import db from "db"
|
||||
import { Ctx } from 'blitz'
|
||||
import db from 'db'
|
||||
|
||||
export default async function getCurrentUser(_ = null, { session }: Ctx) {
|
||||
if (!session.userId) return null
|
||||
|
||||
const user = await db.user.findFirst({
|
||||
where: { id: session.userId as number },
|
||||
where: { id: session.userId },
|
||||
select: { id: true, name: true, email: true, role: true },
|
||||
})
|
||||
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@testing-library/jest-dom": "5.16.3",
|
||||
"@testing-library/react": "13.4.0",
|
||||
"@testing-library/react-hooks": "8.0.1",
|
||||
"@testing-library/react-hooks": "8.0.1",
|
||||
"@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.17",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-next": "12.2.0",
|
||||
"eslint-config-next": "12.3.1",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"husky": "7.0.4",
|
||||
"jest": "27.5.1",
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
"@next/bundle-analyzer": "12.0.8",
|
||||
"@testing-library/jest-dom": "5.16.3",
|
||||
"@testing-library/react": "13.4.0",
|
||||
"@testing-library/react-hooks": "8.0.1",
|
||||
"@testing-library/react-hooks": "8.0.1",
|
||||
"@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.17",
|
||||
"@typescript-eslint/eslint-plugin": "5.30.5",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-next": "12.2.0",
|
||||
"eslint-config-next": "12.3.1",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"husky": "7.0.4",
|
||||
"jest": "27.5.1",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useEffect, useState } from "react"
|
||||
import Layout from "app/core/layouts/Layout"
|
||||
import { LabeledTextField } from "app/core/components/LabeledTextField"
|
||||
import { Form, FORM_ERROR } from "app/core/components/Form"
|
||||
@@ -9,9 +10,14 @@ import { useMutation } from "@blitzjs/rpc"
|
||||
import Link from "next/link"
|
||||
|
||||
const ResetPasswordPage: BlitzPage = () => {
|
||||
const [token, setToken] = useState("")
|
||||
const router = useRouter()
|
||||
const [resetPasswordMutation, { isSuccess }] = useMutation(resetPassword)
|
||||
|
||||
useEffect(() => {
|
||||
setToken(router.query.token as string)
|
||||
}, [router.isReady])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Set a New Password</h1>
|
||||
@@ -27,10 +33,14 @@ const ResetPasswordPage: BlitzPage = () => {
|
||||
<Form
|
||||
submitText="Reset Password"
|
||||
schema={ResetPassword}
|
||||
initialValues={{ password: "", passwordConfirmation: "", token: router.query.token as string }}
|
||||
initialValues={{
|
||||
password: "",
|
||||
passwordConfirmation: "",
|
||||
token,
|
||||
}}
|
||||
onSubmit={async (values) => {
|
||||
try {
|
||||
await resetPasswordMutation(values)
|
||||
await resetPasswordMutation({...values, token})
|
||||
} catch (error: any) {
|
||||
if (error.name === "ResetPasswordError") {
|
||||
return {
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
"@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.17",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-next": "12.2.0",
|
||||
"eslint-config-next": "12.3.1",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"husky": "7.0.4",
|
||||
"jest": "27.5.1",
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
"printWidth": 100
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,tsx}": [
|
||||
"eslint --fix"
|
||||
]
|
||||
"*.{js,ts,tsx}": ["eslint --fix"]
|
||||
},
|
||||
"dependencies": {
|
||||
"@blitzjs/next": "latest",
|
||||
@@ -32,11 +30,11 @@
|
||||
"@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.17",
|
||||
"@typescript-eslint/eslint-plugin": "5.30.5",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"eslint-config-next": "12.2.0",
|
||||
"eslint-config-next": "12.3.1",
|
||||
"husky": "7.0.4",
|
||||
"jest": "27.5.1",
|
||||
"lint-staged": "12.1.7",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@typescript-eslint/parser": "5.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@blitzjs/config": "2.0.0-beta.12",
|
||||
"@blitzjs/config": "2.0.0-beta.14",
|
||||
"@types/react": "18.0.17",
|
||||
"@types/react-dom": "17.0.14",
|
||||
"react": "18.2.0",
|
||||
|
||||
275
pnpm-lock.yaml
generated
275
pnpm-lock.yaml
generated
@@ -49,9 +49,9 @@ 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.11
|
||||
blitz: workspace:2.0.0-beta.13
|
||||
eslint: 7.32.0
|
||||
eslint-config-next: 12.2.0
|
||||
eslint-config-next: 12.3.1
|
||||
eslint-config-prettier: 8.5.0
|
||||
husky: 7.0.4
|
||||
jest: 27.5.1
|
||||
@@ -93,7 +93,7 @@ importers:
|
||||
"@types/react": 18.0.17
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1_hrkuebk64jiu2ut2d2sm4oylnu
|
||||
eslint: 7.32.0
|
||||
eslint-config-next: 12.2.0_hrkuebk64jiu2ut2d2sm4oylnu
|
||||
eslint-config-next: 12.3.1_hrkuebk64jiu2ut2d2sm4oylnu
|
||||
eslint-config-prettier: 8.5.0_eslint@7.32.0
|
||||
husky: 7.0.4
|
||||
jest: 27.5.1_ts-node@10.7.0
|
||||
@@ -120,9 +120,9 @@ 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.11
|
||||
blitz: workspace:2.0.0-beta.13
|
||||
eslint: 7.32.0
|
||||
eslint-config-next: 12.2.0
|
||||
eslint-config-next: 12.3.1
|
||||
eslint-config-prettier: 8.5.0
|
||||
husky: 7.0.4
|
||||
jest: 27.5.1
|
||||
@@ -166,7 +166,7 @@ importers:
|
||||
"@types/react": 18.0.17
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1_hxadhbs2xogijvk7vq4t2azzbu
|
||||
eslint: 7.32.0
|
||||
eslint-config-next: 12.2.0_hxadhbs2xogijvk7vq4t2azzbu
|
||||
eslint-config-next: 12.3.1_hxadhbs2xogijvk7vq4t2azzbu
|
||||
eslint-config-prettier: 8.5.0_eslint@7.32.0
|
||||
husky: 7.0.4
|
||||
jest: 27.5.1_ts-node@10.7.0
|
||||
@@ -235,7 +235,7 @@ importers:
|
||||
"@types/node-fetch": 2.6.1
|
||||
"@types/react": 18.0.17
|
||||
b64-lite: 1.4.0
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: workspace:2.0.0-beta.13
|
||||
eslint: 7.32.0
|
||||
fs-extra: 10.0.1
|
||||
get-port: 6.1.2
|
||||
@@ -650,8 +650,8 @@ importers:
|
||||
|
||||
packages/blitz:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-beta.11
|
||||
"@blitzjs/generator": 2.0.0-beta.11
|
||||
"@blitzjs/config": workspace:2.0.0-beta.13
|
||||
"@blitzjs/generator": 2.0.0-beta.13
|
||||
"@mrleebo/prisma-ast": 0.2.6
|
||||
"@types/cookie": 0.4.1
|
||||
"@types/cross-spawn": 6.0.2
|
||||
@@ -708,6 +708,7 @@ importers:
|
||||
recast: 0.20.5
|
||||
resolve-cwd: 3.0.0
|
||||
resolve-from: 5.0.0
|
||||
rimraf: 3.0.2
|
||||
superjson: 1.9.1
|
||||
supports-color: 8.1.1
|
||||
tar: 6.1.11
|
||||
@@ -759,6 +760,7 @@ importers:
|
||||
recast: 0.20.5
|
||||
resolve-cwd: 3.0.0
|
||||
resolve-from: 5.0.0
|
||||
rimraf: 3.0.2
|
||||
superjson: 1.9.1
|
||||
supports-color: 8.1.1
|
||||
tar: 6.1.11
|
||||
@@ -795,7 +797,7 @@ importers:
|
||||
|
||||
packages/blitz-auth:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-beta.11
|
||||
"@blitzjs/config": workspace:2.0.0-beta.13
|
||||
"@testing-library/react": 13.0.0
|
||||
"@testing-library/react-hooks": 7.0.2
|
||||
"@types/b64-lite": 1.3.0
|
||||
@@ -809,7 +811,7 @@ importers:
|
||||
"@types/secure-password": 3.1.1
|
||||
b64-lite: 1.4.0
|
||||
bad-behavior: 1.0.1
|
||||
blitz: 2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
cookie: 0.4.1
|
||||
cookie-session: 2.0.0
|
||||
debug: 4.3.3
|
||||
@@ -862,8 +864,8 @@ importers:
|
||||
|
||||
packages/blitz-next:
|
||||
specifiers:
|
||||
"@blitzjs/config": workspace:2.0.0-beta.11
|
||||
"@blitzjs/rpc": 2.0.0-beta.11
|
||||
"@blitzjs/config": workspace:2.0.0-beta.13
|
||||
"@blitzjs/rpc": 2.0.0-beta.13
|
||||
"@tanstack/react-query": 4.0.10
|
||||
"@testing-library/dom": 8.13.0
|
||||
"@testing-library/jest-dom": 5.16.3
|
||||
@@ -875,7 +877,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.11
|
||||
blitz: 2.0.0-beta.13
|
||||
cross-spawn: 7.0.3
|
||||
debug: 4.3.3
|
||||
find-up: 4.1.0
|
||||
@@ -925,15 +927,15 @@ importers:
|
||||
|
||||
packages/blitz-rpc:
|
||||
specifiers:
|
||||
"@blitzjs/auth": 2.0.0-beta.11
|
||||
"@blitzjs/config": workspace:2.0.0-beta.11
|
||||
"@blitzjs/auth": 2.0.0-beta.13
|
||||
"@blitzjs/config": workspace:2.0.0-beta.13
|
||||
"@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.11
|
||||
blitz: 2.0.0-beta.13
|
||||
chalk: ^4.1.0
|
||||
debug: 4.3.3
|
||||
next: 12.2.5
|
||||
@@ -976,12 +978,12 @@ importers:
|
||||
"@babel/plugin-syntax-typescript": 7.17.12
|
||||
"@babel/preset-env": 7.12.10
|
||||
"@blitzjs/config": workspace:*
|
||||
"@blitzjs/generator": 2.0.0-beta.11
|
||||
"@blitzjs/generator": 2.0.0-beta.13
|
||||
"@types/jscodeshift": 0.11.2
|
||||
"@types/node": 17.0.16
|
||||
arg: 5.0.1
|
||||
ast-types: 0.14.2
|
||||
blitz: 2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
chalk: ^4.1.0
|
||||
cross-spawn: 7.0.3
|
||||
debug: 4.3.3
|
||||
@@ -1019,13 +1021,13 @@ importers:
|
||||
specifiers:
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1
|
||||
"@typescript-eslint/parser": 5.9.1
|
||||
eslint-config-next: 12.2.0
|
||||
eslint-config-next: 12.3.1
|
||||
eslint-config-prettier: 8.5.0
|
||||
typescript: ^4.5.3
|
||||
dependencies:
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1_z2xqbpkx26iu62rx2zdto5f5qy
|
||||
"@typescript-eslint/parser": 5.9.1_typescript@4.6.3
|
||||
eslint-config-next: 12.2.0_typescript@4.6.3
|
||||
eslint-config-next: 12.3.1_typescript@4.6.3
|
||||
eslint-config-prettier: 8.5.0
|
||||
devDependencies:
|
||||
typescript: 4.6.3
|
||||
@@ -1036,7 +1038,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.11
|
||||
"@blitzjs/config": 2.0.0-beta.13
|
||||
"@juanm04/cpx": 2.0.1
|
||||
"@mrleebo/prisma-ast": 0.4.1
|
||||
"@types/babel__core": 7.1.19
|
||||
@@ -1129,7 +1131,7 @@ importers:
|
||||
|
||||
packages/pkg-template:
|
||||
specifiers:
|
||||
"@blitzjs/config": 2.0.0-beta.11
|
||||
"@blitzjs/config": 2.0.0-beta.13
|
||||
"@types/react": 18.0.17
|
||||
"@types/react-dom": 17.0.14
|
||||
"@typescript-eslint/eslint-plugin": 5.9.1
|
||||
@@ -1153,7 +1155,7 @@ importers:
|
||||
recipes/base-web:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1164,7 +1166,7 @@ importers:
|
||||
recipes/bulma:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1176,7 +1178,7 @@ importers:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
ast-types: 0.14.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1189,7 +1191,7 @@ importers:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
ast-types: 0.14.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1201,7 +1203,7 @@ importers:
|
||||
recipes/emotion:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1211,20 +1213,20 @@ importers:
|
||||
|
||||
recipes/gh-action-yarn-mariadb:
|
||||
specifiers:
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
|
||||
recipes/gh-action-yarn-postgres:
|
||||
specifiers:
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
|
||||
recipes/ghost:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1235,7 +1237,7 @@ importers:
|
||||
recipes/graphql-apollo-server:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
uuid: ^8.3.1
|
||||
dependencies:
|
||||
@@ -1247,14 +1249,19 @@ importers:
|
||||
|
||||
recipes/logrocket:
|
||||
specifiers:
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
jscodeshift: 0.13.0
|
||||
devDependencies:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
|
||||
recipes/material-ui:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1266,7 +1273,7 @@ importers:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
ast-types: 0.14.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1277,13 +1284,13 @@ importers:
|
||||
|
||||
recipes/passenger:
|
||||
specifiers:
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
|
||||
recipes/quirrel:
|
||||
specifiers:
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
|
||||
@@ -1291,7 +1298,7 @@ importers:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
ast-types: 0.14.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1302,14 +1309,14 @@ importers:
|
||||
|
||||
recipes/render:
|
||||
specifiers:
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
|
||||
recipes/secureheaders:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
uuid: ^8.3.1
|
||||
dependencies:
|
||||
@@ -1322,7 +1329,7 @@ importers:
|
||||
recipes/stitches:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1334,7 +1341,7 @@ importers:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
ast-types: 0.14.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1346,7 +1353,7 @@ importers:
|
||||
recipes/tailwind:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1358,7 +1365,7 @@ importers:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
ast-types: 0.14.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -1370,7 +1377,7 @@ importers:
|
||||
recipes/vanilla-extract:
|
||||
specifiers:
|
||||
"@types/jscodeshift": 0.11.2
|
||||
blitz: workspace:2.0.0-beta.11
|
||||
blitz: 2.0.0-beta.13
|
||||
jscodeshift: 0.13.0
|
||||
dependencies:
|
||||
blitz: link:../../packages/blitz
|
||||
@@ -4492,14 +4499,6 @@ packages:
|
||||
integrity: sha512-vLPLV3cpPGjUPT3PjgRj7e3nio9t6USkuew3JE/jMeon/9Mvp1WyR18v3iwnCuX7eUAm1HmAbJHHLAbcu/EJcw==,
|
||||
}
|
||||
|
||||
/@next/eslint-plugin-next/12.2.0:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-nIj5xV/z3dOfeBnE7qFAjUQZAi4pTlIMuusRM6s/T6lOz8x7mjY5s1ZkTUBmcjPVCb2VIv3CrMH0WZL6xfjZZg==,
|
||||
}
|
||||
dependencies:
|
||||
glob: 7.1.7
|
||||
|
||||
/@next/eslint-plugin-next/12.3.1:
|
||||
resolution:
|
||||
{
|
||||
@@ -4507,7 +4506,6 @@ packages:
|
||||
}
|
||||
dependencies:
|
||||
glob: 7.1.7
|
||||
dev: true
|
||||
|
||||
/@next/swc-android-arm-eabi/12.2.5:
|
||||
resolution:
|
||||
@@ -9986,89 +9984,6 @@ packages:
|
||||
optionalDependencies:
|
||||
source-map: 0.6.1
|
||||
|
||||
/eslint-config-next/12.2.0_hrkuebk64jiu2ut2d2sm4oylnu:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-QWzNegadFXjQ0h3hixnLacRM9Kot85vQefyNsA8IeOnERZMz0Gvays1W6DMCjSxJbnCwuWaMXj9DCpar5IahRA==,
|
||||
}
|
||||
peerDependencies:
|
||||
eslint: ^7.23.0 || ^8.0.0
|
||||
typescript: ">=3.3.1"
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
"@next/eslint-plugin-next": 12.2.0
|
||||
"@rushstack/eslint-patch": 1.1.3
|
||||
"@typescript-eslint/parser": 5.28.0_hrkuebk64jiu2ut2d2sm4oylnu
|
||||
eslint: 7.32.0
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-import-resolver-typescript: 2.7.1_hpmu7kn6tcn2vnxpfzvv33bxmy
|
||||
eslint-plugin-import: 2.26.0_zhtk6rij7obli3ams3sxis7j7e
|
||||
eslint-plugin-jsx-a11y: 6.5.1_eslint@7.32.0
|
||||
eslint-plugin-react: 7.30.0_eslint@7.32.0
|
||||
eslint-plugin-react-hooks: 4.5.0_eslint@7.32.0
|
||||
typescript: 4.6.3
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-config-next/12.2.0_hxadhbs2xogijvk7vq4t2azzbu:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-QWzNegadFXjQ0h3hixnLacRM9Kot85vQefyNsA8IeOnERZMz0Gvays1W6DMCjSxJbnCwuWaMXj9DCpar5IahRA==,
|
||||
}
|
||||
peerDependencies:
|
||||
eslint: ^7.23.0 || ^8.0.0
|
||||
typescript: ">=3.3.1"
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
"@next/eslint-plugin-next": 12.2.0
|
||||
"@rushstack/eslint-patch": 1.1.3
|
||||
"@typescript-eslint/parser": 5.28.0_hxadhbs2xogijvk7vq4t2azzbu
|
||||
eslint: 7.32.0
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-import-resolver-typescript: 2.7.1_hpmu7kn6tcn2vnxpfzvv33bxmy
|
||||
eslint-plugin-import: 2.26.0_zhtk6rij7obli3ams3sxis7j7e
|
||||
eslint-plugin-jsx-a11y: 6.5.1_eslint@7.32.0
|
||||
eslint-plugin-react: 7.30.0_eslint@7.32.0
|
||||
eslint-plugin-react-hooks: 4.5.0_eslint@7.32.0
|
||||
typescript: 4.7.4
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-config-next/12.2.0_typescript@4.6.3:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-QWzNegadFXjQ0h3hixnLacRM9Kot85vQefyNsA8IeOnERZMz0Gvays1W6DMCjSxJbnCwuWaMXj9DCpar5IahRA==,
|
||||
}
|
||||
peerDependencies:
|
||||
eslint: ^7.23.0 || ^8.0.0
|
||||
typescript: ">=3.3.1"
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
"@next/eslint-plugin-next": 12.2.0
|
||||
"@rushstack/eslint-patch": 1.1.3
|
||||
"@typescript-eslint/parser": 5.28.0_typescript@4.6.3
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-import-resolver-typescript: 2.7.1_fkfqfehjtk7sk2efaqbgxsuasa
|
||||
eslint-plugin-import: 2.26.0_xtdmsd4adcznatktegie3poqce
|
||||
eslint-plugin-jsx-a11y: 6.5.1
|
||||
eslint-plugin-react: 7.30.0
|
||||
eslint-plugin-react-hooks: 4.5.0
|
||||
typescript: 4.6.3
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/eslint-config-next/12.3.1_hrkuebk64jiu2ut2d2sm4oylnu:
|
||||
resolution:
|
||||
{
|
||||
@@ -10097,6 +10012,61 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-config-next/12.3.1_hxadhbs2xogijvk7vq4t2azzbu:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-EN/xwKPU6jz1G0Qi6Bd/BqMnHLyRAL0VsaQaWA7F3KkjAgZHi4f1uL1JKGWNxdQpHTW/sdGONBd0bzxUka/DJg==,
|
||||
}
|
||||
peerDependencies:
|
||||
eslint: ^7.23.0 || ^8.0.0
|
||||
typescript: ">=3.3.1"
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
"@next/eslint-plugin-next": 12.3.1
|
||||
"@rushstack/eslint-patch": 1.1.3
|
||||
"@typescript-eslint/parser": 5.28.0_hxadhbs2xogijvk7vq4t2azzbu
|
||||
eslint: 7.32.0
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-import-resolver-typescript: 2.7.1_hpmu7kn6tcn2vnxpfzvv33bxmy
|
||||
eslint-plugin-import: 2.26.0_zhtk6rij7obli3ams3sxis7j7e
|
||||
eslint-plugin-jsx-a11y: 6.5.1_eslint@7.32.0
|
||||
eslint-plugin-react: 7.31.8_eslint@7.32.0
|
||||
eslint-plugin-react-hooks: 4.5.0_eslint@7.32.0
|
||||
typescript: 4.7.4
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-config-next/12.3.1_typescript@4.6.3:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-EN/xwKPU6jz1G0Qi6Bd/BqMnHLyRAL0VsaQaWA7F3KkjAgZHi4f1uL1JKGWNxdQpHTW/sdGONBd0bzxUka/DJg==,
|
||||
}
|
||||
peerDependencies:
|
||||
eslint: ^7.23.0 || ^8.0.0
|
||||
typescript: ">=3.3.1"
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
"@next/eslint-plugin-next": 12.3.1
|
||||
"@rushstack/eslint-patch": 1.1.3
|
||||
"@typescript-eslint/parser": 5.28.0_typescript@4.6.3
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-import-resolver-typescript: 2.7.1_fkfqfehjtk7sk2efaqbgxsuasa
|
||||
eslint-plugin-import: 2.26.0_xtdmsd4adcznatktegie3poqce
|
||||
eslint-plugin-jsx-a11y: 6.5.1
|
||||
eslint-plugin-react: 7.31.8
|
||||
eslint-plugin-react-hooks: 4.5.0
|
||||
typescript: 4.6.3
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/eslint-config-prettier/8.5.0:
|
||||
resolution:
|
||||
{
|
||||
@@ -10334,10 +10304,10 @@ packages:
|
||||
eslint: 7.32.0
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-react/7.30.0:
|
||||
/eslint-plugin-react/7.31.8:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-RgwH7hjW48BleKsYyHK5vUAvxtE9SMPDKmcPRQgtRCYaZA0XQPt5FSkrU3nhz5ifzMZcA8opwmRJ2cmOO8tr5A==,
|
||||
integrity: sha512-5lBTZmgQmARLLSYiwI71tiGVTLUuqXantZM6vlSY39OaDSV0M7+32K5DnLkmFrwTe+Ksz0ffuLUC91RUviVZfw==,
|
||||
}
|
||||
engines: {node: ">=4"}
|
||||
peerDependencies:
|
||||
@@ -10359,32 +10329,6 @@ packages:
|
||||
string.prototype.matchall: 4.0.7
|
||||
dev: false
|
||||
|
||||
/eslint-plugin-react/7.30.0_eslint@7.32.0:
|
||||
resolution:
|
||||
{
|
||||
integrity: sha512-RgwH7hjW48BleKsYyHK5vUAvxtE9SMPDKmcPRQgtRCYaZA0XQPt5FSkrU3nhz5ifzMZcA8opwmRJ2cmOO8tr5A==,
|
||||
}
|
||||
engines: {node: ">=4"}
|
||||
peerDependencies:
|
||||
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
|
||||
dependencies:
|
||||
array-includes: 3.1.5
|
||||
array.prototype.flatmap: 1.3.0
|
||||
doctrine: 2.1.0
|
||||
eslint: 7.32.0
|
||||
estraverse: 5.3.0
|
||||
jsx-ast-utils: 3.3.0
|
||||
minimatch: 3.1.2
|
||||
object.entries: 1.1.5
|
||||
object.fromentries: 2.0.5
|
||||
object.hasown: 1.1.1
|
||||
object.values: 1.1.5
|
||||
prop-types: 15.8.1
|
||||
resolve: 2.0.0-next.3
|
||||
semver: 6.3.0
|
||||
string.prototype.matchall: 4.0.7
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-react/7.31.8_eslint@7.32.0:
|
||||
resolution:
|
||||
{
|
||||
@@ -18461,7 +18405,6 @@ packages:
|
||||
typescript: 4.6.3
|
||||
v8-compile-cache-lib: 3.0.1
|
||||
yn: 3.1.1
|
||||
dev: false
|
||||
|
||||
/ts-node/10.7.0_typescript@4.6.3:
|
||||
resolution:
|
||||
|
||||
@@ -12,9 +12,11 @@ export default RecipeBuilder()
|
||||
stepName: "Add dependencies",
|
||||
explanation: `Add 'baseui' and Styletron as a dependency too -- it's a toolkit for CSS in JS styling which Base Web relies on.`,
|
||||
packages: [
|
||||
{name: "baseui", version: "10.x"},
|
||||
{name: "styletron-engine-atomic", version: "1.x"},
|
||||
{name: "styletron-react", version: "6.x"},
|
||||
{name: "baseui", version: "^10.5.0"},
|
||||
{name: "styletron-engine-atomic", version: "^1.4.8"},
|
||||
{name: "styletron-react", version: "^6.0.2"},
|
||||
{name: "@types/styletron-engine-atomic", version: "^1.1.1"},
|
||||
{name: "@types/styletron-react", version: "^5.0.3"},
|
||||
],
|
||||
})
|
||||
.addNewFilesStep({
|
||||
@@ -54,43 +56,40 @@ export default RecipeBuilder()
|
||||
addImport(program, themeAndBaseProviderImport)
|
||||
|
||||
program
|
||||
.find(j.JSXElement)
|
||||
.filter(
|
||||
(path) =>
|
||||
path.parent?.parent?.parent?.value?.id?.name === "App" &&
|
||||
path.parent?.value.type === j.ReturnStatement.toString(),
|
||||
)
|
||||
.find(j.FunctionDeclaration, (node) => node.id.name === "MyApp")
|
||||
.forEach((path) => {
|
||||
const {node} = path
|
||||
path.replace(
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("StyletronProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("value"),
|
||||
j.jsxExpressionContainer(j.identifier("styletron")),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("debug"),
|
||||
j.jsxExpressionContainer(j.identifier("debug")),
|
||||
),
|
||||
j.jsxAttribute(j.jsxIdentifier("debugAfterHydration")),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("StyletronProvider")),
|
||||
[
|
||||
j.literal("\n"),
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("BaseProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("theme"),
|
||||
j.jsxExpressionContainer(j.identifier("LightTheme")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("BaseProvider")),
|
||||
[j.literal("\n"), node, j.literal("\n")],
|
||||
),
|
||||
j.literal("\n"),
|
||||
],
|
||||
),
|
||||
const statement = path.value.body.body.filter(
|
||||
(b) => b.type === "ReturnStatement",
|
||||
)[0] as j.ReturnStatement
|
||||
const argument = statement?.argument as j.JSXElement
|
||||
|
||||
statement.argument = j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("StyletronProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("value"),
|
||||
j.jsxExpressionContainer(j.identifier("styletron")),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("debug"),
|
||||
j.jsxExpressionContainer(j.identifier("debug")),
|
||||
),
|
||||
j.jsxAttribute(j.jsxIdentifier("debugAfterHydration")),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("StyletronProvider")),
|
||||
[
|
||||
j.literal("\n"),
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("BaseProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("theme"),
|
||||
j.jsxExpressionContainer(j.identifier("LightTheme")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("BaseProvider")),
|
||||
[j.literal("\n"), argument, j.literal("\n")],
|
||||
),
|
||||
j.literal("\n"),
|
||||
],
|
||||
)
|
||||
})
|
||||
|
||||
@@ -109,7 +108,7 @@ export default RecipeBuilder()
|
||||
)
|
||||
|
||||
const styletronServerAndSheetImport = j.importDeclaration(
|
||||
[j.importSpecifier(j.identifier("Sheet"))],
|
||||
[j.importSpecifier(j.identifier("Server")), j.importSpecifier(j.identifier("Sheet"))],
|
||||
j.literal("styletron-engine-atomic"),
|
||||
)
|
||||
|
||||
@@ -122,16 +121,18 @@ export default RecipeBuilder()
|
||||
addImport(program, styletronServerAndSheetImport)
|
||||
addImport(program, styletronImport)
|
||||
|
||||
program.find(j.ImportDeclaration, {source: {value: "blitz"}}).forEach((blitzImportPath) => {
|
||||
let specifiers = blitzImportPath.value.specifiers || []
|
||||
if (
|
||||
!specifiers
|
||||
.filter((spec) => j.ImportSpecifier.check(spec))
|
||||
.some((node) => (node as j.ImportSpecifier)?.imported?.name === "DocumentContext")
|
||||
) {
|
||||
specifiers.push(j.importSpecifier(j.identifier("DocumentContext")))
|
||||
}
|
||||
})
|
||||
program
|
||||
.find(j.ImportDeclaration, {source: {value: "next/document"}})
|
||||
.forEach((nextDocumentImportPath) => {
|
||||
let specifiers = nextDocumentImportPath.value.specifiers || []
|
||||
if (
|
||||
!specifiers
|
||||
.filter((spec) => j.ImportSpecifier.check(spec))
|
||||
.some((node) => (node as j.ImportSpecifier)?.imported?.name === "DocumentContext")
|
||||
) {
|
||||
specifiers.push(j.importSpecifier(j.identifier("DocumentContext")))
|
||||
}
|
||||
})
|
||||
|
||||
program.find(j.ClassDeclaration).forEach((path) => {
|
||||
const props = j.typeAlias(
|
||||
@@ -233,7 +234,15 @@ export default RecipeBuilder()
|
||||
j.logicalExpression(
|
||||
"||",
|
||||
j.callExpression(
|
||||
j.memberExpression(j.identifier("styletron"), j.identifier("getStylesheets")),
|
||||
j.memberExpression(
|
||||
j.parenthesizedExpression(
|
||||
j.tsAsExpression(
|
||||
j.identifier("styletron"),
|
||||
j.tsTypeReference(j.identifier("Server")),
|
||||
),
|
||||
),
|
||||
j.identifier("getStylesheets"),
|
||||
),
|
||||
[],
|
||||
),
|
||||
j.arrayExpression([]),
|
||||
@@ -263,93 +272,82 @@ export default RecipeBuilder()
|
||||
node.body.splice(0, 0, getInitialPropsMethod)
|
||||
})
|
||||
|
||||
program
|
||||
.find(j.JSXElement, {openingElement: {name: {name: "DocumentHead"}}})
|
||||
.forEach((path) => {
|
||||
const {node} = path
|
||||
path.replace(
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("DocumentHead")),
|
||||
j.jsxClosingElement(j.jsxIdentifier("DocumentHead")),
|
||||
[
|
||||
...(node.children || []),
|
||||
j.literal("\n"),
|
||||
j.jsxExpressionContainer(
|
||||
j.callExpression(
|
||||
program.find(j.JSXElement, {openingElement: {name: {name: "Head"}}}).forEach((path) => {
|
||||
const {node} = path
|
||||
path.replace(
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("Head")),
|
||||
j.jsxClosingElement(j.jsxIdentifier("Head")),
|
||||
[
|
||||
...(node.children || []),
|
||||
j.literal("\n"),
|
||||
j.jsxExpressionContainer(
|
||||
j.callExpression(
|
||||
j.memberExpression(
|
||||
j.memberExpression(
|
||||
j.memberExpression(
|
||||
j.memberExpression(j.thisExpression(), j.identifier("props")),
|
||||
j.identifier("stylesheets"),
|
||||
),
|
||||
j.identifier("map"),
|
||||
j.memberExpression(j.thisExpression(), j.identifier("props")),
|
||||
j.identifier("stylesheets"),
|
||||
),
|
||||
[
|
||||
j.arrowFunctionExpression(
|
||||
[j.identifier("sheet"), j.identifier("i")],
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(
|
||||
j.jsxIdentifier("style"),
|
||||
[
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("className"),
|
||||
j.literal("_styletron_hydrate_"),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("dangerouslySetInnerHTML"),
|
||||
j.jsxExpressionContainer(
|
||||
j.objectExpression([
|
||||
j.objectProperty(
|
||||
j.identifier("__html"),
|
||||
j.memberExpression(
|
||||
j.identifier("sheet"),
|
||||
j.identifier("css"),
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("media"),
|
||||
j.jsxExpressionContainer(
|
||||
j.memberExpression(
|
||||
j.memberExpression(
|
||||
j.identifier("sheet"),
|
||||
j.identifier("attrs"),
|
||||
),
|
||||
j.identifier("media"),
|
||||
j.identifier("map"),
|
||||
),
|
||||
[
|
||||
j.arrowFunctionExpression(
|
||||
[j.identifier("sheet"), j.identifier("i")],
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(
|
||||
j.jsxIdentifier("style"),
|
||||
[
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("className"),
|
||||
j.literal("_styletron_hydrate_"),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("dangerouslySetInnerHTML"),
|
||||
j.jsxExpressionContainer(
|
||||
j.objectExpression([
|
||||
j.objectProperty(
|
||||
j.identifier("__html"),
|
||||
j.memberExpression(j.identifier("sheet"), j.identifier("css")),
|
||||
),
|
||||
]),
|
||||
),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("media"),
|
||||
j.jsxExpressionContainer(
|
||||
j.memberExpression(
|
||||
j.memberExpression(j.identifier("sheet"), j.identifier("attrs")),
|
||||
j.identifier("media"),
|
||||
),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("data-hydrate"),
|
||||
j.jsxExpressionContainer(
|
||||
j.memberExpression(
|
||||
j.memberExpression(
|
||||
j.identifier("sheet"),
|
||||
j.identifier("attrs"),
|
||||
),
|
||||
j.stringLiteral("data-hydrate"),
|
||||
true,
|
||||
),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("data-hydrate"),
|
||||
j.jsxExpressionContainer(
|
||||
j.memberExpression(
|
||||
j.memberExpression(j.identifier("sheet"), j.identifier("attrs")),
|
||||
j.stringLiteral("data-hydrate"),
|
||||
true,
|
||||
),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("key"),
|
||||
j.jsxExpressionContainer(j.jsxIdentifier("i")),
|
||||
),
|
||||
],
|
||||
true,
|
||||
),
|
||||
),
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("key"),
|
||||
j.jsxExpressionContainer(j.jsxIdentifier("i")),
|
||||
),
|
||||
],
|
||||
true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
j.literal("\n"),
|
||||
],
|
||||
),
|
||||
)
|
||||
})
|
||||
),
|
||||
j.literal("\n"),
|
||||
],
|
||||
),
|
||||
)
|
||||
})
|
||||
|
||||
return program
|
||||
},
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import {Client, Server} from "styletron-engine-atomic"
|
||||
import {DebugEngine} from "styletron-react"
|
||||
|
||||
const getHydrateClass = () => document.getElementsByClassName("_styletron_hydrate_")
|
||||
const getHydrateClass = () =>
|
||||
document.getElementsByClassName("_styletron_hydrate_") as HTMLCollectionOf<HTMLStyleElement>
|
||||
|
||||
export const styletron =
|
||||
typeof window === "undefined"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -4,21 +4,18 @@ import j from "jscodeshift"
|
||||
|
||||
function wrapComponentWithBumbagProvider(program: Program) {
|
||||
program
|
||||
.find(j.JSXElement)
|
||||
.filter(
|
||||
(path) =>
|
||||
path.parent?.parent?.parent?.value?.id?.name === "App" &&
|
||||
path.parent?.value.type === j.ReturnStatement.toString(),
|
||||
)
|
||||
.forEach((path: NodePath) => {
|
||||
const {node} = path
|
||||
.find(j.FunctionDeclaration, (node) => node.id.name === "MyApp")
|
||||
.forEach((path) => {
|
||||
const statement = path.value.body.body.filter(
|
||||
(b) => b.type === "ReturnStatement",
|
||||
)[0] as j.ReturnStatement
|
||||
const argument = statement?.argument as j.JSXElement
|
||||
|
||||
try {
|
||||
path.replace(
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("BumbagProvider isSSR")),
|
||||
j.jsxClosingElement(j.jsxIdentifier("BumbagProvider")),
|
||||
[j.jsxText("\n"), node, j.jsxText("\n")],
|
||||
),
|
||||
statement.argument = j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("BumbagProvider isSSR")),
|
||||
j.jsxClosingElement(j.jsxIdentifier("BumbagProvider")),
|
||||
[j.jsxText("\n"), argument, j.jsxText("\n")],
|
||||
)
|
||||
} catch {
|
||||
console.error("Already installed recipe")
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12"
|
||||
"blitz": "2.0.0-beta.14"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12"
|
||||
"blitz": "2.0.0-beta.14"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0",
|
||||
"uuid": "^8.3.1"
|
||||
},
|
||||
|
||||
@@ -30,17 +30,11 @@ export default RecipeBuilder()
|
||||
explanation: `We will add logic to initialize the LogRocket session and upon login, identify the user within LogRocket`,
|
||||
singleFileSearch: paths.app(),
|
||||
transform(program) {
|
||||
// Ensure useSession is in the blitz imports.
|
||||
program.find(j.ImportDeclaration, {source: {value: "blitz"}}).forEach((blitzImportPath) => {
|
||||
let specifiers = blitzImportPath.value.specifiers || []
|
||||
if (
|
||||
!specifiers
|
||||
.filter((spec) => j.ImportSpecifier.check(spec))
|
||||
.some((node) => (node as j.ImportSpecifier)?.imported?.name === "useSession")
|
||||
) {
|
||||
specifiers.splice(0, 0, j.importSpecifier(j.identifier("useSession")))
|
||||
}
|
||||
})
|
||||
const useSessionImport = j.importDeclaration(
|
||||
[j.importSpecifier(j.identifier("useSession"))],
|
||||
j.literal("@blitzjs/auth"),
|
||||
)
|
||||
addImport(program, useSessionImport)
|
||||
|
||||
const logrocketImport = j.importDeclaration(
|
||||
[j.importDefaultSpecifier(j.identifier("* as LogRocket"))],
|
||||
@@ -52,21 +46,23 @@ export default RecipeBuilder()
|
||||
let isReactImported = false
|
||||
|
||||
// Ensure useEffect is in the react import.
|
||||
program.find(j.ImportDeclaration, {source: "react"}).forEach((path) => {
|
||||
// check if React is already imported
|
||||
// if yes then we can skip importing it
|
||||
// since we need it for useEffect
|
||||
isReactImported = true
|
||||
program
|
||||
.find(j.ImportDeclaration, (node) => node.source.value === "react")
|
||||
.forEach((path) => {
|
||||
// check if React is already imported
|
||||
// if yes then we can skip importing it
|
||||
// since we need it for useEffect
|
||||
isReactImported = true
|
||||
|
||||
// currently, we only check if the default export is there
|
||||
// because we use the hook as React.useEffect
|
||||
// if not then add the default export
|
||||
let specifiers = path.value.specifiers || []
|
||||
// currently, we only check if the default export is there
|
||||
// because we use the hook as React.useEffect
|
||||
// if not then add the default export
|
||||
let specifiers = path.value.specifiers || []
|
||||
|
||||
if (!specifiers.some((node) => j.ImportDefaultSpecifier.check(node))) {
|
||||
specifiers.splice(0, 0, j.importDefaultSpecifier(j.identifier("React")))
|
||||
}
|
||||
})
|
||||
if (!specifiers.some((node) => j.ImportDefaultSpecifier.check(node))) {
|
||||
specifiers.splice(0, 0, j.importDefaultSpecifier(j.identifier("React")))
|
||||
}
|
||||
})
|
||||
|
||||
// import React if it wasn't already imported
|
||||
if (!isReactImported) {
|
||||
@@ -79,33 +75,33 @@ export default RecipeBuilder()
|
||||
|
||||
const isSessionDeclared = program.findVariableDeclarators("session")
|
||||
|
||||
program.find(j.FunctionDeclaration, {id: {name: "App"}}).forEach((path) => {
|
||||
// Declare router and/or session if not declared.
|
||||
if (!isSessionDeclared.length) {
|
||||
path
|
||||
.get("body")
|
||||
.get("body")
|
||||
.value.unshift(
|
||||
j.variableDeclaration("const", [
|
||||
j.variableDeclarator(
|
||||
j.identifier("session"),
|
||||
j.callExpression(j.identifier("useSession"), [
|
||||
j.objectExpression([
|
||||
j.objectProperty(j.identifier("suspense"), j.booleanLiteral(false)),
|
||||
program
|
||||
.find(j.FunctionDeclaration, (node) => node.id.name === "MyApp")
|
||||
.forEach((path) => {
|
||||
// Declare router and/or session if not declared.
|
||||
if (!isSessionDeclared.length) {
|
||||
path
|
||||
.get("body")
|
||||
.get("body")
|
||||
.value.unshift(
|
||||
j.variableDeclaration("const", [
|
||||
j.variableDeclarator(
|
||||
j.identifier("session"),
|
||||
j.callExpression(j.identifier("useSession"), [
|
||||
j.objectExpression([
|
||||
j.objectProperty(j.identifier("suspense"), j.booleanLiteral(false)),
|
||||
]),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
]),
|
||||
)
|
||||
}
|
||||
})
|
||||
),
|
||||
]),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
const returnStm = program.find(j.ReturnStatement).filter((path) => {
|
||||
return (
|
||||
path.parent?.parent?.parent?.value?.declaration?.id?.name === "App" &&
|
||||
path.parent?.parent?.parent?.value?.type === j.ExportDefaultDeclaration.toString()
|
||||
)
|
||||
})
|
||||
const returnStm = program.find(
|
||||
j.ReturnStatement,
|
||||
(node) => node.argument.openingElement.name.name === "ErrorBoundary",
|
||||
)
|
||||
|
||||
if (returnStm) {
|
||||
returnStm.insertBefore(
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12"
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jscodeshift": "0.11.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {addImport, paths, RecipeBuilder, withComments, withTypeAnnotation} from "blitz/installer"
|
||||
import {addImport, paths, RecipeBuilder, withTypeAnnotation} from "blitz/installer"
|
||||
import j from "jscodeshift"
|
||||
import {join} from "path"
|
||||
|
||||
@@ -57,26 +57,30 @@ export default RecipeBuilder()
|
||||
),
|
||||
)
|
||||
|
||||
// import theme from 'app/core/styles/theme'
|
||||
// import theme from 'app/styles/theme'
|
||||
addImport(
|
||||
program,
|
||||
j.importDeclaration(
|
||||
[j.importDefaultSpecifier(j.identifier("theme"))],
|
||||
j.literal("app/core/styles/theme"),
|
||||
j.literal("app/styles/theme"),
|
||||
),
|
||||
)
|
||||
|
||||
// import createEmotionCache from 'app/core/utils/createEmotionCache'
|
||||
// import createEmotionCache from 'app/utils/createEmotionCache'
|
||||
addImport(
|
||||
program,
|
||||
j.importDeclaration(
|
||||
[j.importDefaultSpecifier(j.identifier("createEmotionCache"))],
|
||||
j.literal("app/core/utils/createEmotionCache"),
|
||||
j.literal("app/utils/createEmotionCache"),
|
||||
),
|
||||
)
|
||||
|
||||
program.find(j.ExportDefaultDeclaration).forEach((path) => {
|
||||
path.insertBefore(
|
||||
program.find(j.ImportDeclaration).forEach((i, idx, path) => {
|
||||
if (idx !== path.length - 1) {
|
||||
return
|
||||
}
|
||||
|
||||
path[path.length - 1]?.insertAfter(
|
||||
j.interfaceDeclaration(
|
||||
j.identifier("MyAppProps"),
|
||||
j.objectTypeAnnotation([
|
||||
@@ -90,26 +94,19 @@ export default RecipeBuilder()
|
||||
),
|
||||
)
|
||||
|
||||
path.insertBefore(
|
||||
withComments(
|
||||
j.variableDeclaration("const", [
|
||||
j.variableDeclarator(
|
||||
j.identifier("clientSideEmotionCache"),
|
||||
j.callExpression(j.identifier("createEmotionCache"), []),
|
||||
),
|
||||
]),
|
||||
[
|
||||
j.commentLine(
|
||||
" Client-side cache, shared for the whole session of the user in the browser.",
|
||||
),
|
||||
],
|
||||
),
|
||||
path[path.length - 1]?.insertAfter(
|
||||
j.variableDeclaration("const", [
|
||||
j.variableDeclarator(
|
||||
j.identifier("clientSideEmotionCache"),
|
||||
j.callExpression(j.identifier("createEmotionCache"), []),
|
||||
),
|
||||
]),
|
||||
)
|
||||
})
|
||||
|
||||
program
|
||||
.find(j.FunctionDeclaration)
|
||||
.filter((path) => path.value?.id?.name === "App")
|
||||
.filter((path) => path.value?.id?.name === "MyApp")
|
||||
.forEach((path) => {
|
||||
let objProps = [
|
||||
j.property("init", j.identifier("Component"), j.identifier("Component")),
|
||||
@@ -136,44 +133,41 @@ export default RecipeBuilder()
|
||||
})
|
||||
|
||||
program
|
||||
.find(j.JSXElement)
|
||||
.filter(
|
||||
(path) =>
|
||||
path.parent?.parent?.parent?.value?.id?.name === "App" &&
|
||||
path.parent?.value.type === j.ReturnStatement.toString(),
|
||||
)
|
||||
.find(j.FunctionDeclaration, (node) => node.id.name === "MyApp")
|
||||
.forEach((path) => {
|
||||
const {node} = path
|
||||
path.replace(
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("CacheProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("value"),
|
||||
j.jsxExpressionContainer(j.identifier("emotionCache")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("CacheProvider")),
|
||||
[
|
||||
j.literal("\n"),
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("ThemeProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("theme"),
|
||||
j.jsxExpressionContainer(j.identifier("theme")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("ThemeProvider")),
|
||||
[
|
||||
j.literal("\n"),
|
||||
j.jsxElement(j.jsxOpeningElement(j.jsxIdentifier("CssBaseline"), [], true)),
|
||||
j.literal("\n"),
|
||||
node,
|
||||
j.literal("\n"),
|
||||
],
|
||||
),
|
||||
j.literal("\n"),
|
||||
],
|
||||
),
|
||||
const statement = path.value.body.body.filter(
|
||||
(b) => b.type === "ReturnStatement",
|
||||
)[0] as j.ReturnStatement
|
||||
const argument = statement?.argument as j.JSXElement
|
||||
|
||||
statement.argument = j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("CacheProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("value"),
|
||||
j.jsxExpressionContainer(j.identifier("emotionCache")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("CacheProvider")),
|
||||
[
|
||||
j.literal("\n"),
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("ThemeProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("theme"),
|
||||
j.jsxExpressionContainer(j.identifier("theme")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("ThemeProvider")),
|
||||
[
|
||||
j.literal("\n"),
|
||||
j.jsxElement(j.jsxOpeningElement(j.jsxIdentifier("CssBaseline"), [], true)),
|
||||
j.literal("\n"),
|
||||
argument,
|
||||
j.literal("\n"),
|
||||
],
|
||||
),
|
||||
j.literal("\n"),
|
||||
],
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import {
|
||||
import Document, {
|
||||
NextScript,
|
||||
Document,
|
||||
DocumentContext,
|
||||
DocumentHead,
|
||||
Head,
|
||||
DocumentInitialProps,
|
||||
Html,
|
||||
Main,
|
||||
} from "next/document"
|
||||
import {Children} from "react"
|
||||
import createEmotionServer from "@emotion/server/create-instance"
|
||||
import theme from "app/core/styles/theme"
|
||||
import createEmotionCache from "app/core/utils/createEmotionCache"
|
||||
import theme from "app/styles/theme"
|
||||
import createEmotionCache from "app/utils/createEmotionCache"
|
||||
|
||||
export default class MyDocument extends Document {
|
||||
static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
|
||||
@@ -73,7 +72,7 @@ export default class MyDocument extends Document {
|
||||
render() {
|
||||
return (
|
||||
<Html lang="en">
|
||||
<DocumentHead>
|
||||
<Head>
|
||||
{/* PWA primary color */}
|
||||
<meta name="theme-color" content={theme.palette.primary.main} />
|
||||
<link
|
||||
@@ -81,7 +80,7 @@ export default class MyDocument extends Document {
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
||||
/>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
||||
</DocumentHead>
|
||||
</Head>
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
|
||||
@@ -5,20 +5,17 @@ import j, {JSXIdentifier} from "jscodeshift"
|
||||
// Copied from https://github.com/blitz-js/legacy-framework/pull/805, let's add this to the blitz
|
||||
function wrapComponentWithChakraProvider(program: Program) {
|
||||
program
|
||||
.find(j.JSXElement)
|
||||
.filter(
|
||||
(path) =>
|
||||
path.parent?.parent?.parent?.value?.id?.name === "App" &&
|
||||
path.parent?.value.type === j.ReturnStatement.toString(),
|
||||
)
|
||||
.find(j.FunctionDeclaration, (node) => node.id.name === "MyApp")
|
||||
.forEach((path: NodePath) => {
|
||||
const {node} = path
|
||||
path.replace(
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("NextUIProvider")),
|
||||
j.jsxClosingElement(j.jsxIdentifier("NextUIProvider")),
|
||||
[j.jsxText("\n"), node, j.jsxText("\n")],
|
||||
),
|
||||
const statement = path.value.body.body.filter(
|
||||
(b) => b.type === "ReturnStatement",
|
||||
)[0] as j.ReturnStatement
|
||||
const argument = statement?.argument as j.JSXElement
|
||||
|
||||
statement.argument = j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("NextUIProvider")),
|
||||
j.jsxClosingElement(j.jsxIdentifier("NextUIProvider")),
|
||||
[j.jsxText("\n"), argument, j.jsxText("\n")],
|
||||
)
|
||||
})
|
||||
return program
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12"
|
||||
"blitz": "2.0.0-beta.14"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Run `blitz build` before starting
|
||||
const path = require("path")
|
||||
|
||||
const blitzPath = path.join(__dirname, "node_modules", "next", "dist", "bin", "next")
|
||||
const blitzPath = path.join(__dirname, "node_modules", "blitz", "bin", "blitz")
|
||||
|
||||
process.argv.length = 1
|
||||
process.argv.push(blitzPath, "start")
|
||||
|
||||
@@ -34,11 +34,19 @@ export default RecipeBuilder()
|
||||
},
|
||||
})
|
||||
.addNewFilesStep({
|
||||
stepId: "addExamples",
|
||||
stepName: "Add example files",
|
||||
stepId: "addExamplesMutations",
|
||||
stepName: "Add example Mutation files",
|
||||
explanation: "Create one example Queue and CronJob that illustrate Quirrel usage.",
|
||||
targetDirectory: "app",
|
||||
templatePath: path.join(__dirname, "templates", "app"),
|
||||
templateValues: {},
|
||||
})
|
||||
.addNewFilesStep({
|
||||
stepId: "addExamplesApi",
|
||||
stepName: "Add example API files",
|
||||
explanation: "Create one example Queue and CronJob that illustrate Quirrel usage.",
|
||||
targetDirectory: "pages",
|
||||
templatePath: path.join(__dirname, "templates", "pages"),
|
||||
templateValues: {},
|
||||
})
|
||||
.build()
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12"
|
||||
"blitz": "2.0.0-beta.14"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import greetingsQueue from "app/api/greetingsQueue"
|
||||
import greetingsQueue from "pages/api/greetingsQueue"
|
||||
|
||||
export default async function enqueueGreeting() {
|
||||
await greetingsQueue.enqueue({
|
||||
|
||||
@@ -5,25 +5,19 @@ import {join} from "path"
|
||||
|
||||
function wrapComponentWithThemeProvider(program: Program) {
|
||||
program
|
||||
.find(j.JSXElement)
|
||||
.filter(
|
||||
(path) =>
|
||||
path.parent?.parent?.parent?.value?.id?.name === "App" &&
|
||||
path.parent?.value.type === j.ReturnStatement.toString(),
|
||||
)
|
||||
.find(j.FunctionDeclaration, (node) => node.id.name === "MyApp")
|
||||
.forEach((path: NodePath) => {
|
||||
const {node} = path
|
||||
path.replace(
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("ThemeProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("theme"),
|
||||
j.jsxExpressionContainer(j.identifier("theme")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("ThemeProvider")),
|
||||
[j.jsxText("\n"), node, j.jsxText("\n")],
|
||||
),
|
||||
const statement = path.value.body.body.filter(
|
||||
(b) => b.type === "ReturnStatement",
|
||||
)[0] as j.ReturnStatement
|
||||
const argument = statement?.argument as j.JSXElement
|
||||
|
||||
statement.argument = j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("ThemeProvider"), [
|
||||
j.jsxAttribute(j.jsxIdentifier("theme"), j.jsxExpressionContainer(j.identifier("theme"))),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("ThemeProvider")),
|
||||
[j.jsxText("\n"), argument, j.jsxText("\n")],
|
||||
)
|
||||
})
|
||||
|
||||
@@ -107,6 +101,14 @@ export default RecipeBuilder()
|
||||
return injectInitializeColorMode(program)
|
||||
},
|
||||
})
|
||||
.addNewFilesStep({
|
||||
stepId: "create babel file",
|
||||
stepName: "Create babel file",
|
||||
explanation: `Adding default babel file.`,
|
||||
targetDirectory: "./babel.config.js",
|
||||
templatePath: join(__dirname, "templates", "babel.config.js"),
|
||||
templateValues: {},
|
||||
})
|
||||
.addTransformFilesStep({
|
||||
stepId: "updateBabelConfig",
|
||||
stepName: "Add Babel preset",
|
||||
@@ -116,7 +118,7 @@ export default RecipeBuilder()
|
||||
|
||||
transform(program) {
|
||||
return addBabelPreset(program, [
|
||||
"blitz/babel",
|
||||
"next/babel",
|
||||
{
|
||||
"preset-react": {
|
||||
runtime: "automatic",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
4
recipes/reflexjs/templates/babel.config.js
Normal file
4
recipes/reflexjs/templates/babel.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
presets: [],
|
||||
plugins: [],
|
||||
}
|
||||
@@ -22,6 +22,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12"
|
||||
"blitz": "2.0.0-beta.14"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ export default RecipeBuilder()
|
||||
addImport(program, secureHeadersImport)
|
||||
}
|
||||
|
||||
program.findJSXElements("DocumentHead").forEach((path) => {
|
||||
program.findJSXElements("Head").forEach((path) => {
|
||||
path.replace(
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("DocumentHead")),
|
||||
j.jsxClosingElement(j.jsxIdentifier("DocumentHead")),
|
||||
j.jsxOpeningElement(j.jsxIdentifier("Head")),
|
||||
j.jsxClosingElement(j.jsxIdentifier("Head")),
|
||||
[
|
||||
...addHttpMetaTag(
|
||||
"Content-Security-Policy",
|
||||
@@ -137,7 +137,7 @@ const addHttpHeaders = (program: Program, headers: Array<{name: string; value: s
|
||||
)
|
||||
headersFunction.async = true
|
||||
const headersCollection = transformNextConfig(program).configObj.find(
|
||||
(value) =>
|
||||
(value: {type: string; key: {type: string; name: string}}) =>
|
||||
value.type === "ObjectProperty" &&
|
||||
value.key.type === "Identifier" &&
|
||||
value.key.name === "headers",
|
||||
@@ -152,7 +152,7 @@ const addHttpHeaders = (program: Program, headers: Array<{name: string; value: s
|
||||
}
|
||||
|
||||
const poweredByProp = transformNextConfig(program).configObj.find(
|
||||
(value) =>
|
||||
(value: {type: string; key: {type: string; name: string}}) =>
|
||||
value.type === "ObjectProperty" &&
|
||||
value.key.type === "Identifier" &&
|
||||
value.key.name === "poweredByHeader",
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0",
|
||||
"uuid": "^8.3.1"
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -5,32 +5,29 @@ import {join} from "path"
|
||||
|
||||
function wrapComponentWithStyledComponentsThemeProvider(program: Program) {
|
||||
program
|
||||
.find(j.JSXElement)
|
||||
.filter(
|
||||
(path) =>
|
||||
path.parent?.parent?.parent?.value?.id?.name === "App" &&
|
||||
path.parent?.value.type === j.ReturnStatement.toString(),
|
||||
)
|
||||
.find(j.FunctionDeclaration, (node) => node.id.name === "MyApp")
|
||||
.forEach((path: NodePath) => {
|
||||
const {node} = path
|
||||
path.replace(
|
||||
j.jsxFragment(j.jsxOpeningFragment(), j.jsxClosingFragment(), [
|
||||
j.jsxText("\n"),
|
||||
j.jsxElement(j.jsxOpeningElement(j.jsxIdentifier("GlobalStyle"), [], true)),
|
||||
j.jsxText("\n"),
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("ThemeProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("theme"),
|
||||
j.jsxExpressionContainer(j.identifier("theme")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("ThemeProvider")),
|
||||
[j.jsxText("\n"), node, j.jsxText("\n")],
|
||||
),
|
||||
j.jsxText("\n"),
|
||||
]),
|
||||
)
|
||||
const statement = path.value.body.body.filter(
|
||||
(b) => b.type === "ReturnStatement",
|
||||
)[0] as j.ReturnStatement
|
||||
const argument = statement?.argument as j.JSXElement
|
||||
|
||||
statement.argument = j.jsxFragment(j.jsxOpeningFragment(), j.jsxClosingFragment(), [
|
||||
j.jsxText("\n"),
|
||||
j.jsxElement(j.jsxOpeningElement(j.jsxIdentifier("GlobalStyle"), [], true)),
|
||||
j.jsxText("\n"),
|
||||
j.jsxElement(
|
||||
j.jsxOpeningElement(j.jsxIdentifier("ThemeProvider"), [
|
||||
j.jsxAttribute(
|
||||
j.jsxIdentifier("theme"),
|
||||
j.jsxExpressionContainer(j.identifier("theme")),
|
||||
),
|
||||
]),
|
||||
j.jsxClosingElement(j.jsxIdentifier("ThemeProvider")),
|
||||
[j.jsxText("\n"), argument, j.jsxText("\n")],
|
||||
),
|
||||
j.jsxText("\n"),
|
||||
])
|
||||
})
|
||||
return program
|
||||
}
|
||||
@@ -72,16 +69,18 @@ export default RecipeBuilder()
|
||||
)
|
||||
|
||||
// Ensure DocumentContext is in the blitz imports.
|
||||
program.find(j.ImportDeclaration, {source: {value: "blitz"}}).forEach((blitzImportPath) => {
|
||||
let specifiers = blitzImportPath.value.specifiers || []
|
||||
if (
|
||||
!specifiers
|
||||
.filter((spec) => j.ImportSpecifier.check(spec))
|
||||
.some((node) => (node as j.ImportSpecifier)?.imported?.name === "DocumentContext")
|
||||
) {
|
||||
specifiers.splice(0, 0, j.importSpecifier(j.identifier("DocumentContext")))
|
||||
}
|
||||
})
|
||||
program
|
||||
.find(j.ImportDeclaration, {source: {value: "next/document"}})
|
||||
.forEach((blitzImportPath) => {
|
||||
let specifiers = blitzImportPath.value.specifiers || []
|
||||
if (
|
||||
!specifiers
|
||||
.filter((spec) => j.ImportSpecifier.check(spec))
|
||||
.some((node) => (node as j.ImportSpecifier)?.imported?.name === "DocumentContext")
|
||||
) {
|
||||
specifiers.splice(0, 0, j.importSpecifier(j.identifier("DocumentContext")))
|
||||
}
|
||||
})
|
||||
program.find(j.ClassBody).forEach((path) => {
|
||||
const {node} = path
|
||||
|
||||
@@ -234,6 +233,14 @@ export default RecipeBuilder()
|
||||
return wrapComponentWithStyledComponentsThemeProvider(program)
|
||||
},
|
||||
})
|
||||
.addNewFilesStep({
|
||||
stepId: "create babel file",
|
||||
stepName: "Create babel file",
|
||||
explanation: `Adding default babel file.`,
|
||||
targetDirectory: "./babel.config.js",
|
||||
templatePath: join(__dirname, "templates", "babel.config.js"),
|
||||
templateValues: {},
|
||||
})
|
||||
.addTransformFilesStep({
|
||||
stepId: "updateBabelConfig",
|
||||
stepName: "Add Babel plugin and preset",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/blitz-js/blitz#readme",
|
||||
"dependencies": {
|
||||
"blitz": "workspace:2.0.0-beta.12",
|
||||
"blitz": "2.0.0-beta.14",
|
||||
"jscodeshift": "0.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
4
recipes/styled-components/templates/babel.config.js
Normal file
4
recipes/styled-components/templates/babel.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
presets: [],
|
||||
plugins: [],
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user