Skip to content

Commit 664deb0

Browse files
fix(init): npm packages are always publish, never build-only
The root cause of the binary-less web-compiler: init offered "build-only (GitHub Release artifacts)" for an npm package and it got picked. For npm that is meaningless — prebuilt binaries ship inside the tarball, not as Release assets — so a Rust-compiler npm package routed its binaries to a cosmetic GitHub Release instead of npm publish. init now skips the mode prompt for npm (always publish); the build-only choice is only offered for cargo/generic packages (standalone-binary distribution), with a clearer label. Combined with the earlier is_build_only() normalization, both fresh configs and any existing build-only npm config now publish correctly.
1 parent 87a6b2f commit 664deb0

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ adheres to [Semantic Versioning](https://semver.org/). Work in progress lives un
2222
`download-artifact` in the publish job when only matrix packages feed it.
2323

2424
### Changed
25+
- **init** — An npm package is no longer offered the `build-only` mode: its prebuilt binaries ship
26+
inside the npm tarball, so it is always `publish`. `build-only` (standalone binaries on a GitHub
27+
Release) is now only prompted for cargo/generic packages, and its label clarifies that.
2528
- **init** — Default-selected build targets are now the five widely-supported platforms
2629
(`linux-x64/arm64`, `darwin-x64/arm64`, `win32-x64`); `win32-arm64` and 32-bit targets remain in
2730
the registry for explicit opt-in (they are rarely in a package's resolver set and need extra

crates/core/src/init.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,18 +1039,26 @@ impl InitPrompt for StdinInitPrompt {
10391039
enabled[opt.index]
10401040
};
10411041

1042-
let mode = match Select::new(
1043-
&format!("{pkg_name} — mode:"),
1044-
vec![
1045-
"publish (to registry)",
1046-
"build-only (GitHub Release artifacts)",
1047-
],
1048-
)
1049-
.raw_prompt()?
1050-
.index
1051-
{
1052-
1 => Mode::BuildOnly,
1053-
_ => Mode::Publish,
1042+
// An npm package is always published to the registry — its prebuilt binaries ship *inside*
1043+
// the tarball, so "build-only" (= GitHub Release assets, no registry push) never applies.
1044+
// Only cargo/generic packages, which can be distributed as standalone binaries, get the
1045+
// choice.
1046+
let mode = if adapter == Ecosystem::Npm {
1047+
Mode::Publish
1048+
} else {
1049+
match Select::new(
1050+
&format!("{pkg_name} — mode:"),
1051+
vec![
1052+
"publish (to registry)",
1053+
"build-only (standalone binaries on a GitHub Release)",
1054+
],
1055+
)
1056+
.raw_prompt()?
1057+
.index
1058+
{
1059+
1 => Mode::BuildOnly,
1060+
_ => Mode::Publish,
1061+
}
10541062
};
10551063

10561064
let matrix = Select::new(

0 commit comments

Comments
 (0)