Repository navigation
feat: add Node.js and package manager version outputs - #199
Conversation
After setup, read `vp env current --json` in the project directory and publish the Node.js version, package manager, and package manager version that Vite+ resolved. GitHub sets the node-version, package-manager, and package-manager-version outputs. GitLab exports SETUP_VP_INSTALLED_NODE_VERSION, SETUP_VP_PACKAGE_MANAGER_NAME, and SETUP_VP_PACKAGE_MANAGER_VERSION and writes them to .setup-vp-outputs.env. Azure sets the same job variables plus the nodeVersion, packageManager, and packageManagerVersion named outputs. The command only runs on Vite+ 0.3.1 or newer. Older releases keep the Node.js version at the top level of the JSON and ignore `vp env off`, so setup-vp reports unknown for them. A failed command or output that is not JSON also reports unknown, with a warning in each integration. A value that is not a plain name or version reports unknown as well.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2c452ab1c
ℹ️ 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".
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
✅ GitLab E2E passedCommit: |
|
@everton-dgn Thanks! |
Closes #198
At the end of setup, all three integrations run
vp env current --jsonin the project directory and publish what Vite+ resolved:node-versionSETUP_VP_INSTALLED_NODE_VERSIONSETUP_VP_INSTALLED_NODE_VERSION,nodeVersionpackage-managerSETUP_VP_PACKAGE_MANAGER_NAMESETUP_VP_PACKAGE_MANAGER_NAME,packageManagerpackage-manager-versionSETUP_VP_PACKAGE_MANAGER_VERSIONSETUP_VP_PACKAGE_MANAGER_VERSION,packageManagerVersionOn GitLab they also go into
.setup-vp-outputs.env, next toSETUP_VP_INSTALLED_VERSION.The command only runs when the installed Vite+ is 0.3.1 or newer, using the same
supportsScopedEnvcheck as thepackage-managerinput. Before 0.3.1 the JSON kept the Node.js version at the top level, andvp env currentignoredvp env off, so withnode-manager: falseit would have reported the managed version instead of the one onPATH. On older versions the outputs areunknown, likeversion. If the command fails or doesn't print JSON, they areunknowntoo and each integration logs a warning. Values that aren't a plain name or version also becomeunknown, since they end up in a GitLab dotenv file.The version check, the command call and the parsing live in
src/ci/env-current.ts, shared by the three integrations. Thedist/bundles are rebuilt, and the variable lists in the GitLab and Azure RFCs include the new names.The GitLab E2E fixture update is in setup-vp-gitlab-test!5. It accepts either the two legacy dotenv keys or all five keys and validates the new values against the exported environment. All 26 local fixture tests pass. The full GitLab suite passed in the fork against this PR's commit
f2c452ab1c34c245dd085f47a3ac1d7b23fb78a5, including the dotenv producer and consumer jobs. Windows jobs remain disabled in the existing GitLab CI configuration. The fixture MR still needs to merge before the upstream GitLab E2E workflow can use the updated assertion.How I tested it:
vp env current, and the order of the call aftervp env use, the package-manager commands and the install. Without the source changes, the new tests fail (11 failures, and the helper's test file can't load).vp run check,vp run build,vp run typecheckandvp run testpass locally on macOS: 1004 passed, 146 skipped. The skipped ones are Windows or PowerShell-only, plus one that needs a case-sensitive volume.vp env current --jsonoutput from vp 1.0.0-rc.0 to the parser (the JSON layout incurrent.rsis the same in v1.1.0). A Bun project withdevEngines.runtime24.20.0 gives24.20.0,bun,1.4.2. This repo, whose.node-versionislts/*, gives24.21.0,pnpm,12.7.0. In a project without a local vite-plus, stdout is still plain JSON.test.yml,test-node-version,test-auto-node-versionandtest-node-manager-offnow checknode-versionagainstnode --versionor the expected version, andtest-node-versionalso checks the package manager againstpackageManagerin this repo'spackage.json. I replayed those three jobs on macOS with a small script that runs their steps againstdist/index.mjsin an isolatedHOME. They pass fornode-version: 22(output22.23.3),lts(24.21.0),devEngines.runtime22.18.0, andnode-manager: falsewith a system Node.js 22.19.0, where the managed version would have been 24.21.0. They haven't run on real runners, Linux or Windows yet.