NativeScript / NativeScript/nativescript-cli
Use npm's semver rules for plugin's nativescript key
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 204
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 8
Description
Problem with plugins verification with runtimes
Currently each NativeScript plugin must have nativescript key in it's package.json and define the minimum required version of each supported runtime. The structure is :
"name": "my-plugin",
"version": "1.0.0",
"nativescript": {
"platforms": {
"ios": "1.5.0",
"android": "1.5.0",
}
}
When tns plugin add my-plugin is executed, CLI checks the values against current runtimes versions and informs the user if a plugin cannot be used with current version.
However CLI uses the specified version in the plugin as minimum required. So for example in case the project uses tns-android 1.6.0, 1.6.2 or even 2.0.0 for example, it can use my-plugin.
This makes it really hard to control the versions against which the plugin is tested and verified by the plugin author.
Suggested solution
Do not reinvent the wheel!
Use semver rules for the nativescript key in package.json, for example:
"name": "my-plugin",
"version": "1.0.0",
"nativescript": {
"platforms": {
"ios": "^1.5.0",
"android": "~1.5.0",
}
}
This way in case the project targets android 1.5.2, the plugin can be installed, but in case it targets 1.6.0, the plugin will not be available. More information for the version ranges:
https://docs.npmjs.com/getting-started/semantic-versioning#semver-for-consumers
Breaking change
In case we implement this idea, all plugins, which currently has nativescript key inside their package.json, will not work, as the values: "1.5.0" will mean - can work with this version only.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the tns plugin add verification flow and the nativescript section of plugin package.json files; review how runtime versions are currently compared. Use npm's documented semver ranges so exact, caret, and tilde values produce the proposed compatibility behavior, and verify both supported and rejected runtime versions with tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100