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

feat: remove next-auth checks for node 18 and next 13 #673

Merged
merged 6 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tiny-crabs-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-t3-app": minor
---

remove node 18 and next 13 checks
36 changes: 2 additions & 34 deletions cli/src/helpers/installDependencies.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,19 @@
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";

type Options = {
projectDir: string;
packages: PkgInstallerMap;
};

export const installDependencies = async ({
projectDir,
packages,
}: Options) => {
export const installDependencies = async ({ projectDir }: Options) => {
logger.info("Installing dependencies...");
const pkgManager = getUserPkgManager();
const spinner = ora(`Running ${pkgManager} install...\n`).start();
let flags: string[] = [];

// 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")
) {
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 });
await execa(pkgManager, ["install"], { cwd: projectDir });

spinner.succeed(chalk.green("Successfully installed dependencies!\n"));
};
2 changes: 1 addition & 1 deletion cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const main = async () => {
});

if (!noInstall) {
await installDependencies({ projectDir, packages: usePackages });
await installDependencies({ projectDir });
}

if (!noGit) {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/installers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type AvailablePackages = typeof availablePackages[number];
*/
export const dependencyVersionMap = {
// NextAuth.js
"next-auth": "^4.15.0",
"next-auth": "^4.15.1",
"@next-auth/prisma-adapter": "^1.0.4",

// Prisma
Expand Down
9 changes: 0 additions & 9 deletions cli/src/installers/nextAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ export const nextAuthInstaller: Installer = ({ projectDir, packages }) => {
"src/types/next-auth.d.ts",
);

// FIXME: temp fix for next-auth with node 18
// see: https://github.com/nextauthjs/next-auth/issues/4575
const npmrcSrc = path.join(nextAuthAssetDir, "_npmrc");
const npmrcDest = path.join(projectDir, ".npmrc");
const yarnrcSrc = path.join(nextAuthAssetDir, "_yarnrc");
const yarnrcDest = path.join(projectDir, ".yarnrc");
fs.copySync(npmrcSrc, npmrcDest);
fs.copySync(yarnrcSrc, yarnrcDest);

fs.copySync(apiHandlerSrc, apiHandlerDest);
fs.copySync(getServerAuthSessionSrc, getServerAuthSessionDest);
fs.copySync(restrictedApiSrc, restrictedApiDest);
Expand Down
6 changes: 0 additions & 6 deletions cli/template/addons/next-auth/_npmrc

This file was deleted.

1 change: 0 additions & 1 deletion cli/template/addons/next-auth/_yarnrc

This file was deleted.