feat(env): mark installed/current/default versions in vp env list-remote#1907
feat(env): mark installed/current/default versions in vp env list-remote#1907semimikoh wants to merge 3 commits into
vp env list-remote#1907Conversation
…mote` Annotate the registry listing with locally-derived markers so it is easy to see which versions are already available: - installed versions are highlighted (green; blue for the current project-resolved version), and prefixed with `*` when colors are disabled so the distinction survives piped/`NO_COLOR` output - the current project version (same resolution logic as `vp env current`) and the global default are annotated with `current` / `default` labels - `--json` output gains `installed`, `current`, and `default` fields All local lookups degrade gracefully, so the registry listing still renders if they fail.
✅ Deploy Preview for viteplus-preview canceled.
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc12a3b7ea
ℹ️ 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".
|
Could we add a snap test? |
`vp env default lts`/`latest` stores the raw alias in config, so comparing it directly against exact remote versions never matched and the `default` marker (and JSON `default: true`) was never emitted. Resolve the stored default via `resolve_version_alias` to a concrete version first. Also add a global snap test that installs an LTS version, sets it as the default via the `lts` alias, and asserts the installed/current/default flags all resolve in `vp env list-remote --json`.
|
@jong-kyung Added a |
|
@codex review |
|
To use Codex here, create an environment for this repo. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 721927287a
ℹ️ 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".
It writes the shared VP_HOME config via `vp env default`, matching the existing default-mutating snap tests that run serially.
|
Good catch — marked the snap case |
jong-kyung
left a comment
There was a problem hiding this comment.
It looks good to me 👍
| > vp env default lts # Set it as the global default (stored as the `lts` alias) | ||
| ✓ Default Node.js version set to lts (currently <semver>) | ||
|
|
||
| > vp env list-remote --lts --json | node -e "const {versions}=JSON.parse(require('fs').readFileSync(0,'utf8')); console.log('installed marked:', versions.some(v=>v.installed)); console.log('current marked:', versions.some(v=>v.current)); console.log('default marked:', versions.some(v=>v.default));" # installed/current/default flags should all resolve, including the `lts` default alias |
There was a problem hiding this comment.
Just need to execute the command vp env list-remote --lts --json, and the subsequent judgment logic code can be removed. We only need to ensure that the snapshot content is consistent.
Description
Implements #1881: annotate
vp env list-remoteso installed/current/default Node.js versions are easy to spot in the registry listing.This follows the direction discussed in the issue:
list-remotestill primarily lists registry versions, but now annotates the version resolved for the current project/cwd (same logic asvp env current) and the global default as a separate marker.What changed
*when colors are disabled (piped /NO_COLOR) so the distinction survives non-TTY output.config::resolve_version) and default (globaldefault_node_version) versions are annotated with trailingcurrent/defaultlabels. They can differ, so each gets its own label.--jsonoutput gainsinstalled,current, anddefaultboolean fields.Example
Testing
cargo test -p vite_global_cli list_remote(added coverage for installed and current/default marking)cargo clippy -p vite_global_cli— cleancargo fmt --check