1
0
mirror of synced 2026-02-04 12:08:33 -05:00

Compare commits

...

12 Commits

Author SHA1 Message Date
github-actions[bot]
718a194891 Version Packages (alpha) (#3583)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-22 20:06:49 +02:00
Fran Zekan
0f18c68d63 Fix prefetching, again... (#3578)
Co-authored-by: beerose <alexsandra.sikora@gmail.com>
2022-07-22 18:08:12 +02:00
Aleksandra
3511d5b69b [temporary fix] skip version check until internal issues are resolved (#3584) 2022-07-22 17:05:40 +02:00
Aleksandra
716e188d13 Fix queries/mutations lookup on Windows (#3581) 2022-07-22 16:16:01 +02:00
github-actions[bot]
57a53fa3c2 Version Packages (alpha) (#3561)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-07-20 14:34:36 +02:00
Fran Zekan
abb1ad5d1c Don't throw error on a missing app/api folder when running codemod (#3568)
Co-authored-by: Aleksandra <alexsandra.sikora@gmail.com>
2022-07-20 08:26:14 +02:00
Brandon Bayer
7096083038 Update CODEOWNERS 2022-07-19 18:29:15 +02:00
Ante Primorac
0ac6e17122 fix blitz not loading custom server (#3564)
* fix blitz not loading custom server
2022-07-19 00:42:14 +02:00
Brandon Bayer
8bcb471a53 Fix auth issue where session token and publicData cookie were updated unnecessarily, leading to potential user logout (#3556)
* fix auth issue where session token and public data token was updated unnecessarily
2022-07-19 00:19:55 +02:00
Brandon Bayer
abe2afccdf Fix a long-standing issue with occasional blitz auth flakiness (#3554)
* fix cookie set bug
2022-07-19 00:06:38 +02:00
Fran Zekan
d9fc5d8e26 Fix queryClient not working the same in SSP and SP (#3563)
Co-authored-by: beerose <alexsandra.sikora@gmail.com>
2022-07-18 17:14:53 +02:00
Aleksandra
3f20a47405 Fix delete session type (#3560) 2022-07-18 12:58:03 +02:00
38 changed files with 320 additions and 107 deletions

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/auth": patch
---
Update `deleteSession` return type — allow undefined values

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/next": patch
---
Allow prefetching multiple queries in gSSP and gSP

View File

@@ -0,0 +1,5 @@
---
"blitz": patch
---
Improve codemod utilities

View File

@@ -0,0 +1,10 @@
---
"@blitzjs/auth": patch
"blitz": patch
---
Fix a long-standing issue with occasional blitz auth flakiness
This bug would sometimes cause users to be logged out or to experience an CSRFTokenMismatchError. This bug, when encountered, usually by lots of setPublicData or session.create calls, would not set the cookie headers correctly resulting in cookies being set to a previous state or in a possibly undefined state.
There are no security concerns as far as I can tell.

View File

@@ -0,0 +1,5 @@
---
"blitz": patch
---
Temporarily skip version check

View File

@@ -28,6 +28,7 @@
"cool-horses-check",
"curly-seas-serve",
"dirty-monkeys-greet",
"dirty-planets-chew",
"eleven-humans-sort",
"empty-berries-rule",
"empty-turkeys-wave",
@@ -41,16 +42,19 @@
"gentle-dogs-reply",
"good-apes-drum",
"good-insects-wink",
"gorgeous-buses-scream",
"great-months-train",
"green-papayas-do",
"healthy-rice-shout",
"heavy-apes-judge",
"hot-drinks-approve",
"hungry-baboons-swim",
"late-steaks-give",
"lemon-games-press",
"lemon-seas-push",
"lovely-colts-share",
"lucky-cows-try",
"mean-gorillas-reply",
"modern-cameras-pull",
"moody-bags-walk",
"moody-squids-cheer",
@@ -61,6 +65,7 @@
"nice-starfishes-live",
"nine-birds-confess",
"nine-onions-admire",
"ninety-lies-press",
"ninety-pets-heal",
"olive-bees-buy",
"olive-feet-rhyme",
@@ -72,6 +77,7 @@
"poor-shrimps-think",
"popular-teachers-pay",
"purple-singers-greet",
"quick-cycles-confess",
"quiet-feet-travel",
"quiet-pans-hunt",
"quiet-sloths-rule",
@@ -80,13 +86,16 @@
"sharp-falcons-begin",
"shy-olives-hang",
"silent-colts-reply",
"silly-apricots-share",
"slimy-needles-taste",
"slow-walls-poke",
"small-socks-confess",
"smooth-planets-admire",
"soft-adults-smell",
"sour-lemons-hunt",
"strong-apes-reply",
"stupid-walls-sell",
"sweet-kiwis-cross",
"swift-drinks-dress",
"tall-meals-learn",
"tame-keys-reply",

View File

@@ -0,0 +1,5 @@
---
"blitz": patch
---
fixes blitz not loading custom server

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/next": patch
---
Avoid reassigning queryClient in prefetch methods

View File

@@ -0,0 +1,9 @@
---
"@blitzjs/auth": patch
"blitz": patch
---
Fix auth issue where session token and publicData cookie were updated unnecessarily, leading to potential user logout
- Previously, we were updating the session token each time public data changed. This is not needed, and it would cause race condition bugs where a user could be unexpectedly logged out because a request already in flight would not match the new session token.
- Previously, we were updating the publicData cookie even when it hadn't changed. This may reduce unnecessary re-renders on the client.

View File

@@ -0,0 +1,5 @@
---
"@blitzjs/rpc": patch
---
Fix queries/mutations lookup on Windows

2
.github/CODEOWNERS vendored
View File

@@ -1,5 +1,5 @@
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
* @flybayer @beerose @dillonraphael
* @beerose @dillonraphael
packages/generator/templates**/* @flybayer

View File

@@ -1,6 +1,6 @@
# Contributing
[Read the Contributing Guide at Blitzjs.com](https://blitzjs.com/docs/contributing)
[Read the Contributing Guide at Blitzjs.com](https://alpha.blitzjs.com/docs/contributing)
## To run tests

View File

@@ -2,7 +2,7 @@
"name": "toolkit-app",
"version": "1.0.1-alpha.16",
"scripts": {
"start:dev": "pnpm run prisma:start && next dev",
"start:dev": "pnpm run prisma:start && blitz dev",
"buildapp": "NODE_ENV=production pnpm blitz codegen && pnpm prisma generate && next build",
"start": "next start",
"lint": "next lint",
@@ -29,7 +29,7 @@
"@blitzjs/rpc": "workspace:*",
"@hookform/resolvers": "2.8.8",
"@prisma/client": "3.9.0",
"blitz": "workspace:2.0.0-alpha.55",
"blitz": "workspace:2.0.0-alpha.57",
"next": "12.2.0",
"prisma": "4.0.0",
"react": "18.0.0",

View File

@@ -1,5 +1,34 @@
# @blitzjs/auth
## 2.0.0-alpha.57
### Patch Changes
- Updated dependencies [3511d5b6]
- blitz@2.0.0-alpha.57
## 2.0.0-alpha.56
### Patch Changes
- 3f20a474: Update `deleteSession` return type — allow undefined values
- abe2afcc: Fix a long-standing issue with occasional blitz auth flakiness
This bug would sometimes cause users to be logged out or to experience an CSRFTokenMismatchError. This bug, when encountered, usually by lots of setPublicData or session.create calls, would not set the cookie headers correctly resulting in cookies being set to a previous state or in a possibly undefined state.
There are no security concerns as far as I can tell.
- 8bcb471a: Fix auth issue where session token and publicData cookie were updated unnecessarily, leading to potential user logout
- Previously, we were updating the session token each time public data changed. This is not needed, and it would cause race condition bugs where a user could be unexpectedly logged out because a request already in flight would not match the new session token.
- Previously, we were updating the publicData cookie even when it hadn't changed. This may reduce unnecessary re-renders on the client.
- Updated dependencies [abb1ad5d]
- Updated dependencies [abe2afcc]
- Updated dependencies [0ac6e171]
- Updated dependencies [8bcb471a]
- blitz@2.0.0-alpha.56
## 2.0.0-alpha.55
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/auth",
"version": "2.0.0-alpha.55",
"version": "2.0.0-alpha.57",
"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-alpha.55",
"blitz": "2.0.0-alpha.57",
"cookie": "0.4.1",
"cookie-session": "2.0.0",
"debug": "4.3.3",
@@ -39,7 +39,7 @@
"url": "0.11.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-alpha.55",
"@blitzjs/config": "workspace:2.0.0-alpha.57",
"@testing-library/react": "13.0.0",
"@testing-library/react-hooks": "7.0.2",
"@types/cookie": "0.4.1",

View File

@@ -0,0 +1,41 @@
import {expect, describe, it} from "vitest"
import {setCookie} from "./auth-sessions"
import cookie from "cookie"
import {ServerResponse} from "http"
describe("blitz-auth", () => {
describe("setCookie", () => {
it("works with empty start", async () => {
const res = new ServerResponse({} as any)
setCookie(res, cookie.serialize("A", "a-value", {}))
expect(res.getHeader("Set-Cookie")).toBe("A=a-value")
})
it("works with string start", async () => {
const res = new ServerResponse({} as any)
res.setHeader("Set-Cookie", cookie.serialize("A", "a-value", {}))
setCookie(res, cookie.serialize("B", "b-value", {}))
expect(res.getHeader("Set-Cookie")).toEqual(["A=a-value", "B=b-value"])
})
it("works with array start for new name", async () => {
const res = new ServerResponse({} as any)
res.setHeader("Set-Cookie", [
cookie.serialize("A", "a-value", {}),
cookie.serialize("B", "b-value", {}),
])
setCookie(res, cookie.serialize("C", "c-value", {}))
expect(res.getHeader("Set-Cookie")).toEqual(["A=a-value", "B=b-value", "C=c-value"])
})
it("works with array start for existing name", async () => {
const res = new ServerResponse({} as any)
res.setHeader("Set-Cookie", [
cookie.serialize("A", "a-value", {}),
cookie.serialize("B", "b-value", {}),
])
setCookie(res, cookie.serialize("A", "new-a-value", {}))
expect(res.getHeader("Set-Cookie")).toEqual(["A=new-a-value", "B=b-value"])
})
})
})

View File

@@ -385,7 +385,7 @@ const parseAnonymousSessionToken = (token: string) => {
}
}
const setCookie = (res: ServerResponse, cookieStr: string) => {
export const setCookie = (res: ServerResponse, cookieStr: string) => {
const getCookieName = (c: string) => c.split("=", 2)[0]
const appendCookie = () => append(res, "Set-Cookie", cookieStr)
@@ -407,7 +407,7 @@ const setCookie = (res: ServerResponse, cookieStr: string) => {
for (let i = 0; i < cookiesHeader.length; i++) {
if (cookieName === getCookieName(cookiesHeader[i] || "")) {
cookiesHeader[i] = cookieStr
res.setHeader("Set-Cookie", cookieStr)
res.setHeader("Set-Cookie", cookiesHeader)
return
}
}
@@ -801,30 +801,16 @@ async function refreshSession(
const expiresAt = addYears(new Date(), 30)
setAnonymousSessionCookie(req, res, anonymousSessionToken, expiresAt)
setPublicDataCookie(req, res, publicDataToken, expiresAt)
setCSRFCookie(req, res, sessionKernel.antiCSRFToken, expiresAt)
} else if (global.sessionConfig.method === "essential" && "sessionToken" in sessionKernel) {
const expiresAt = addMinutes(new Date(), global.sessionConfig.sessionExpiryMinutes as number)
const publicDataToken = createPublicDataToken(sessionKernel.publicData)
let sessionToken: string
// Only generate new session token if public data actually changed
// Otherwise if new session token is generated just for refresh, then
// we have race condition bugs
if (publicDataChanged) {
sessionToken = createSessionToken(sessionKernel.handle, sessionKernel.publicData)
} else {
sessionToken = sessionKernel.sessionToken
}
setSessionCookie(req, res, sessionToken, expiresAt)
setPublicDataCookie(req, res, publicDataToken, expiresAt)
setCSRFCookie(req, res, sessionKernel.antiCSRFToken, expiresAt)
debug("Updating session in db with", {expiresAt})
if (publicDataChanged) {
debug("Public data has changed")
const publicDataToken = createPublicDataToken(sessionKernel.publicData)
setPublicDataCookie(req, res, publicDataToken, expiresAt)
await global.sessionConfig.updateSession(sessionKernel.handle, {
expiresAt,
hashedSessionToken: hash256(sessionToken),
publicData: JSON.stringify(sessionKernel.publicData),
})
} else {

View File

@@ -47,7 +47,7 @@ export interface SessionConfigMethods {
handle: string,
session: Partial<SessionModel>,
) => Promise<SessionModel | undefined>
deleteSession: (handle: string) => Promise<SessionModel>
deleteSession: (handle: string) => Promise<SessionModel | undefined>
}
export interface SessionConfig extends SessionConfigMethods {

View File

@@ -1,5 +1,20 @@
# @blitzjs/next
## 2.0.0-alpha.57
### Patch Changes
- 0f18c68d: Avoid reassigning queryClient in prefetch methods
- Updated dependencies [716e188d]
- @blitzjs/rpc@2.0.0-alpha.57
## 2.0.0-alpha.56
### Patch Changes
- d9fc5d8e: Allow prefetching multiple queries in gSSP and gSP
- @blitzjs/rpc@2.0.0-alpha.56
## 2.0.0-alpha.55
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/next",
"version": "2.0.0-alpha.55",
"version": "2.0.0-alpha.57",
"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-alpha.55",
"@blitzjs/rpc": "2.0.0-alpha.57",
"@types/hoist-non-react-statics": "3.3.1",
"debug": "4.3.3",
"fs-extra": "10.0.1",
@@ -33,7 +33,7 @@
"superjson": "1.8.0"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-alpha.55",
"@blitzjs/config": "workspace:2.0.0-alpha.57",
"@testing-library/dom": "8.13.0",
"@testing-library/jest-dom": "5.16.3",
"@testing-library/react": "13.0.0",
@@ -43,7 +43,7 @@
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"@types/testing-library__react-hooks": "4.0.0",
"blitz": "2.0.0-alpha.55",
"blitz": "2.0.0-alpha.57",
"cross-spawn": "7.0.3",
"find-up": "4.1.0",
"next": "12.2.0",

View File

@@ -80,6 +80,27 @@ export type BlitzAPIHandler = (
ctx: Ctx,
) => ReturnType<NextApiHandler>
const prefetchQueryFactory = (
ctx: BlitzCtx,
): {
getClient: () => QueryClient | null
prefetchQuery: AddParameters<PrefetchQueryFn, [boolean?]>
} => {
let queryClient: null | QueryClient = null
return {
getClient: () => queryClient,
prefetchQuery: async (fn, input, defaultOptions = {}, infinite = false) => {
if (!queryClient) {
queryClient = new QueryClient({defaultOptions})
}
const queryKey = infinite ? getInfiniteQueryKey(fn, input) : getQueryKey(fn, input)
await queryClient.prefetchQuery(queryKey, () => fn(input, ctx))
},
}
}
export const setupBlitzServer = ({plugins, onError}: SetupBlitzOptions) => {
const middlewares = plugins.flatMap((p) => p.requestMiddlewares)
const contextMiddleware = plugins.flatMap((p) => p.contextMiddleware).filter(Boolean)
@@ -94,26 +115,15 @@ export const setupBlitzServer = ({plugins, onError}: SetupBlitzOptions) => {
(y, f) => (f ? f(y) : y),
(res as MiddlewareResponse).blitzCtx,
)
let queryClient: null | QueryClient = null
const prefetchQuery: AddParameters<PrefetchQueryFn, [boolean?]> = async (
fn,
input,
defaultOptions = {},
infinite = false,
) => {
queryClient = new QueryClient({defaultOptions})
const queryKey = infinite ? getInfiniteQueryKey(fn, input) : getQueryKey(fn, input)
await queryClient.prefetchQuery(queryKey, () => fn(input, ctx))
}
const {getClient, prefetchQuery} = prefetchQueryFactory(ctx)
ctx.prefetchQuery = prefetchQuery
ctx.prefetchInfiniteQuery = (...args) => prefetchQuery(...args, true)
try {
const result = await handler({req, res, ctx, ...rest})
return withSuperJsonProps(withDehydratedState(result, queryClient))
return withSuperJsonProps(withDehydratedState(result, getClient()))
} catch (err: any) {
onError?.(err)
throw err
@@ -126,28 +136,14 @@ export const setupBlitzServer = ({plugins, onError}: SetupBlitzOptions) => {
): GetStaticProps<TProps, Query, PD> =>
async (context) => {
const ctx = contextMiddleware.reduceRight((y, f) => (f ? f(y) : y), {} as Ctx)
let queryClient: null | QueryClient = null
const prefetchQuery: AddParameters<PrefetchQueryFn, [boolean?]> = async (
fn,
input,
defaultOptions = {},
infinite = false,
) => {
if (!queryClient) {
queryClient = new QueryClient({defaultOptions})
}
const queryKey = infinite ? getInfiniteQueryKey(fn, input) : getQueryKey(fn, input)
await queryClient.prefetchQuery(queryKey, () => fn(input, ctx))
}
const {getClient, prefetchQuery} = prefetchQueryFactory(ctx)
ctx.prefetchQuery = prefetchQuery
ctx.prefetchInfiniteQuery = (...args) => prefetchQuery(...args, true)
try {
const result = await handler({...context, ctx: ctx})
return withSuperJsonProps(withDehydratedState(result, queryClient))
return withSuperJsonProps(withDehydratedState(result, getClient()))
} catch (err: any) {
onError?.(err)
throw err

View File

@@ -1,5 +1,26 @@
# @blitzjs/rpc
## 2.0.0-alpha.57
### Patch Changes
- 716e188d: Fix queries/mutations lookup on Windows
- Updated dependencies [3511d5b6]
- blitz@2.0.0-alpha.57
- @blitzjs/auth@2.0.0-alpha.57
## 2.0.0-alpha.56
### Patch Changes
- Updated dependencies [3f20a474]
- Updated dependencies [abb1ad5d]
- Updated dependencies [abe2afcc]
- Updated dependencies [0ac6e171]
- Updated dependencies [8bcb471a]
- @blitzjs/auth@2.0.0-alpha.56
- blitz@2.0.0-alpha.56
## 2.0.0-alpha.55
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/rpc",
"version": "2.0.0-alpha.55",
"version": "2.0.0-alpha.57",
"scripts": {
"build": "unbuild",
"predev": "wait-on -d 250 ../blitz/dist/index-server.d.ts && wait-on -d 250 ../blitz-auth/dist/index-browser.d.ts",
@@ -20,7 +20,7 @@
"dist/**"
],
"dependencies": {
"@blitzjs/auth": "2.0.0-alpha.55",
"@blitzjs/auth": "2.0.0-alpha.57",
"b64-lite": "1.4.0",
"bad-behavior": "1.0.1",
"chalk": "^4.1.0",
@@ -30,11 +30,11 @@
"zod": "3.17.3"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-alpha.55",
"@blitzjs/config": "workspace:2.0.0-alpha.57",
"@types/debug": "4.1.7",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"blitz": "2.0.0-alpha.55",
"blitz": "2.0.0-alpha.57",
"next": "12.2.0",
"react": "18.0.0",
"react-dom": "18.0.0",
@@ -43,7 +43,7 @@
"watch": "1.0.2"
},
"peerDependencies": {
"blitz": "2.0.0-alpha.55",
"blitz": "2.0.0-alpha.57",
"next": ">=12.2.0"
},
"publishConfig": {

View File

@@ -80,7 +80,7 @@ export function installWebpackConfig({
webpackRuleOptions,
}: InstallWebpackConfigOptions) {
webpackConfig.module.rules.push({
test: /\/\[\[\.\.\.blitz]]\.[jt]s$/,
test: /[\\/]\[\[\.\.\.blitz]]\.[jt]sx?$/,
use: [
{
loader: loaderServer,
@@ -146,10 +146,10 @@ export function rpcHandler(config: RpcConfig) {
"It seems your Blitz RPC endpoint file is not named [[...blitz]].(jt)s. Please ensure it is",
)
const relativeRoutePath = req.query.blitz.join("/")
const relativeRoutePath = (req.query.blitz as string[])?.join("/")
const routePath = "/" + relativeRoutePath
const loadableResolver = resolverMap[routePath]
const loadableResolver = resolverMap?.[routePath]
if (!loadableResolver) {
throw new Error("No resolver for path: " + routePath)
}

View File

@@ -1,4 +1,4 @@
import {dirname, join, posix} from "path"
import {dirname, join, posix, relative} from "path"
import {promises} from "fs"
import {
assertPosixPath,
@@ -37,6 +37,10 @@ export async function loader(this: Loader, input: string): Promise<string> {
module.exports = loader
function slash(str: string) {
return str.replace(/\\/g, "/")
}
export async function transformBlitzRpcServer(
src: string,
id: string,
@@ -54,7 +58,7 @@ export async function transformBlitzRpcServer(
code += "\n\n"
for (let resolverFilePath of resolvers) {
const relativeResolverPath = posix.relative(dirname(id), join(root, resolverFilePath))
const relativeResolverPath = slash(relative(dirname(id), join(root, resolverFilePath)))
const routePath = convertPageFilePathToRoutePath(resolverFilePath, options?.resolverPath)
code += `__internal_addBlitzRpcResolver('${routePath}', () => import('${relativeResolverPath}'));`
code += "\n"

View File

@@ -1,5 +1,30 @@
# blitz
## 2.0.0-alpha.57
### Patch Changes
- 3511d5b6: Temporarily skip version check
- @blitzjs/generator@2.0.0-alpha.57
## 2.0.0-alpha.56
### Patch Changes
- abb1ad5d: Improve codemod utilities
- abe2afcc: Fix a long-standing issue with occasional blitz auth flakiness
This bug would sometimes cause users to be logged out or to experience an CSRFTokenMismatchError. This bug, when encountered, usually by lots of setPublicData or session.create calls, would not set the cookie headers correctly resulting in cookies being set to a previous state or in a possibly undefined state.
There are no security concerns as far as I can tell.
- 0ac6e171: fixes blitz not loading custom server
- 8bcb471a: Fix auth issue where session token and publicData cookie were updated unnecessarily, leading to potential user logout
- Previously, we were updating the session token each time public data changed. This is not needed, and it would cause race condition bugs where a user could be unexpectedly logged out because a request already in flight would not match the new session token.
- Previously, we were updating the publicData cookie even when it hadn't changed. This may reduce unnecessary re-renders on the client.
- @blitzjs/generator@2.0.0-alpha.56
## 2.0.0-alpha.55
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "blitz",
"version": "2.0.0-alpha.55",
"version": "2.0.0-alpha.57",
"scripts": {
"build": "unbuild",
"dev": "watch unbuild src --wait=0.2",
@@ -23,7 +23,7 @@
"blitz": "bin/blitz"
},
"dependencies": {
"@blitzjs/generator": "2.0.0-alpha.55",
"@blitzjs/generator": "2.0.0-alpha.57",
"arg": "5.0.1",
"boxen": "7.0.0",
"chalk": "^4.1.0",
@@ -54,7 +54,7 @@
"watchpack": "2.1.1"
},
"devDependencies": {
"@blitzjs/config": "workspace:2.0.0-alpha.55",
"@blitzjs/config": "workspace:2.0.0-alpha.57",
"@types/cookie": "0.4.1",
"@types/cross-spawn": "6.0.2",
"@types/debug": "4.1.7",

View File

@@ -219,7 +219,7 @@ const determinePkgManagerToInstallDeps = async () => {
}
const newApp: CliCommand = async (argv) => {
const shouldUpgrade = !args["--skip-upgrade"]
const shouldUpgrade = false // !args["--skip-upgrade"]
if (shouldUpgrade) {
await checkLatestVersion()
}

View File

@@ -10,7 +10,7 @@ import type {ServerConfig} from "./config"
const debug = require("debug")("blitz:utils")
export function getProjectRootSync() {
return path.dirname(process.cwd())
return process.cwd()
}
export function getCustomServerPath() {

View File

@@ -1,5 +1,24 @@
# @blitzjs/codemod
## 2.0.0-alpha.57
### Patch Changes
- Updated dependencies [3511d5b6]
- blitz@2.0.0-alpha.57
- @blitzjs/generator@2.0.0-alpha.57
## 2.0.0-alpha.56
### Patch Changes
- Updated dependencies [abb1ad5d]
- Updated dependencies [abe2afcc]
- Updated dependencies [0ac6e171]
- Updated dependencies [8bcb471a]
- blitz@2.0.0-alpha.56
- @blitzjs/generator@2.0.0-alpha.56
## 2.0.0-alpha.55
### Patch Changes

View File

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

View File

@@ -224,7 +224,16 @@ export function getAllFiles(
skipDirs?: string[],
allowedExt?: string[],
) {
let currentFiles = fs.readdirSync(dirPath)
let currentFiles: string[] = []
try {
currentFiles = fs.readdirSync(dirPath)
} catch (e: any) {
if (e.code === "ENOENT") {
return []
}
throw e
}
currentFiles.forEach((file) => {
if (fs.statSync(dirPath + "/" + file).isDirectory()) {

View File

@@ -1,5 +1,9 @@
# @blitzjs/config
## 2.0.0-alpha.57
## 2.0.0-alpha.56
## 2.0.0-alpha.55
## 2.0.0-alpha.54

View File

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

View File

@@ -1,5 +1,9 @@
# @blitzjs/generator
## 2.0.0-alpha.57
## 2.0.0-alpha.56
## 2.0.0-alpha.55
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@blitzjs/generator",
"version": "2.0.0-alpha.55",
"version": "2.0.0-alpha.57",
"scripts": {
"dev": "watch unbuild src --wait=0.2",
"build": "unbuild && pnpm build:templates",
@@ -45,7 +45,7 @@
"vinyl": "2.2.1"
},
"devDependencies": {
"@blitzjs/config": "2.0.0-alpha.55",
"@blitzjs/config": "2.0.0-alpha.57",
"@juanm04/cpx": "2.0.1",
"@types/babel__core": "7.1.19",
"@types/diff": "5.0.2",

View File

@@ -25,7 +25,7 @@
"@typescript-eslint/parser": "5.9.1"
},
"devDependencies": {
"@blitzjs/config": "2.0.0-alpha.55",
"@blitzjs/config": "2.0.0-alpha.57",
"@types/react": "18.0.1",
"@types/react-dom": "17.0.14",
"react": "18.0.0",

45
pnpm-lock.yaml generated
View File

@@ -49,7 +49,7 @@ importers:
"@types/preview-email": 2.0.1
"@types/react": 18.0.1
"@typescript-eslint/eslint-plugin": 5.9.1
blitz: workspace:2.0.0-alpha.54
blitz: workspace:2.0.0-alpha.56
eslint: 7.32.0
eslint-config-next: 12.2.0
eslint-config-prettier: 8.5.0
@@ -324,7 +324,7 @@ importers:
"@vitejs/plugin-react": 1.3.0
delay: 5.0.0
eslint: 7.32.0
eslint-config-next: 12.2.2_hrkuebk64jiu2ut2d2sm4oylnu
eslint-config-next: 12.2.3_hrkuebk64jiu2ut2d2sm4oylnu
eslint-plugin-testing-library: 5.0.1_hrkuebk64jiu2ut2d2sm4oylnu
jsdom: 19.0.0
typescript: 4.6.3
@@ -475,8 +475,8 @@ importers:
packages/blitz:
specifiers:
"@blitzjs/config": workspace:2.0.0-alpha.54
"@blitzjs/generator": 2.0.0-alpha.54
"@blitzjs/config": workspace:2.0.0-alpha.56
"@blitzjs/generator": 2.0.0-alpha.56
"@types/cookie": 0.4.1
"@types/cross-spawn": 6.0.2
"@types/debug": 4.1.7
@@ -584,7 +584,7 @@ importers:
packages/blitz-auth:
specifiers:
"@blitzjs/config": workspace:2.0.0-alpha.54
"@blitzjs/config": workspace:2.0.0-alpha.56
"@testing-library/react": 13.0.0
"@testing-library/react-hooks": 7.0.2
"@types/b64-lite": 1.3.0
@@ -598,7 +598,7 @@ importers:
"@types/secure-password": 3.1.1
b64-lite: 1.4.0
bad-behavior: 1.0.1
blitz: 2.0.0-alpha.54
blitz: 2.0.0-alpha.56
cookie: 0.4.1
cookie-session: 2.0.0
debug: 4.3.3
@@ -649,8 +649,8 @@ importers:
packages/blitz-next:
specifiers:
"@blitzjs/config": workspace:2.0.0-alpha.54
"@blitzjs/rpc": 2.0.0-alpha.54
"@blitzjs/config": workspace:2.0.0-alpha.56
"@blitzjs/rpc": 2.0.0-alpha.56
"@testing-library/dom": 8.13.0
"@testing-library/jest-dom": 5.16.3
"@testing-library/react": 13.0.0
@@ -661,7 +661,7 @@ importers:
"@types/react": 18.0.1
"@types/react-dom": 17.0.14
"@types/testing-library__react-hooks": 4.0.0
blitz: 2.0.0-alpha.54
blitz: 2.0.0-alpha.56
cross-spawn: 7.0.3
debug: 4.3.3
find-up: 4.1.0
@@ -710,14 +710,14 @@ importers:
packages/blitz-rpc:
specifiers:
"@blitzjs/auth": 2.0.0-alpha.54
"@blitzjs/config": workspace:2.0.0-alpha.54
"@blitzjs/auth": 2.0.0-alpha.56
"@blitzjs/config": workspace:2.0.0-alpha.56
"@types/debug": 4.1.7
"@types/react": 18.0.1
"@types/react-dom": 17.0.14
b64-lite: 1.4.0
bad-behavior: 1.0.1
blitz: 2.0.0-alpha.54
blitz: 2.0.0-alpha.56
chalk: ^4.1.0
debug: 4.3.3
next: 12.2.0
@@ -759,12 +759,12 @@ importers:
"@babel/plugin-syntax-typescript": 7.17.12
"@babel/preset-env": 7.12.10
"@blitzjs/config": workspace:*
"@blitzjs/generator": 2.0.0-alpha.54
"@blitzjs/generator": 2.0.0-alpha.56
"@types/jscodeshift": 0.11.2
"@types/node": 17.0.16
arg: 5.0.1
ast-types: 0.14.2
blitz: 2.0.0-alpha.54
blitz: 2.0.0-alpha.56
chalk: ^4.1.0
cross-spawn: 7.0.3
debug: 4.3.3
@@ -819,7 +819,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-alpha.54
"@blitzjs/config": 2.0.0-alpha.56
"@juanm04/cpx": 2.0.1
"@mrleebo/prisma-ast": 0.2.6
"@types/babel__core": 7.1.19
@@ -910,7 +910,7 @@ importers:
packages/pkg-template:
specifiers:
"@blitzjs/config": 2.0.0-alpha.54
"@blitzjs/config": 2.0.0-alpha.56
"@types/react": 18.0.1
"@types/react-dom": 17.0.14
"@typescript-eslint/eslint-plugin": 5.9.1
@@ -3451,10 +3451,10 @@ packages:
dependencies:
glob: 7.1.7
/@next/eslint-plugin-next/12.2.2:
/@next/eslint-plugin-next/12.2.3:
resolution:
{
integrity: sha512-XOi0WzJhGH3Lk51SkSu9eZxF+IY1ZZhWcJTIGBycAbWU877IQa6+6KxMATWCOs7c+bmp6Sd8KywXJaDRxzu0JA==,
integrity: sha512-B2e8Yg1MpuLsGxhCx4rU8/Tcnr5wFmCx1O2eyLXBPnaCcsFXfGCo067ujagtDLtWASL3GNgzg78U1SB0dbc38A==,
}
dependencies:
glob: 7.1.7
@@ -4844,7 +4844,6 @@ packages:
typescript: 4.6.3
transitivePeerDependencies:
- supports-color
dev: false
/@typescript-eslint/experimental-utils/5.28.0_hrkuebk64jiu2ut2d2sm4oylnu:
resolution:
@@ -8442,12 +8441,11 @@ packages:
transitivePeerDependencies:
- eslint-import-resolver-webpack
- supports-color
dev: false
/eslint-config-next/12.2.2_hrkuebk64jiu2ut2d2sm4oylnu:
/eslint-config-next/12.2.3_hrkuebk64jiu2ut2d2sm4oylnu:
resolution:
{
integrity: sha512-oJhWBLC4wDYYUFv/5APbjHUFd0QRFCojMdj/QnMoOEktmeTvwnnoA8F8uaXs0fQgsaTK0tbUxBRv9/Y4/rpxOA==,
integrity: sha512-xAQqAqwa2bu9ZMRypz58ym4tNCo22Wc6LuoLpbpf3yW5c4ZkVib9934AgGDDvh2zKrP56Z6X0Pp6gNnuuZzcRw==,
}
peerDependencies:
eslint: ^7.23.0 || ^8.0.0
@@ -8456,7 +8454,7 @@ packages:
typescript:
optional: true
dependencies:
"@next/eslint-plugin-next": 12.2.2
"@next/eslint-plugin-next": 12.2.3
"@rushstack/eslint-patch": 1.1.3
"@typescript-eslint/parser": 5.28.0_hrkuebk64jiu2ut2d2sm4oylnu
eslint: 7.32.0
@@ -8480,7 +8478,6 @@ packages:
hasBin: true
peerDependencies:
eslint: ">=7.0.0"
dev: false
/eslint-config-prettier/8.5.0_eslint@7.32.0:
resolution: