Skip to content

Read the package version under npm 12 as well - #62

Merged
wf9a5m75 merged 1 commit into
developfrom
fix/npm12-pkg-get
Nov 12, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
fix/npm12-pkg-get

Conversation

@wf9a5m75

Copy link
Copy Markdown
Contributor

Summary

The npm publish run 43221430505 failed in "Preview npm packages" with SyntaxError: Unexpected token '@', "@mapconduc"... is not valid JSON. Nothing was published.

Cause: the workflow now installs npm 12, which prints npm pkg get version --workspace <pkg> as plain text (@mapconductor/js-sdk-core 0.4.0); with --json it prints {"<name>": {"version": "0.4.0"}}. The workflow parsed npm 11's {"<name>": "0.4.0"} without --json.

Fix (both places that read the version — preview and publish): pass --json and accept both shapes; fail with the raw output if neither matches. npm query --json and npm view behave the same under npm 12.

Verification

The new reader returns 0.4.0 for @mapconductor/js-sdk-core with npm 11.6.2 and npm 12.2.2 locally; the workflow YAML parses.

npm 12 prints 'npm pkg get version' as plain text ('<name> <version>') and, with --json, as {"<name>": {"version": "<version>"}}. The workflow parsed the npm 11 shape {"<name>": "<version>"} without --json, so the preview step failed with 'Unexpected token @' after the switch to npm 12 and nothing was published. Pass --json and accept both shapes, failing loudly if neither matches.
@wf9a5m75
wf9a5m75 merged commit ab5b918 into develop Nov 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant