Commit 0a80d89
authored
JS: fix npmPublish skip detection that always reported "already published" (#7570)
* JS: fix npmPublish skip detection that always reported "already published"
PR #7552 added an `onlyIf` block that ran `npm view @openrewrite/rewrite@<version>
version` and skipped publishing if the captured output contained the version
string. With `redirectErrorStream(true)`, npm's 404 error message also contains
the requested version (e.g. "The requested resource '@openrewrite/rewrite@<version>'
could not be found"), so the contains-check matched on every miss and silently
skipped npm publish for any newly-stamped snapshot.
The npm prerelease tag has been frozen at 8.82.0-20260502-150813 since then,
while Maven snapshots continue to advance with the latest commit timestamp.
Downstream consumers that try to spawn the JS RPC subprocess via
`npx --package=@openrewrite/rewrite@<jar-version> rewrite-rpc` then fail with
ETARGET because the version baked into the JAR's resource is not on npm,
breaking CI in repositories like rewrite-static-analysis.
Switch the check to use `npm view`'s exit code (and verify the version appears
on its own line in stdout) so we only skip when the version is genuinely
already published.
* JS: simplify npmPublish version match to contains
Address review feedback: with the exit-code gate in place, the merged
stderr/stdout 404 case can no longer reach this check, so a simple
contains is enough and is more forgiving of minor npm view output
formatting differences.1 parent 17954ad commit 0a80d89
1 file changed
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | 266 | | |
268 | | - | |
| 267 | + | |
269 | 268 | | |
270 | 269 | | |
271 | 270 | | |
| |||
0 commit comments