Skip to content

fix: make startNewVersion script cross-platform (fixes #609)#627

Open
armorbreak001 wants to merge 1 commit into
asyncapi:masterfrom
armorbreak001:bounty/609-windows-script
Open

fix: make startNewVersion script cross-platform (fixes #609)#627
armorbreak001 wants to merge 1 commit into
asyncapi:masterfrom
armorbreak001:bounty/609-windows-script

Conversation

@armorbreak001

Copy link
Copy Markdown
Contributor

Description

Fixes #609

Problem

npm run startNewVersion --newVersion=3.1.0 fails on Windows with:

'newVersion' is not recognized as an internal or external command

Root cause: newVersion= is Unix shell syntax, incompatible with Windows CMD/PowerShell.

Solution

Two-part fix:

  1. scripts/add-new-version.js: Added fallback to process.env.npm_config_new_version so the script can read the version directly from npm config
  2. package.json: Changed script to use node -e wrapper for cross-platform environment variable setting

Changes

  • scripts/add-new-version.js: 1 line changed (fallback)
  • package.json: 1 script updated

Testing

  • Script still works on Unix/Mac (npm_config_new_version is set by npm automatically)
  • Script now works on Windows (no shell-specific syntax)
  • No new dependencies required

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

The npm script used Unix-specific env var syntax (newVersion=...)
which fails on Windows CMD. Fixed by:

1. Script: fallback to process.env.npm_config_new_version
2. Package.json: use node -e wrapper for cross-platform compat

Fixes asyncapi#609
@sonarqubecloud

Copy link
Copy Markdown

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.

[BUG] startNewVersion script fails on Windows due to Unix shell syntax

1 participant