Skip to content

fix(init): properly check installed modules#1043

Merged
danielroe merged 4 commits intomainfrom
fix/init
Sep 17, 2025
Merged

fix(init): properly check installed modules#1043
danielroe merged 4 commits intomainfrom
fix/init

Conversation

@atinux
Copy link
Member

@atinux atinux commented Sep 17, 2025

  • The detection of the installed modules was not working, using await import() was wrong, fixed it by using readPackageJSON
  • I also detected ahead of time if nuxt is installed as dependency to avoid asking to install Nuxt modules
  • This gives the possibility to install the Nuxt UI templates with Vite while keeping our nice Nuxt branding and CLI

@atinux atinux requested a review from danielroe as a code owner September 17, 2025 14:30
@github-actions
Copy link
Contributor

github-actions bot commented Sep 17, 2025

Bundle Stats — create-nuxt size comparison

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
50 5.9 MB → 5.9 MB (+9 B) +0.00%
Changeset
File Δ Size
home/runner/work/cli/cli/packages/nuxi/src/commands/init.ts 📈 +9 B (+0.07%) 11.82 kB → 11.83 kB
View detailed bundle breakdown

Added

Asset File Size % Changed
shared/create-nuxt.DVsaFU7d.mjs 0 B → 2.02 MB (+2.02 MB) -
shared/create-nuxt.D6QL_2us.mjs 0 B → 1.17 MB (+1.17 MB) -
shared/create-nuxt.CL7C3h8q.mjs 0 B → 961.89 kB (+961.89 kB) -
shared/create-nuxt.CdjDEmnn.mjs 0 B → 108.11 kB (+108.11 kB) -
shared/create-nuxt.CU-IHC6-.mjs 0 B → 18.91 kB (+18.91 kB) -
shared/create-nuxt.YyXVH23T.mjs 0 B → 18.11 kB (+18.11 kB) -
shared/create-nuxt.BtwhSDQN.mjs 0 B → 4.07 kB (+4.07 kB) -
shared/create-nuxt.BNK9DlAn.mjs 0 B → 3.9 kB (+3.9 kB) -
shared/create-nuxt.CV8uSwfQ.mjs 0 B → 3.72 kB (+3.72 kB) -
shared/create-nuxt.BB0Dqlvt.mjs 0 B → 945 B (+945 B) -
shared/create-nuxt.DBb0wpgL.mjs 0 B → 836 B (+836 B) -
shared/create-nuxt.DS5NkK3a.mjs 0 B → 792 B (+792 B) -
shared/create-nuxt.DP9Qg57V.mjs 0 B → 365 B (+365 B) -
shared/create-nuxt.C2O0oyaz.mjs 0 B → 294 B (+294 B) -

Removed

Asset File Size % Changed
shared/create-nuxt.D_tTg8Xn.mjs 2.02 MB → 0 B (-2.02 MB) -100%
shared/create-nuxt.BdtjLNEK.mjs 1.17 MB → 0 B (-1.17 MB) -100%
shared/create-nuxt.B2BRkwMc.mjs 961.88 kB → 0 B (-961.88 kB) -100%
shared/create-nuxt.CqR_5oMD.mjs 108.11 kB → 0 B (-108.11 kB) -100%
shared/create-nuxt.CxlsXaIT.mjs 18.91 kB → 0 B (-18.91 kB) -100%
shared/create-nuxt.C2mGmnQ5.mjs 18.11 kB → 0 B (-18.11 kB) -100%
shared/create-nuxt.CCoc7z7N.mjs 4.07 kB → 0 B (-4.07 kB) -100%
shared/create-nuxt.Bc463RC0.mjs 3.9 kB → 0 B (-3.9 kB) -100%
shared/create-nuxt.Diu_-UiC.mjs 3.72 kB → 0 B (-3.72 kB) -100%
shared/create-nuxt.DJQYn574.mjs 945 B → 0 B (-945 B) -100%
shared/create-nuxt.sn142zqc.mjs 836 B → 0 B (-836 B) -100%
shared/create-nuxt.BrMKgTX-.mjs 792 B → 0 B (-792 B) -100%
shared/create-nuxt.Df9dPN_9.mjs 365 B → 0 B (-365 B) -100%
shared/create-nuxt.CsygZy0P.mjs 294 B → 0 B (-294 B) -100%

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
index.mjs 1.07 kB 0%
chunks/multipart-parser.mjs 5.11 kB 0%
chunks/multipart-parser2.mjs 4.58 kB 0%
chunks/add.mjs 6.89 kB 0%
chunks/analyze.mjs 3.35 kB 0%
chunks/build.mjs 2.04 kB 0%
chunks/cleanup.mjs 471 B 0%
chunks/dev-child.mjs 811 B 0%
chunks/dev.mjs 28.45 kB 0%
chunks/devtools.mjs 764 B 0%
chunks/generate.mjs 492 B 0%
chunks/info.mjs 4.43 kB 0%
chunks/index.mjs 274 B 0%
chunks/prepare.mjs 1.04 kB 0%
chunks/preview.mjs 3.58 kB 0%
chunks/test.mjs 1.16 kB 0%
chunks/typecheck.mjs 2.06 kB 0%
chunks/upgrade.mjs 6.65 kB 0%
chunks/prompt.mjs 42.91 kB 0%
chunks/satisfies.mjs 116 B 0%
chunks/index2.mjs 199.51 kB 0%
chunks/jiti.mjs 305 B 0%
chunks/index3.mjs 71.97 kB 0%
chunks/add2.mjs 12.08 kB 0%
chunks/search.mjs 45.85 kB 0%
chunks/xdg-open.mjs 25.32 kB 0%
chunks/node.mjs 145.67 kB 0%
chunks/index4.mjs 1.23 kB 0%
chunks/index5.mjs 5.85 kB 0%
chunks/index6.mjs 6.24 kB 0%
chunks/index7.mjs 50.51 kB 0%
chunks/index8.mjs 904.13 kB 0%
shared/create-nuxt.BSm0_9Hr.mjs 107 B 0%
shared/create-nuxt.BjhZEm2-.mjs 1.75 kB 0%
shared/create-nuxt.Vk1IrVtB.mjs 26.96 kB 0%
shared/create-nuxt.4t9faemh.mjs 43.64 kB 0%

@github-actions
Copy link
Contributor

github-actions bot commented Sep 17, 2025

Bundle Stats — nuxt-cli size comparison

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
33 97.89 kB → 97.9 kB (+9 B) +0.01%
Changeset
File Δ Size
home/runner/work/cli/cli/packages/nuxi/src/commands/init.ts 📈 +9 B (+0.07%) 11.78 kB → 11.79 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
chunks/init.mjs 12.15 kB → 12.16 kB (+9 B) +0.07%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
dev/index.mjs 0 B 0%
index.mjs 236 B 0%
chunks/index.mjs 14.44 kB 0%
chunks/analyze.mjs 3.35 kB 0%
chunks/cleanup.mjs 471 B 0%
chunks/dev-child.mjs 815 B 0%
chunks/dev.mjs 11.31 kB 0%
chunks/devtools.mjs 763 B 0%
chunks/generate.mjs 492 B 0%
chunks/build.mjs 2.04 kB 0%
chunks/info.mjs 4.44 kB 0%
chunks/index2.mjs 273 B 0%
chunks/add.mjs 10.17 kB 0%
chunks/search.mjs 2.96 kB 0%
chunks/prepare.mjs 1.04 kB 0%
chunks/preview.mjs 3.58 kB 0%
chunks/test.mjs 1.16 kB 0%
chunks/typecheck.mjs 2.06 kB 0%
chunks/upgrade.mjs 6.65 kB 0%
chunks/add2.mjs 6.89 kB 0%
shared/cli.B9AmABr3.mjs 39 B 0%
shared/cli.Dz2be-Ai.mjs 792 B 0%
shared/cli.BEUGgaW4.mjs 294 B 0%
shared/cli.BSm0_9Hr.mjs 107 B 0%
shared/cli.At9IMXtr.mjs 1.23 kB 0%
shared/cli.pLQ0oPGc.mjs 836 B 0%
shared/cli.qKvs7FJ2.mjs 945 B 0%
shared/cli.DhJ3cH8w.mjs 78 B 0%
shared/cli.Cr-OCgdO.mjs 727 B 0%
shared/cli.DHenkA1C.mjs 351 B 0%
shared/cli.vXg4eLNu.mjs 1.8 kB 0%
shared/cli.CTXRG5Cu.mjs 5.57 kB 0%

@github-actions
Copy link
Contributor

github-actions bot commented Sep 17, 2025

Bundle Stats — nuxi size comparison

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
59 5.47 MB → 5.47 MB (+9 B) +0.00%
Changeset
File Δ Size
src/commands/init.ts 📈 +9 B (+0.07%) 11.82 kB → 11.82 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
chunks/init.mjs 675.77 kB → 675.78 kB (+9 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
index.mjs 247 B 0%
dev/index.mjs 925 B 0%
chunks/add.mjs 6.89 kB 0%
chunks/analyze.mjs 3.35 kB 0%
chunks/build.mjs 2.04 kB 0%
chunks/cleanup.mjs 471 B 0%
chunks/dev-child.mjs 780 B 0%
chunks/dev.mjs 28.45 kB 0%
chunks/devtools.mjs 764 B 0%
chunks/generate.mjs 492 B 0%
chunks/info.mjs 4.43 kB 0%
chunks/index.mjs 274 B 0%
chunks/prepare.mjs 1.04 kB 0%
chunks/preview.mjs 3.58 kB 0%
chunks/test.mjs 1.16 kB 0%
chunks/typecheck.mjs 2.06 kB 0%
chunks/upgrade.mjs 6.65 kB 0%
chunks/satisfies.mjs 116 B 0%
chunks/main.mjs 15.3 kB 0%
chunks/prompt.mjs 42.91 kB 0%
chunks/index2.mjs 199.51 kB 0%
chunks/jiti.mjs 305 B 0%
chunks/index3.mjs 71.97 kB 0%
chunks/multipart-parser.mjs 5.11 kB 0%
chunks/add2.mjs 12.08 kB 0%
chunks/search.mjs 45.85 kB 0%
chunks/xdg-open.mjs 25.32 kB 0%
chunks/node.mjs 145.67 kB 0%
chunks/index4.mjs 1.23 kB 0%
chunks/index5.mjs 5.85 kB 0%
chunks/multipart-parser2.mjs 4.58 kB 0%
chunks/index6.mjs 904.13 kB 0%
shared/nuxi.GLC40kEn.mjs 19.33 kB 0%
shared/nuxi.DQjfoGl0.mjs 57.22 kB 0%
shared/nuxi.CTyTlDmo.mjs 18.91 kB 0%
shared/nuxi.BXGZ9qFF.mjs 792 B 0%
shared/nuxi.C_u-rG9b.mjs 294 B 0%
shared/nuxi.DUZ_WukQ.mjs 2.57 kB 0%
shared/nuxi.8mhVoXwa.mjs 916.43 kB 0%
shared/nuxi.D2_bzAv0.mjs 1.54 kB 0%
shared/nuxi.DQbQuzNE.mjs 4.07 kB 0%
shared/nuxi.BSm0_9Hr.mjs 107 B 0%
shared/nuxi.CrvQqJcE.mjs 836 B 0%
shared/nuxi.BiWTNJI4.mjs 945 B 0%
shared/nuxi.Zu_ZTV_8.mjs 18.11 kB 0%
shared/nuxi.CJSnaadO.mjs 10.64 kB 0%
shared/nuxi.BAGoDD49.mjs 1.05 kB 0%
shared/nuxi.BEiAYiRs.mjs 2.02 MB 0%
shared/nuxi.BjhZEm2-.mjs 1.75 kB 0%
shared/nuxi.DQsdVvIb.mjs 3.72 kB 0%
shared/nuxi.DcfbSbTx.mjs 124.55 kB 0%
shared/nuxi.QWnQy_ku.mjs 5.75 kB 0%
shared/nuxi.BcK1uW4h.mjs 365 B 0%
shared/nuxi.DU9QXUOf.mjs 26.96 kB 0%
shared/nuxi.D3mADRf9.mjs 14.73 kB 0%
shared/nuxi.BLb4POFS.mjs 42.47 kB 0%
shared/nuxi.Do0aYBCO.mjs 5.46 kB 0%
shared/nuxi.4t9faemh.mjs 43.64 kB 0%

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 17, 2025

nuxt-cli-playground

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

commit: 0758dc3

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 17, 2025

CodSpeed Performance Report

Merging #1043 will not alter performance

Comparing fix/init (0758dc3) with main (9d390df)

Summary

✅ 2 untouched

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for non-nuxt projects we should directly use the giget CLI.

needing to support them in nuxt/cli itself will add a bit too much complexity to maintaining it, I think.

@atinux
Copy link
Member Author

atinux commented Sep 17, 2025

This is what I thought but wanted to confirm with you.

It's just that the DX of nuxt init is sexy (confirm to overwrite if dir exists, ask to install deps, etc)

Will revert some changes

@pi0
Copy link
Member

pi0 commented Sep 17, 2025

It's just that the DX of nuxt init is sexy (confirm to overwrite if dir exists, ask to install deps, etc)

We could add this features to giget CLI too btw.

@atinux atinux requested a review from danielroe September 17, 2025 17:41
@atinux
Copy link
Member Author

atinux commented Sep 17, 2025

We could add this features to giget CLI too btw.

Sounds good, I guess we will need to support passing the package manager here

@danielroe danielroe merged commit 26b6770 into main Sep 17, 2025
15 checks passed
@danielroe danielroe deleted the fix/init branch September 17, 2025 18:49
@github-actions github-actions bot mentioned this pull request Sep 16, 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.

3 participants