Skip to content

fix: do not prompt for modules if an empty list is provided#888

Merged
danielroe merged 1 commit intonuxt:mainfrom
cjpearson:module-prompt
Jun 7, 2025
Merged

fix: do not prompt for modules if an empty list is provided#888
danielroe merged 1 commit intonuxt:mainfrom
cjpearson:module-prompt

Conversation

@cjpearson
Copy link
Contributor

🔗 Linked issue

Resolves #887

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

When --modules is not used, ctx.args.modules will be undefined and when --modules '' or --modules is used, it will be an empty string. With this change, we will only prompt in the undefined case, allowing users to explicitly skip the prompt if they want.

@cjpearson cjpearson requested a review from danielroe as a code owner May 24, 2025 10:20
@codecov-commenter
Copy link

codecov-commenter commented May 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@e2d151a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/nuxi/src/commands/init.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #888   +/-   ##
=======================================
  Coverage        ?   12.98%           
=======================================
  Files           ?       69           
  Lines           ?     3588           
  Branches        ?      100           
=======================================
  Hits            ?      466           
  Misses          ?     3091           
  Partials        ?       31           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 24, 2025

Open in StackBlitz

npm i https://pkg.pr.new/create-nuxt@888
npm i https://pkg.pr.new/nuxi@888
npm i https://pkg.pr.new/@nuxt/cli@888

commit: 6ac9ce4

@danielroe
Copy link
Member

danielroe commented May 24, 2025

maybe we could support and document '--no-modules' (which should work implicitly)

@cjpearson
Copy link
Contributor Author

That could definitely work too. I think it's more direct, but I wasn't sure how to handle if it's combined with --modules. If --no-modules is passed should it only skip the prompt or also skip the provided modules?

@danielroe
Copy link
Member

both i think. citty handles --no prefix for all args i think ...

@cjpearson
Copy link
Contributor Author

It seems that it's partially supported. With a small change, --no-modules works to skip the module installation, but there are two small issues.

citty will only print the usage for the --no-modules flag if it's typed as boolean. Also, the type of ctx.args.modules will still be string instead of string | false. I guess those could both be improved on the citty side if that is an intended usage.

@danielroe danielroe merged commit 1089c0e into nuxt:main Jun 7, 2025
8 of 11 checks passed
@github-actions github-actions bot mentioned this pull request Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modules prompt triggers when empty module list is passed

3 participants