Skip to content

fixs: update import syntax and error handling in publish script#8415

Closed
Mohataseem89 wants to merge 1 commit intonodejs:mainfrom
Mohataseem89:patch-1
Closed

fixs: update import syntax and error handling in publish script#8415
Mohataseem89 wants to merge 1 commit intonodejs:mainfrom
Mohataseem89:patch-1

Conversation

@Mohataseem89
Copy link

@Mohataseem89 Mohataseem89 commented Dec 13, 2025

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:

  1. 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

  2. potential undefined imports object:
    original code assumed cleanedPkg.imports exists.
    fixed by ensuring cleanedPkg.imports = cleanedPkg.imports || {}

  3. Error handling for spawnSync

  4. minor improvements:
    cleaned up comments for clarity
    ensures top-level await works in ESM modules

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>
@Mohataseem89 Mohataseem89 requested a review from a team as a code owner December 13, 2025 15:56
@vercel
Copy link

vercel bot commented Dec 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nodejs-org Error Error Dec 13, 2025 3:56pm

@github-actions
Copy link
Contributor

👋 Codeowner Review Request

The 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! 🙏

@avivkeller
Copy link
Member

These changes are wrong.

  1. Import assertions use the with keyword
  2. imports does exist on the package.json
  3. We already set the exit code based on the status.

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.

2 participants