-
Notifications
You must be signed in to change notification settings - Fork 29.9k
create-next-app: add --use-deno option
#86529
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
base: canary
Are you sure you want to change the base?
Conversation
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
packages/create-next-app/index.ts
Outdated
| yarn: 'yarn global add create-next-app', | ||
| pnpm: 'pnpm add -g create-next-app', | ||
| bun: 'bun add -g create-next-app', | ||
| deno: 'deno i -g npm:create-next-app', |
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.
The Deno update command is incorrect. Deno does not have an i subcommand (the install command is install, not i), and this approach doesn't work for npm packages. Based on the README showing deno -A npm:create-next-app@latest, the correct command should be:
deno: 'deno run -A npm:create-next-app@latest'The current command deno i -g npm:create-next-app will fail when users try to update, showing them an invalid command.
| deno: 'deno i -g npm:create-next-app', | |
| deno: 'deno run -A npm:create-next-app@latest', |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
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.
deno i does exist, which is an alias of deno install. You can check that with deno i -h
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.
Additional Suggestion:
The command instructions printed for Deno users are incorrect. They show invalid Deno commands like deno run dev, deno run build, and deno start.
View Details
📝 Patch Details
diff --git a/packages/create-next-app/create-app.ts b/packages/create-next-app/create-app.ts
index 165717ff57..c340e30c60 100644
--- a/packages/create-next-app/create-app.ts
+++ b/packages/create-next-app/create-app.ts
@@ -148,6 +148,7 @@ export async function createApp({
}
const useYarn = packageManager === 'yarn'
+ const useDeno = packageManager === 'deno'
const isOnline = !useYarn || (await getOnline())
const originalDirectory = process.cwd()
@@ -275,19 +276,19 @@ export async function createApp({
if (hasPackageJson) {
console.log('Inside that directory, you can run several commands:')
console.log()
- console.log(cyan(` ${packageManager} ${useYarn ? '' : 'run '}dev`))
+ console.log(cyan(` ${packageManager} ${useYarn ? '' : useDeno ? 'task ' : 'run '}dev`))
console.log(' Starts the development server.')
console.log()
- console.log(cyan(` ${packageManager} ${useYarn ? '' : 'run '}build`))
+ console.log(cyan(` ${packageManager} ${useYarn ? '' : useDeno ? 'task ' : 'run '}build`))
console.log(' Builds the app for production.')
console.log()
- console.log(cyan(` ${packageManager} start`))
+ console.log(cyan(` ${packageManager} ${useDeno ? 'task ' : ''}start`))
console.log(' Runs the built app in production mode.')
console.log()
console.log('We suggest that you begin by typing:')
console.log()
console.log(cyan(' cd'), cdpath)
- console.log(` ${cyan(`${packageManager} ${useYarn ? '' : 'run '}dev`)}`)
+ console.log(` ${cyan(`${packageManager} ${useYarn ? '' : useDeno ? 'task ' : 'run '}dev`)}`)
}
console.log()
}
Analysis
Incorrect Deno command instructions in create-next-app
What fails: The printed command instructions for Deno users show deno run dev, deno run build, and deno start instead of the correct deno task dev, deno task build, and deno task start.
How to reproduce:
deno run -A npm:create-next-app my-app
# When prompts appear, create a default Next.js app with Deno as the package manager
# At the end, observe the printed instructionsResult: The output instructions show:
deno run dev
deno run build
deno start
Expected: According to Deno's official documentation for running Next.js, and Deno's package.json compatibility documentation, the correct commands should be:
deno task dev
deno task build
deno task start
The Deno documentation explicitly states: "Deno supports running npm scripts natively with the deno task subcommand (If you're migrating from Node.js, this is similar to the npm run script command)."
Fix: Modified packages/create-next-app/create-app.ts to:
- Add
useDenoflag to detect when Deno is the package manager - Updated command display logic to use
deno taskfor dev, build, and start commands when packageManager is 'deno'
This PR adds
--use-denooption tocreate-next-app. Also detects deno bynpm_config_user_agentenv var (Deno implements it since v2.1 denoland/deno#26639 ).A previous attempt #71396