NativeScript / NativeScript/nativescript-cli

Use npm's semver rules for plugin's nativescript key

オープン
#1,530 コメント 17 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

breaking-change feature plugins
主要言語
JavaScript
スター
1.1k
フォーク
204
平均マージ
1日 9時間
マージ済み PR(30日)
8

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

tns plugin add の検証フローと、プラグインの package.json ファイルにある nativescript セクションから着手し、現在ランタイムのバージョンがどのように比較されているかを確認します。npm がドキュメント化している semver 範囲を使用し、完全一致、caret、tilde の値で提案された互換性の動作になるようにし、テストでサポート対象のランタイムバージョンと拒否されるランタイムバージョンの両方を検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
cli, mobile-dev
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。