Skip to content

Commit 92eb8e7

Browse files
committed
feat(global-cli): add monorepo release workflow with publish safety checks
1 parent 273ba39 commit 92eb8e7

17 files changed

Lines changed: 3422 additions & 12 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,34 @@ Vite+ is the unified entry point for local web development. It combines [Vite](h
1919
- **`vp build`:** Build applications for production with Vite + Rolldown
2020
- **`vp run`:** Execute monorepo tasks with caching and dependency-aware scheduling
2121
- **`vp pack`:** Build libraries for npm publishing or standalone app binaries
22+
- **`vp release`:** Version and publish workspace packages with dry-run support, readiness warnings, a required final confirmation by default, optional changelog generation via `--changelog`, prerelease channels like `--preid alpha` / `beta` / `rc`, and `--projects` order respected between independent packages
2223
- **`vp create` / `vp migrate`:** Scaffold new projects and migrate existing ones
2324

2425
All of this is configured from your project root and works across Vite's framework ecosystem.
2526
Vite+ is fully open-source under the MIT license.
2627

28+
### Release References
29+
30+
`vp release` follows these upstream specifications and package-manager docs when deciding version bumps and publish safety:
31+
32+
- [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html)
33+
- [SemVer FAQ: 0.y.z initial development](https://semver.org/#faq)
34+
- [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/#specification)
35+
- [Conventional Commits FAQ](https://www.conventionalcommits.org/en/v1.0.0/#faq)
36+
- [npm `package.json` docs](https://docs.npmjs.com/cli/v11/configuring-npm/package-json/)
37+
- [npm package spec docs](https://docs.npmjs.com/cli/v11/using-npm/package-spec/)
38+
- [npm RFC: `workspace:` protocol support](https://github.com/npm/rfcs/issues/765)
39+
- [pnpm workspaces and `workspace:` publish transformations](https://pnpm.io/workspaces)
40+
- [pnpm catalogs](https://pnpm.io/catalogs)
41+
- [Yarn workspaces and `workspace:` cross-references](https://yarnpkg.com/features/workspaces)
42+
- [Yarn `workspace:` protocol](https://yarnpkg.com/protocol/workspace)
43+
- [Yarn `yarn npm publish`](https://yarnpkg.com/cli/npm/publish)
44+
- [Bun workspaces and `workspace:` publish transformations](https://bun.sh/docs/pm/workspaces)
45+
- [Bun catalogs](https://bun.sh/docs/pm/catalogs)
46+
- [Bun `bun publish`](https://bun.sh/docs/pm/cli/publish)
47+
48+
`vp release` does not run build, pack, or custom pre-release scripts implicitly. Instead it summarizes likely checks from `build`, `pack`, `prepack`, `prepublishOnly`, `prepare`, and `vitePlus.release.checkScripts`, then asks for confirmation before mutating files or publishing. Use `--yes` for CI or other non-interactive runs.
49+
2750
## Getting Started
2851

2952
Install Vite+ globally as `vp`:
@@ -120,6 +143,7 @@ Use `vp migrate` to migrate to Vite+. It merges tool-specific config files such
120143

121144
- **build** - Build for production
122145
- **pack** - Build libraries
146+
- **release** - Version and publish workspace packages, with optional changelog generation
123147
- **preview** - Preview production build
124148

125149
#### Manage Dependencies

crates/vite_global_cli/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ tracing = { workspace = true }
2929
owo-colors = { workspace = true }
3030
oxc_resolver = { workspace = true }
3131
crossterm = { workspace = true }
32+
glob = { workspace = true }
33+
petgraph = { workspace = true }
3234
vite_error = { workspace = true }
3335
vite_install = { workspace = true }
3436
vite_js_runtime = { workspace = true }

crates/vite_global_cli/src/cli.rs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,58 @@ pub enum Commands {
611611
args: Vec<String>,
612612
},
613613

614+
/// Version and publish workspace packages, with readiness checks and optional changelog generation
615+
Release {
616+
/// Preview the release plan without changing files or publishing
617+
#[arg(long)]
618+
dry_run: bool,
619+
620+
/// Update versions and, if enabled, changelogs, but skip publishing
621+
#[arg(long)]
622+
skip_publish: bool,
623+
624+
/// Treat this release as the first one and ignore existing release tags
625+
#[arg(long)]
626+
first_release: bool,
627+
628+
/// Generate root and per-package changelogs
629+
#[arg(long, overrides_with = "no_changelog")]
630+
changelog: bool,
631+
632+
/// Skip changelog generation
633+
#[arg(long, overrides_with = "changelog")]
634+
no_changelog: bool,
635+
636+
/// Publish a prerelease using the provided identifier (for example: alpha, beta, rc)
637+
#[arg(long, value_name = "TAG")]
638+
preid: Option<String>,
639+
640+
/// Release only matching workspace packages. When multiple values are provided,
641+
/// their order is used as a tie-breaker between independent packages.
642+
#[arg(long, value_name = "PATTERN", value_delimiter = ',')]
643+
projects: Option<Vec<String>>,
644+
645+
/// Create git tags for released packages
646+
#[arg(long, overrides_with = "no_git_tag")]
647+
git_tag: bool,
648+
649+
/// Skip git tag creation
650+
#[arg(long, overrides_with = "git_tag")]
651+
no_git_tag: bool,
652+
653+
/// Create a git commit for release changes
654+
#[arg(long, overrides_with = "no_git_commit")]
655+
git_commit: bool,
656+
657+
/// Skip the release commit
658+
#[arg(long, overrides_with = "git_commit")]
659+
no_git_commit: bool,
660+
661+
/// Skip the final confirmation prompt
662+
#[arg(long, short = 'y', alias = "force")]
663+
yes: bool,
664+
},
665+
614666
/// Run tasks
615667
#[command(disable_help_flag = true)]
616668
Run {
@@ -1924,6 +1976,37 @@ pub async fn run_command_with_options(
19241976
commands::delegate::execute(cwd, "pack", &args).await
19251977
}
19261978

1979+
Commands::Release {
1980+
dry_run,
1981+
skip_publish,
1982+
first_release,
1983+
changelog,
1984+
no_changelog,
1985+
preid,
1986+
projects,
1987+
git_tag: _,
1988+
no_git_tag,
1989+
git_commit: _,
1990+
no_git_commit,
1991+
yes,
1992+
} => {
1993+
commands::release::execute(
1994+
cwd,
1995+
commands::release::ReleaseOptions {
1996+
dry_run,
1997+
skip_publish,
1998+
first_release,
1999+
changelog: changelog && !no_changelog,
2000+
preid,
2001+
projects,
2002+
git_tag: !no_git_tag,
2003+
git_commit: !no_git_commit,
2004+
yes,
2005+
},
2006+
)
2007+
.await
2008+
}
2009+
19272010
Commands::Run { args } => {
19282011
if help::maybe_print_unified_delegate_help("run", &args, render_options.show_header) {
19292012
return Ok(ExitStatus::default());

crates/vite_global_cli/src/command_picker.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ const COMMANDS: &[CommandEntry] = &[
8282
append_help: false,
8383
},
8484
CommandEntry { label: "pack", command: "pack", summary: "Build library.", append_help: false },
85+
CommandEntry {
86+
label: "release",
87+
command: "release",
88+
summary: "Version and publish workspace packages with readiness checks, confirmation, and optional changelog generation.",
89+
append_help: false,
90+
},
8591
CommandEntry {
8692
label: "preview",
8793
command: "preview",

crates/vite_global_cli/src/commands/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ pub mod install;
157157
pub mod link;
158158
pub mod outdated;
159159
pub mod pm;
160+
pub mod release;
160161
pub mod remove;
161162
pub mod unlink;
162163
pub mod update;

0 commit comments

Comments
 (0)