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

Version Packages (beta) #4083

Merged
merged 2 commits into from Mar 31, 2023
Merged

Version Packages (beta) #4083

merged 2 commits into from Mar 31, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 13, 2023

Blitz Toolkit Beta v24

Support for Next 13

Blitz does not require any breaking changes with the major upgrade of Next 12Next 13 for usage with the pages directory. You can even continue to use the old blitz layout with all your files in app. But you'll need to rename that directory if you want to use the new Next.js app router.

Read More about usage of Blitz Toolkit with Next 13

cadefb8 & 37aeaa7: Support for Next 13 App directory (beta)

From this release, the blitz toolkit will work out of the box with react server components.

Here are the highlights:

  • New Blitz Auth Function getBlitzCtx to access the auth context in server components
  • New Blitz Auth Function useAuthenticatedBlitzContext to provide authorization utilities for server components
  • New wrapper BlitzProvider to be wrapped in the RootLayout present in the (root)/layout.ts file.
  • Overload the invoke method to work when called inside a React Server Component

Patch for Next 13.2 Suspense Error

acc07ce: This updates the suspense patch to work with Next.js 13.2+. Hopefully, soon we can stop patching once Next.js catches up with all the other frameworks and properly exposes the onRecoverableError react hook.

🔨 Breaking Changes

9529dbd: Introducing a new import path for the Blitz wrapper SecurePassword to fully decouple the library from @blitzjs/auth

Change to be made

-import {SecurePassword} from "@blitzjs/auth"
+import {SecurePassword} from "@blitzjs/auth/secure-password"

Automatic Upgrade

Automatically upgrade using codemod
(Make sure to git commit before running this command to avoid losing changes)

npx @blitz/codemod secure-password

🚀 New Features

6f18cbd: Next Auth Adapter

Blitz now provides an adapter that allows you to use any NextAuth Provider with Blitz session management in any Nextjs application.
Blitz session management gives you a lot more flexibility & control than NextAuth does.

Usage

// src/pages/api/auth/[...nextauth].ts
import { api } from "src/blitz-server"
import { NextAuthAdapter } from "@blitzjs/auth/next-auth"
import GithubProvider from "next-auth/providers/github"
import db, { User } from "db"
import { Role } from "types"

// Has to be defined separately for `profile` to be correctly typed below
const providers = [
  GithubProvider({
    clientId: process.env.GITHUB_CLIENT_ID as string,
    clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
  }),
]

export default api(
  NextAuthAdapter({
    successRedirectUrl: "/",
    errorRedirectUrl: "/error",
    providers,
    callback: async (user, account, profile, session) => {
      ...
    },
  })
)

Read More here

ea7561b: Blitz Generator Overhaul

The Blitz generator has been completely overhauled to be more flexible, customizable and easier to use.

Credits

The comes as a cumulative effort from the work started by @maastrich in #2134 then continued and enhanced by @Roesh in #2679 and finally fixed and polished by @siddhsuresh in #3869 .

Changes/Features

  • Model Fields can now be specified in the generator command
> blitz generate model [fieldName]:[type]:[attribute]

Usage

> blitz generate all project name
> blitz generate all project name:string description:string? active:boolean
# with parent
> blitz generate model task \
       name \
       completed:boolean:default=false \
       belongsTo:project?
  • The generate command can also be run multiple times to add more fields to the model. The generator will then mention the changes that will be made to the model and ask for confirmation before proceeding.

  • ea7561b: New schema.ts file will be generated with the required zod schemas that can be used independently with the mutations, queries and components.
    This fixes the problem of not being able to import the schemas defined in the mutations due to the RPC compilation

Security Fixes

6e88a84: Fixed security vulnerabilities in passport-adapter by upgrading passport and jsonwebtoken.

Testing Utility Fixes

cadefb8: Fix failing tests due to the error NextRouter is not mounted in next 13 blitz apps.

Template Fixes

Credits

This release was made possible by the following contributors:

@flybayer, @siddhsuresh, @noxify, @tordans, @Vandivier, @exKAZUu

@github-actions github-actions bot force-pushed the changeset-release/main branch 3 times, most recently from c9559b0 to bea254f Compare February 16, 2023 17:24
@github-actions github-actions bot force-pushed the changeset-release/main branch 5 times, most recently from e01da4b to 6080c7f Compare March 24, 2023 18:06
@github-actions github-actions bot force-pushed the changeset-release/main branch 4 times, most recently from ac74453 to adc8a09 Compare March 29, 2023 18:07
@siddhsuresh siddhsuresh merged commit f2da4f1 into main Mar 31, 2023
29 checks passed
@siddhsuresh siddhsuresh deleted the changeset-release/main branch March 31, 2023 18:00
@blitzjs-bot blitzjs-bot added this to Done in Toolkit Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants