Skip to content

Conversation

@fry69
Copy link

@fry69 fry69 commented Oct 13, 2025

This fixes two issue:

  • If not run as part of the npm version process, the process.env.npm_package_version is not set and then the version property from manifest.json will get removed. The script should fail with an error if targetVersion cannot be determined.
  • The versions.json file does not seem to get updated, the new version does not get added to the property list/dictionary.

Generated message below:


Changes made:

  1. Added validation for targetVersion: The script now checks if process.env.npm_package_version is set. If not, it prints an error message and exits with status code 1. This prevents the script from removing the version property from manifest.json when run outside the npm version context.

  2. Fixed the versions.json update logic: Changed from if (!Object.values(versions).includes(minAppVersion)) to if (!versions[targetVersion]). The original logic was checking if the minAppVersion VALUE existed anywhere in the versions dictionary, which was incorrect. The fix now properly checks if the targetVersion KEY already exists in the versions object, ensuring new versions are added correctly.

Both fixes are minimal and maintain the script's simplicity. The script will now:

  • Fail safely if not run via npm version
  • Correctly add new version entries to versions.json each time a new version is bumped

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