Commit 066fe5f
authored
feat(migrate): migrate .nvmrc to .node-version during
### 🔗 Related Issues
<!-- resolves # -->
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
```bash
$ mkdir /tmp/vp-migrate-test
$ echo '{ "name": "test-migrate", "version": "1.0.0" }' > package.json
$ echo 'v20.5.0' > .nvmrc
```
#### Command
```bash
$ 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)vp migrate (#1159)1 parent 3c2ac72 commit 066fe5f
File tree
17 files changed
+355
-3
lines changed- packages/cli
- snap-tests-global
- migration-nvmrc-lts
- migration-nvmrc-node-alias
- migration-nvmrc
- src/migration
- __tests__
17 files changed
+355
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments