medic / cht-conf

A command-line interface for configuring Community Health Toolkit applications
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
23 stars 25 forks source link

fix(#596) fix issue with semver validation for latest versions #597

Closed 1yuv closed 8 months ago

1yuv commented 8 months ago

Description

[description]

medic/cht-conf#596

Code review items

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

1yuv commented 8 months ago

Hi @kennsippell , I've added few more scenarios for unit test. The original inetnt of this issue was to fix the scenarios where valid CHT core versions like 4.5.0.xxxx were not being parsed properly and an error was being thrown.

Before this fix, if you were running upload-app-settings against any CHT instance with 4.5.0, it'd fail because /api/deployinfo returns version 4.5.0.6922454971 causing actualCoreVersion to be falsy and crash when running semver.lt(). semver.coerce would correctly parse 4.5.0.6922454971 to 4.5.0 and fix the problem.

Even after adding coerce, I added check on if actualCoreVersion is undefined or not to stop it from failing.

const addNoolsBoilerplate = actualCoreVersion && semver.lt(actualCoreVersion, '4.2.0-dev');

However, if you think we should still crash the app and prevent users from running cht upload-app-settings in non-standard versions, I can remove that undefined check.

If you're looking for previous isntances where CHT version was not a valid semver, you can see these on this (pvt) scraper output.

1yuv commented 8 months ago

Oops, missed a colon again while merging, sending another PR to release @kennsippell , @jkuester

medic-ci commented 8 months ago

:tada: This PR is included in version 3.21.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: