Skip to content

feat(migrate): migrate .nvmrc to .node-version during vp migrate#1159

Merged
fengmk2 merged 20 commits intovoidzero-dev:mainfrom
naokihaba:feat/migrate-nvmrc
Mar 27, 2026
Merged

feat(migrate): migrate .nvmrc to .node-version during vp migrate#1159
fengmk2 merged 20 commits intovoidzero-dev:mainfrom
naokihaba:feat/migrate-nvmrc

Conversation

@naokihaba
Copy link
Copy Markdown
Contributor

@naokihaba naokihaba commented Mar 26, 2026

🔗 Related Issues

Resolves: #1158

📚 Description

Vite+ previously retrieved the Node.js version from .node-version, but projects using nvm typically use .nvmrc.

With this change, automatic detection of .nvmrc and a migration feature to .node-version have been added as part of the vp migrate command execution process.

During migration, if a v prefix is present at the beginning, it is removed, while aliases such as lts/* are carried over as is.

Unit tests have confirmed that it works correctly regardless of the presence of the v prefix.

On the other hand, if unsupported aliases like node or stable are included, the system is designed to display a warning and skip the migration rather than failing.

Manual Test: .nvmrc Migration

$ mkdir /tmp/vp-migrate-test
$ echo '{ "name": "test-migrate", "version": "1.0.0" }' > package.json
$ echo 'v20.5.0' > .nvmrc

Command

$ cd /tmp/vp-migrate-test && vp migrate --no-interactive

Output (Excerpt)

.nvmrc detected. Auto-migrating to .node-version...
...
• Node version manager file migrated to .node-version

Final State

$ cat /tmp/vp-migrate-test/.node-version
20.5.0
  • .nvmrc (v20.5.0) -> Deleted
  • .node-version -> 20.5.0 (With the v prefix removed)

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 26, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 215dd72
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69c64a64baee410008453d5d

@naokihaba
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2e4dfd821

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@naokihaba
Copy link
Copy Markdown
Contributor Author

naokihaba commented Mar 26, 2026

Hmm... The snapshot diff is failing.

Error: Snapshot diff detected. Run 'pnpm -F vite-plus snap-test' locally and commit the updated snap.txt files.
packages/cli/snap-tests-global/create-next-command-library/snap.txt | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/packages/cli/snap-tests-global/create-next-command-library/snap.txt b/packages/cli/snap-tests-global/create-next-command-library/snap.txt
index 6ef3275..d4fb700 100644
--- a/packages/cli/snap-tests-global/create-next-command-library/snap.txt
+++ b/packages/cli/snap-tests-global/create-next-command-library/snap.txt
@@ -1,6 +1,3 @@
-> vp create vite:library --no-interactive # verify next command suggests vp run
+[1]> vp create vite:library --no-interactive # verify next command suggests vp run

@naokihaba
Copy link
Copy Markdown
Contributor Author

@codex review

@naokihaba naokihaba marked this pull request as ready for review March 26, 2026 18:47
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db3da182a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fengmk2 fengmk2 self-assigned this Mar 27, 2026
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

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

@naokihaba Thank you, your implementation is very clean. Could you refer to the current snap test and add a snap test to ensure this migrate logic remains effective? I will merge it afterwards.

@naokihaba naokihaba marked this pull request as draft March 27, 2026 05:25
@naokihaba
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@naokihaba naokihaba marked this pull request as ready for review March 27, 2026 05:32
@naokihaba
Copy link
Copy Markdown
Contributor Author

naokihaba commented Mar 27, 2026

Hmm... The snapshot diff is failing.

Error: Snapshot diff detected. Run 'pnpm -F vite-plus snap-test' locally and commit the updated snap.txt files.
packages/cli/snap-tests-global/create-next-command-library/snap.txt | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/packages/cli/snap-tests-global/create-next-command-library/snap.txt b/packages/cli/snap-tests-global/create-next-command-library/snap.txt
index 6ef3275..d4fb700 100644
--- a/packages/cli/snap-tests-global/create-next-command-library/snap.txt
+++ b/packages/cli/snap-tests-global/create-next-command-library/snap.txt
@@ -1,6 +1,3 @@
-> vp create vite:library --no-interactive # verify next command suggests vp run
+[1]> vp create vite:library --no-interactive # verify next command suggests vp run

Added snapshot tests, and all tests passed.

@naokihaba naokihaba requested a review from fengmk2 March 27, 2026 05:42
@naokihaba naokihaba marked this pull request as draft March 27, 2026 08:45
@naokihaba naokihaba force-pushed the feat/migrate-nvmrc branch from d69687a to d3997a3 Compare March 27, 2026 08:56
@naokihaba naokihaba marked this pull request as ready for review March 27, 2026 09:14
@naokihaba naokihaba requested a review from fengmk2 March 27, 2026 09:15
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

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

@naokihaba Thanks!

@fengmk2 fengmk2 merged commit 066fe5f into voidzero-dev:main Mar 27, 2026
23 checks passed
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.

vp migrate handles migration from .nvmrc

2 participants