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

Đang mở
#1,530 17 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, node.js
Lĩnh vực
cli, mobile-dev

Hướng nghiên cứu

Bắt đầu với luồng xác minh của tns plugin add và phần nativescript trong các tệp package.json của plugin; xem lại cách các phiên bản runtime hiện được so sánh. Sử dụng các dải semver được npm ghi nhận để các giá trị chính xác, caret và tilde tạo ra hành vi tương thích được đề xuất, đồng thời kiểm tra bằng các bài test cả những phiên bản runtime được hỗ trợ và bị từ chối.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

breaking-change feature plugins
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.

Ngôn ngữ chính
JavaScript
Star
1.1k
Fork
204
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
8

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NativeScript/nativescript-cli

Tất cả issue của NativeScript/nativescript-cli

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.