-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update some stuff * prettier * apply some install flags * properly apply flags * formatting * refactor * fix flags * Update cli/template/addons/next-auth/_npmrc Co-authored-by: Julius Marminge <[email protected]> * Create fluffy-masks-explain.md Co-authored-by: Christopher Ehrlich <[email protected]>
- Loading branch information
1 parent
4bde030
commit f1673eb
Showing
36 changed files
with
165 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"create-t3-app": minor | ||
--- | ||
|
||
feat: update dependency Next.js to 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,51 @@ | ||
import chalk from "chalk"; | ||
import { execa } from "execa"; | ||
import ora from "ora"; | ||
import { PkgInstallerMap } from "~/installers/index.js"; | ||
import { getUserPkgManager } from "~/utils/getUserPkgManager.js"; | ||
import { logger } from "~/utils/logger.js"; | ||
|
||
export const installDependencies = async (projectDir: string) => { | ||
type Options = { | ||
projectDir: string; | ||
packages: PkgInstallerMap; | ||
}; | ||
|
||
export const installDependencies = async ({ | ||
projectDir, | ||
packages, | ||
}: Options) => { | ||
logger.info("Installing dependencies..."); | ||
const pkgManager = getUserPkgManager(); | ||
const spinner = ora(`Running ${pkgManager} install...\n`).start(); | ||
let flags: string[] = []; | ||
|
||
// FIXME: temp fix for next-auth with node 18 | ||
// FIXME: temp fix for NextAuth.js with node 18/19 | ||
// see: https://github.com/nextauthjs/next-auth/issues/4575 | ||
if ( | ||
process.versions.node.startsWith("18") || | ||
process.versions.node.startsWith("19") | ||
) { | ||
if (pkgManager === "yarn") { | ||
await execa(pkgManager, ["add", "--ignore-engines", "true"], { | ||
cwd: projectDir, | ||
}); | ||
} else { | ||
await execa(pkgManager, ["install", "--engine-strict", "false"], { | ||
cwd: projectDir, | ||
}); | ||
} | ||
} else { | ||
await execa(pkgManager, ["install"], { cwd: projectDir }); | ||
flags = [ | ||
...flags, | ||
...(pkgManager === "yarn" | ||
? ["--ignore-engines", "true"] | ||
: ["--engine-strict", "false"]), | ||
]; | ||
} | ||
|
||
// FIXME: temp fix for NextAuth.js with Next.js 13 | ||
if (packages.nextAuth.inUse) { | ||
flags = [ | ||
...flags, | ||
...(pkgManager === "pnpm" | ||
? ["--strict-peer-dependencies", "false"] | ||
: pkgManager === "npm" | ||
? ["--legacy-peer-deps", "true"] | ||
: []), | ||
]; | ||
} | ||
|
||
await execa(pkgManager, ["install", ...flags], { cwd: projectDir }); | ||
|
||
spinner.succeed(chalk.green("Successfully installed dependencies!\n")); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
engine-strict=false | ||
# next-auth not officially Node 18 compatible | ||
engine-strict=false | ||
|
||
# next-auth currently on Next.js 12 | ||
strict-peer-dependencies=false | ||
legacy-peer-deps=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
// Wrapper for unstable_getServerSession https://next-auth.js.org/configuration/nextjs | ||
|
||
import type { GetServerSidePropsContext } from "next"; | ||
import { type GetServerSidePropsContext } from "next"; | ||
import { unstable_getServerSession } from "next-auth"; | ||
import { authOptions as nextAuthOptions } from "../../pages/api/auth/[...nextauth]"; | ||
import { authOptions } from "../../pages/api/auth/[...nextauth]"; | ||
|
||
// Next API route example - /pages/api/restricted.ts | ||
/** | ||
* Wrapper for unstable_getServerSession https://next-auth.js.org/configuration/nextjs | ||
* See example usage in trpc createContext or the restricted API route | ||
*/ | ||
export const getServerAuthSession = async (ctx: { | ||
req: GetServerSidePropsContext["req"]; | ||
res: GetServerSidePropsContext["res"]; | ||
}) => { | ||
return await unstable_getServerSession(ctx.req, ctx.res, nextAuthOptions); | ||
return await unstable_getServerSession(ctx.req, ctx.res, authOptions); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,17 @@ | ||
// @ts-check | ||
/* run the build with this set to skip validation */ | ||
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs")); | ||
|
||
/** | ||
* Don't be scared of the generics here. | ||
* All they do is to give us autocompletion when using this. | ||
* | ||
* @template {import('next').NextConfig} T | ||
* @param {T} config - A generic parameter that flows through to the return type | ||
* @constraint {{import('next').NextConfig}} | ||
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. | ||
* This is especially useful for Docker builds. | ||
*/ | ||
function defineNextConfig(config) { | ||
return config; | ||
} | ||
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs")); | ||
|
||
export default defineNextConfig({ | ||
/** @type {import("next").NextConfig} */ | ||
const config = { | ||
reactStrictMode: true, | ||
swcMinify: true, | ||
/** Next.js i18n docs: | ||
* @see https://nextjs.org/docs/advanced-features/i18n-routing | ||
* Reference repo for i18n: | ||
* @see https://github.com/juliusmarminge/t3-i18n | ||
**/ | ||
i18n: { | ||
locales: ["en"], | ||
defaultLocale: "en", | ||
}, | ||
}); | ||
}; | ||
export default config; |
Oops, something went wrong.
f1673eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
create-t3-app – ./
create-t3-app-nu.vercel.app
beta.create.t3.gg
create-t3-app-git-next-t3-oss.vercel.app
create-t3-app-t3-oss.vercel.app