Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new blitz app starter #4146

Merged
merged 115 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
5b01468
new blitz app starter
siddhsuresh May 15, 2023
b323b3b
tanstack form first time working
siddhsuresh May 15, 2023
690eec2
complete app template
siddhsuresh May 16, 2023
863aa78
re-arrange generator folders
siddhsuresh May 16, 2023
000c6be
add app router as recomended
siddhsuresh May 16, 2023
7e41fee
Merge branch 'main' into tanstack-form
siddhsuresh May 16, 2023
fb46939
Merge branch 'main' into tanstack-form
siddhsuresh Jun 5, 2023
f3d53e1
upgrade to next 13.5.2 and update location of internal function
siddhsuresh Sep 22, 2023
afccc80
Create lucky-teachers-sleep.md
siddhsuresh Sep 22, 2023
0db3e6f
fix bootupMarkers
siddhsuresh Oct 1, 2023
9cb4412
fix issues with qm integration test
siddhsuresh Oct 1, 2023
afc6e21
Update integration-tests/utils/next-test-utils.ts
siddhsuresh Oct 1, 2023
daf443e
next.js generated stuff
siddhsuresh Oct 1, 2023
ef07316
Merge branch 'siddharth/fix-resolve-href-not-found' of https://github…
siddhsuresh Oct 1, 2023
c51e6bc
Update .changeset/lucky-teachers-sleep.md
siddhsuresh Oct 1, 2023
3226b2e
remove unnecessary next lints to the integration-tests
siddhsuresh Oct 1, 2023
a71660b
Merge branch 'siddharth/fix-resolve-href-not-found' of https://github…
siddhsuresh Oct 1, 2023
260deac
Update main.yml
siddhsuresh Oct 1, 2023
9ed7d4a
Revert "remove unnecessary next lints to the integration-tests"
siddhsuresh Oct 1, 2023
a3002aa
Merge branch 'siddharth/fix-resolve-href-not-found' of https://github…
siddhsuresh Oct 1, 2023
d9265ae
Merge branch 'main' into tanstack-form
siddhsuresh Oct 1, 2023
fe8ba7e
Merge branch 'siddharth/fix-resolve-href-not-found' into tanstack-form
siddhsuresh Oct 1, 2023
db1d020
fix starter with tanstack form
siddhsuresh Oct 2, 2023
c746ede
make changes to the generator
siddhsuresh Oct 2, 2023
4b12480
mske final changes
siddhsuresh Oct 2, 2023
a0d8fbe
Merge branch 'main' into tanstack-form
siddhsuresh Oct 3, 2023
a456429
pnpm lock fix
siddhsuresh Oct 3, 2023
82e5f34
more changes
siddhsuresh Oct 3, 2023
ef4f077
add logging to rsc invoke and decouple auth from rpc again
siddhsuresh Oct 8, 2023
71de242
implement object chaining
siddhsuresh Oct 9, 2023
1e3ec78
add `onInvokeError` options to catch errors without manual wrapping
siddhsuresh Oct 9, 2023
3316163
rename `LoggerOptions` to `RpcLoggerOptions`
siddhsuresh Oct 9, 2023
b0e566c
spacing
siddhsuresh Oct 9, 2023
92395e8
fix error typed to `any`
siddhsuresh Oct 9, 2023
0b76110
update class code
siddhsuresh Oct 14, 2023
3c159d0
tests working again
siddhsuresh Oct 14, 2023
a43edb8
add last test case proving working modal of roles
siddhsuresh Oct 14, 2023
7d0d814
Create moody-pandas-do.md
siddhsuresh Oct 14, 2023
86c2458
Apply suggestions from code review
siddhsuresh Oct 14, 2023
87274b9
Merge branch 'main' into siddharth/add-logging-to-rsc-invoke
siddhsuresh Oct 15, 2023
e4084c0
Merge branch 'main' into tanstack-form
siddhsuresh Oct 15, 2023
c4de0c4
Merge branch 'siddharth/add-logging-to-rsc-invoke' into tanstack-form
siddhsuresh Oct 15, 2023
695a38b
move app -> `src/app`
siddhsuresh Oct 15, 2023
442bf07
move from auth -> (auth) directory structure
siddhsuresh Oct 15, 2023
c39df0b
review 1 fixes
siddhsuresh Oct 15, 2023
9416f4a
missing change from auth -> (auth) change
siddhsuresh Oct 15, 2023
038fc8d
review 2: more fixes and match old behaviour
siddhsuresh Oct 15, 2023
cd128d3
pnpm lock fix
siddhsuresh Oct 15, 2023
006da22
add new pages to the `pathsToMove` array
siddhsuresh Oct 15, 2023
0ef1cb0
remove submodule
siddhsuresh Oct 15, 2023
df5a066
remove changelog from the template
siddhsuresh Oct 15, 2023
78c61f6
fix name of .env
siddhsuresh Oct 15, 2023
6be946e
match readme
siddhsuresh Oct 15, 2023
75f2868
march prisma schema
siddhsuresh Oct 15, 2023
960cf5b
match package.json
siddhsuresh Oct 15, 2023
94730fc
match blitz-client and blitz-server files
siddhsuresh Oct 15, 2023
90056b3
remove vercel logo
siddhsuresh Oct 15, 2023
c0d7f54
remove `next13`
siddhsuresh Oct 15, 2023
cf46c09
upgrade next and add husky
siddhsuresh Oct 15, 2023
8a0a40f
fix build error
siddhsuresh Oct 16, 2023
a0fdbf3
Create poor-bikes-wait.md
siddhsuresh Oct 16, 2023
67a31fa
Revert "remove `next13`"
siddhsuresh Oct 16, 2023
72289b2
remove next13
siddhsuresh Oct 16, 2023
2423ff4
re-add next 13 that exists in main
siddhsuresh Oct 16, 2023
e6ce94c
Apply suggestions from code review
siddhsuresh Oct 16, 2023
e87774b
pnpm lock
siddhsuresh Oct 16, 2023
422a741
Merge branch 'tanstack-form' of https://github.com/blitz-js/blitz int…
siddhsuresh Oct 16, 2023
99e76c1
Merge branch 'main' into tanstack-form
siddhsuresh Oct 24, 2023
d21325b
improvements to the template
siddhsuresh Oct 24, 2023
f62e217
fix location of imports in `reset-password` page
siddhsuresh Oct 24, 2023
2d5c878
Merge branch 'main' into tanstack-form
siddhsuresh Oct 24, 2023
96613be
Update packages/blitz/src/cli/commands/new.ts
siddhsuresh Oct 24, 2023
20a4d81
Update packages/generator/templates/app/src/pages/api/rpc/blitzrpcrou…
siddhsuresh Oct 24, 2023
0601bc3
fix auth -> (auth)
siddhsuresh Oct 31, 2023
b862519
Update packages/generator/templates/app/src/app/layout.tsx
siddhsuresh Oct 31, 2023
ddbda8e
Apply suggestions from code review
siddhsuresh Oct 31, 2023
bd463ea
abstact forms as client compoennts and pages as rscs
siddhsuresh Oct 31, 2023
a6ac10c
re-add proper singup mutation
siddhsuresh Oct 31, 2023
14549c7
remove console.log
siddhsuresh Oct 31, 2023
6c70119
fix additonal forms
siddhsuresh Oct 31, 2023
1ebcb06
Merge branch 'main' into tanstack-form
siddhsuresh Oct 31, 2023
c03a005
pnpm lock fix
siddhsuresh Oct 31, 2023
0b65bae
fix missing ,
siddhsuresh Oct 31, 2023
e7faa85
Add project package manager to postInstallSteps
siddhsuresh Nov 27, 2023
cb6f346
add husky
siddhsuresh Nov 28, 2023
e5b69a5
move to devDeps
siddhsuresh Nov 28, 2023
b7b06cb
add preview email
siddhsuresh Nov 28, 2023
dc03526
remove extra components folder
siddhsuresh Nov 28, 2023
fb3f2eb
add 800px as maximum of body size
siddhsuresh Nov 28, 2023
18da91d
remove auth from reset-password url
siddhsuresh Nov 28, 2023
737e175
fix non-existant compoennts
siddhsuresh Nov 28, 2023
0cef2f3
pnpm
siddhsuresh Nov 28, 2023
9511548
Merge branch 'main' into tanstack-form
siddhsuresh Nov 28, 2023
9ab726a
fix favicon
siddhsuresh Nov 28, 2023
783fa30
package.json fixes
siddhsuresh Nov 28, 2023
f88778b
revert to `latest`
siddhsuresh Nov 28, 2023
f5b34fa
move to `devDeps`
siddhsuresh Nov 28, 2023
3a82aec
add display names
siddhsuresh Nov 28, 2023
535d078
make it a template
siddhsuresh Dec 6, 2023
aaa52f4
new route generator
siddhsuresh Dec 6, 2023
4de4171
fidnally got it working
siddhsuresh Dec 6, 2023
0509c70
add `isAppDir` check
siddhsuresh Dec 6, 2023
776dfa7
should be the final changes
siddhsuresh Dec 12, 2023
d02e131
fix
siddhsuresh Dec 12, 2023
d39541d
fix import error
siddhsuresh Dec 12, 2023
6162797
revert
siddhsuresh Dec 12, 2023
48839d5
make zod optional when needed
siddhsuresh Dec 20, 2023
c231bd9
fix tests
siddhsuresh Dec 20, 2023
25231a6
Merge branch 'main' into tanstack-form
siddhsuresh Dec 20, 2023
8e89993
fix nullable issue
siddhsuresh Dec 29, 2023
19bd760
Update packages/blitz-auth/src/server/auth-sessions.ts
siddhsuresh Dec 29, 2023
3d19f08
new folder structure
siddhsuresh Dec 29, 2023
8f09bc7
Merge branch 'tanstack-form' of https://github.com/blitz-js/blitz int…
siddhsuresh Dec 29, 2023
e7e1bf9
Merge branch 'main' into tanstack-form
siddhsuresh Dec 29, 2023
bdad2fa
Merge branch 'main' into tanstack-form
siddhsuresh Jan 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/poor-bikes-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@blitzjs/generator": patch
---

new blitz app starter
4 changes: 3 additions & 1 deletion .changeset/sixty-rockets-count.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
### Now we can configure Blitz RPC in the following way,

In your `[[...blitz]].ts` api file you can see the following settings

```ts
logging?: {
/**
Expand All @@ -29,6 +30,7 @@ logging?: {
disablelevel?: "debug" | "info"
}
```

```ts
import { rpcHandler } from "@blitzjs/rpc"
import { api } from "src/blitz-server"
Expand All @@ -48,6 +50,7 @@ export default api(
```

Example:

```ts
export default api(
rpcHandler({
Expand All @@ -65,4 +68,3 @@ export default api(
```

This is enable verbose blitz rpc logging for all resolvers except the resolvers `getCurrentUser` and others mentioned in the `blockList`

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useAuthenticatedBlitzContext} from "../../src/blitz-server"
import {useAuthenticatedBlitzContext} from "../../blitz-server"

export default async function RootLayout({children}: {children: React.ReactNode}) {
await useAuthenticatedBlitzContext({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import {LoginForm} from "../../../src/auth/components/LoginForm"
import {LoginForm} from "../../../auth/components/LoginForm"
import {useRouter} from "next/navigation"
import {useSearchParams} from "next/navigation"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"

import {useRouter} from "next/navigation"
import SignupForm from "../../../src/auth/components/SignupForm"
import SignupForm from "../../../auth/components/SignupForm"

const SignUp = () => {
const router = useRouter()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "src/styles/globals.css"
import {BlitzProvider} from "../src/blitz-client"
import {BlitzProvider} from "../blitz-client"
import styles from "src/styles/Home.module.css"

export default function RootLayout({children}: {children: React.ReactNode}) {
Expand Down
4 changes: 2 additions & 2 deletions apps/next13/app/page.tsx → apps/next13/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Link from "next/link"
import styles from "src/styles/Home.module.css"
import Test from "./react-query"
import {invoke, useAuthenticatedBlitzContext} from "../src/blitz-server"
import getCurrentUser from "../src/users/queries/getCurrentUser"
import {invoke, useAuthenticatedBlitzContext} from "../blitz-server"
import getCurrentUser from "../users/queries/getCurrentUser"

export default async function Home() {
await useAuthenticatedBlitzContext({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client"

import {useQuery, useMutation} from "@blitzjs/rpc"
import logout from "../src/auth/mutations/logout"
import getCurrentUser from "../src/users/queries/getCurrentUser"
import logout from "../auth/mutations/logout"
import getCurrentUser from "../users/queries/getCurrentUser"
import {useTransition} from "react"
import {useRouter} from "next/navigation"

Expand Down
7 changes: 3 additions & 4 deletions apps/next13/src/auth/mutations/signup.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import db from "../../../prisma"
// import {SecurePassword} from "@blitzjs/auth"
import {SecurePassword} from "@blitzjs/auth/secure-password"

export default async function signup(input: {password: string; email: string}, ctx: any) {
const blitzContext = ctx
// const hashedPassword = await SecurePassword.hash((input.password as string) || "test-password")
const hashedPassword = (input.password as string) || "test-password"
const email = (input.email as string) || "test" + Math.random() + "@test.com"
const hashedPassword = await SecurePassword.hash((input.password as string) || "test-password")
const email = input.email
const user = await db.user.create({
data: {email, hashedPassword},
})
Expand Down
7 changes: 6 additions & 1 deletion apps/toolkit-app/src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { api } from "src/blitz-server"
import GithubProvider from "next-auth/providers/github"
import { NextAuthAdapter } from "@blitzjs/auth/next-auth"
import EmailProvider from "next-auth/providers/email"
import { NextAuthAdapter, BlitzNextAuthOptions } from "@blitzjs/auth/next-auth"
import db, { User } from "db"
import { Role } from "types"

Expand All @@ -10,6 +11,10 @@ const providers = [
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
}),
EmailProvider({
from: process.env.GITHUB_CLIENT_ID as string,
server: process.env.GITHUB_CLIENT_SECRET as string,
}),
]

export default api(
Expand Down
1 change: 0 additions & 1 deletion apps/toolkit-app/src/pages/auth/reset-password.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useEffect, useState } from "react"
import Layout from "src/core/layouts/Layout"
import { LabeledTextField } from "src/core/components/LabeledTextField"
import { Form, FORM_ERROR } from "src/core/components/Form"
Expand Down
4 changes: 2 additions & 2 deletions apps/toolkit-app/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ const UserInfo = () => {
} else {
return (
<>
<Link href={"/signup"} className={styles.button}>
<Link href={"/auth/signup"} className={styles.button}>
<strong>Sign Up</strong>
</Link>
<Link href={"/login"} className={styles.loginButton}>
<Link href={"/auth/login"} className={styles.loginButton}>
<strong>Login</strong>
</Link>
<Link href="/api/auth/github/login" passHref legacyBehavior>
Expand Down
32 changes: 0 additions & 32 deletions apps/toolkit-app/test/index.test.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions apps/toolkit-app/test/setup.ts

This file was deleted.

106 changes: 0 additions & 106 deletions apps/toolkit-app/test/utils.tsx

This file was deleted.

4 changes: 4 additions & 0 deletions packages/blitz-rpc/src/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
createServerPlugin,
} from "blitz"
import {invoke} from "./invoke"
import {RpcLogger} from "../rpc-logger"

export type RpcLoggerOptions = {
/**
Expand Down Expand Up @@ -47,6 +48,9 @@ export const RpcServerPlugin = createServerPlugin((options: RpcPluginOptions) =>
} catch (error) {
if (options.onInvokeError) {
options.onInvokeError(error)
} else {
const rpcLogger = new RpcLogger((queryFn as any)._resolverName, options.logging)
rpcLogger.error(error)
}
throw error
}
Expand Down
17 changes: 11 additions & 6 deletions packages/blitz/src/cli/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ import {CliCommand} from "../index"
import prompts from "prompts"
import {
capitalize,
pluralCamel,
pluralPascal,
singleCamel,
singlePascal,
uncapitalize,
PageGenerator,
FormGenerator,
QueriesGenerator,
MutationGenerator,
MutationsGenerator,
RouteGenerator,
ModelGenerator,
QueryGenerator,
ValidationsGenerator,
Expand All @@ -23,6 +20,7 @@ import {
customTemplatesBlitzConfig,
} from "@blitzjs/generator"
import {log} from "../../logging"
import fs from "fs-extra"

const getIsTypeScript = async () =>
require("fs").existsSync(require("path").join(process.cwd(), "tsconfig.json"))
Expand Down Expand Up @@ -72,18 +70,25 @@ const createCustomTemplates = async () => {
process.exit(0)
}

const nextAppDirectory = fs.existsSync(require("path").join(process.cwd(), "src/app/layout.tsx"))
? "app"
: "pages"

const generatorMap = {
[ResourceType.All]: [
PageGenerator,
FormGenerator,
QueriesGenerator,
MutationsGenerator,
ValidationsGenerator,
ModelGenerator,
nextAppDirectory === "app" ? RouteGenerator : PageGenerator,
],
[ResourceType.Crud]: [MutationsGenerator, QueriesGenerator, ValidationsGenerator],
[ResourceType.Model]: [ModelGenerator],
[ResourceType.Pages]: [PageGenerator, FormGenerator],
[ResourceType.Pages]: [
FormGenerator,
nextAppDirectory === "app" ? RouteGenerator : PageGenerator,
],
[ResourceType.Queries]: [QueriesGenerator],
[ResourceType.Query]: [QueryGenerator],
[ResourceType.Mutations]: [MutationsGenerator, ValidationsGenerator],
Expand Down
Loading
Loading