-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Proposal for Adapting compare_versions to OpenHarmony
Background
OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. Its goal is to build an operating system framework and platform for smart terminal devices aimed at all-scenario, fully connected, and intelligent era.
OpenHarmony uses JavaScript to develop native desktop applications, particularly suitable for building lightweight, cross-device application interfaces and interaction logic. The feature of "develop once, run on multiple ends" promises to attract more JS developers, promoting the explosive growth of lightweight IoT applications. For teams familiar with frontend technologies, OpenHarmony + JS is undoubtedly an efficient path into the all-scenario smart ecosystem.
compare_versions is a library used for comparing version numbers, providing a simple and reliable way to compare the magnitude of two version numbers. This library supports various version number formats such as numeric form, semantic, and other common formats. By using compare-versions, developers can easily determine if one version number is greater than, equal to, or less than another, thus achieving effective version management and control.
Currently, compare_versions has been widely used in the field of mobile application development on OpenHarmony. We believe this provides an excellent opportunity to further expand the user base of compare_versions.
We will submit the adaptation code as soon as possible through a pull request (PR). Creating this Issue aims to engage in-depth discussions with the community regarding the integration of the adaptation code. We sincerely welcome your valuable suggestions.
The first PR we hope to include installation instructions under the OpenHarmony development environment in the project README, along with hyperlinks pointing to OpenHarmony development examples, hoping to attract more frontend developers to notice the OpenHarmony system. Subsequently, during the use by OpenHarmony community developers, any defects discovered or new generic requirements identified will be actively fed back and contributed to the compare_version project.
We will also continue to participate in the compare_versions community and provide technical support for using compare_versions on OpenHarmony.
Adaptation Plan
The adaptation work of compare_versions on OpenHarmony has been completed, including:
- Providing a demo for using compare_versions in HarmonyOS.
- Following the OHPM (OpenHarmony Package Manager) specification, the adapted version has been published to the OpenHarmony third-party software package central warehouse.
As a general-purpose version management tool, compare_versions can help developers better achieve version compatibility control of OpenHarmony applications, thereby enhancing its distributed capabilities, ecological uniformity, and system stability.
Test Results
Based on the OpenHarmony system, unit tests were conducted on compare_versions using the original library test cases.
Verified in the following versions:
- DevEco Studio: NEXT Beta1-5.0.3.806, SDK: API12 Release(5.0.0.66)
- DevEco Studio: 4.1 Canary(4.1.3.213), SDK: API11 4.1.2.3
| Method Name | Parameters | Description |
|---|---|---|
| compareVersions(string,string):number | Compares the size relationship between two version numbers. Returns -1 (former version is smaller), 0 (same version), 1 (former version is larger) | |
| compare(string,string,operator:string):boolean | operator: operator | Version comparison, supporting operators |
| satisfies(string,string):boolean | Determines whether a version meets specific conditions, supporting operators | |
| validate(string):boolean | Verifies if it's a version number, relatively lenient, allowing some common non-strict formats. | |
| validateStrict(string):boolean | Verifies if it's a version number, strictly adhering to SemVer specifications. |
Detailed test reports are available upon request.
Upstream Community Benefits
- Ability to reach OpenHarmony's vast user base and developer community.
- Ensuring the project's long-term development potential by supporting cutting-edge operating system trends.
- Keeping up with leading-edge trends technologically by actively adapting to the HarmonyOS system, maintaining a leading position.
- Enhancing the project's processing capabilities in diverse runtime environments.
- Better prepared to handle complex and ever-changing operating system environments in the future.
Tags
Enhanced functionality, compatibility, cross-platform