Repository navigation
Read the package version under npm 12 as well - #62
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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--jsonit 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
--jsonand accept both shapes; fail with the raw output if neither matches.npm query --jsonandnpm viewbehave the same under npm 12.Verification
The new reader returns
0.4.0for@mapconductor/js-sdk-corewith npm 11.6.2 and npm 12.2.2 locally; the workflow YAML parses.