fixs: update import syntax and error handling in publish script#8415
Closed
Mohataseem89 wants to merge 1 commit intonodejs:mainfrom
Closed
fixs: update import syntax and error handling in publish script#8415Mohataseem89 wants to merge 1 commit intonodejs:mainfrom
Mohataseem89 wants to merge 1 commit intonodejs:mainfrom
Conversation
correcting the JSON import syntax for ESM. ensuring cleanedPkg.imports exists before assignment. improving spawnSync error handling to exit on failure. Signed-off-by: Mohataseem Khan <mohataseem89@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
👋 Codeowner Review RequestThe following codeowners have been identified for the changed files: Team reviewers: @nodejs/web-infra Please review the changes when you have a chance. Thank you! 🙏 |
Member
|
These changes are wrong.
|
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.
Description:
This PR fixes issues in packages/ui-components/scripts/publish.mjs that could cause the publish process to fail under certain conditions.
problems addressed:
invalid JSON import syntax:
original: import pkg from '../package.json' with { type: 'json' };
fixed to: import pkg from '../package.json' assert { type: 'json' }; for proper ESM import
potential undefined imports object:
original code assumed cleanedPkg.imports exists.
fixed by ensuring cleanedPkg.imports = cleanedPkg.imports || {}
Error handling for spawnSync
minor improvements:
cleaned up comments for clarity
ensures top-level await works in ESM modules