Conversation
The remote library template can retain an older vite-plus range while project setup injects the current core override. Pin the newly scaffolded library to the creating CLI before integration, without changing migration rules for existing projects.
8baae99 to
a5c0340
Compare
Prepare both built-in library download paths with the creating CLI version before project integration. Keep existing migration rules and workspace configuration cleanup. Run built-in create CI cases without forced migration and assert the installed CLI and resolved core in each generated package. Cover npm monorepos and catalog-based package managers with regression tests.
Exercise library creation inside an installed workspace for all four package managers. Check member and root toolchain resolution, preserve root configuration, and run member tests.
|
When creating a library with Vite+ 1.0.0 and npm, the generated The same problem affects standalone libraries created with Bun and libraries created inside npm workspaces. This includes |
|
Could you submit a PR to https://github.com/sxzz/tsdown-templates/blob/main/vite-plus to update the content? |
This PR makes the generated library use the same Vite+ version as the CLI that creates it. It removes the need to keep the template's version declaration up to date. Updating the template fixes the outdated version, but it does not guarantee that the version matches the CLI that the user runs. This PR sets the version after downloading the template, so the template's old version does not affect the generated project. So do you think a separate PR to the template repository is still necessary? 🤔 |
Important
Please take a moment to read this. Thank you!
I should include a brief explanation of the problem in my own words in every PR. If that explanation is missing, please @mention me and do not merge this PR until I have added it. You may also leave this PR unaddressed (because this means I have not fulfilled my responsibilities as the author).
If my explanation is unclear or difficult to follow, please ask me to clarify or provide reproduction steps or supporting evidence.
I welcome suggestions and counterarguments, especially questions about anything I may have overlooked. (Your feedback helps me learn and improve. 🙏)
I hold myself to this standard for every PR, regardless of its size.
Problem
Creating a standalone library with Vite+ 1.0.0 and npm or Bun installs
vite-plus@0.2.9alongside@voidzero-dev/vite-plus-core@1.0.0. The remote library template declaresvite-plus: ^0.2.4, and creation preserves that range while writing the creating CLI's core override. npm monorepos also retain the stale range in their generatedpackages/utilsor a newly added library. These packages need consistent toolchain versions. The reproduced standalone npm library still passes checks, tests and packaging, so version inconsistency is the confirmed defect.Fix
Set the name and Vite+ dependency of each downloaded built-in library before project integration. A shared step covers standalone libraries, libraries added to existing workspaces, and the library created by
vite:monorepo. Catalog-based integration can still replace the version with a catalog reference.Run the built-in create CI matrix without forced migration, which previously masked the stale dependency. Assert the installed Vite+ and resolved core versions from each generated package. The four package-manager jobs also add a library to an installed workspace, compare the root configuration before and after, and run the new library's tests.
Verification
vp checkpassed formatting, lint and type checks.Adding a library to an existing workspace still fails
vp checkandvp packbecause the remote template uses legacydts.tsgo: trueconfiguration. This review reproduced the same configuration and failures with the unpatched CLI. That separate defect is covered by #2862.Local checks used npm 12.2.0, pnpm 12.8.1, Yarn 4.18.1 and Bun 1.4.2 on macOS. The CLI JavaScript was rebuilt with existing native and core artifacts. The full CLI snapshot suite was not rerun. Hosted CI results are pending.