NativeScript / NativeScript/nativescript-cli
Make `tns doctor` command readonly
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 1.1k
- 分支
- 204
- 平均合併
- 1 天 9 小時
- 30 天內合併 PR
- 8
描述
Is your feature request related to a problem? Please describe.
We've been working with the nativescript CLI for the past few days trying to get a build up and running for iOS on CircleCI (circleci.com) using mostly the following resources as a reference.
- The official tutorial (uses the now defunct CircleCI 1.0 API) https://www.nativescript.org/blog/start-testing-your-nativescript-apps-properly
- This implementation of a CircleCI 2.0 config https://github.com/SBats/tns-circleci-example
The problem we keep running into is that when we log into the CI virtual machine to debug MacOS builds, the NativeScript CLI is always trying, seemingly whatever command we run, to throw up interactive prompts and write state and modify the system, when what we really need is a way to diagnose what exactly is going on.
For example, a call to tns doctor
- asks about whether we want to opt into data collection
- asks if we want to install XCode and other dependencies, and if so wants to dump
- prompts if we want to use cloud or local builds.
- Takes a very long time on resource constrained virtual machines.
This makes it very difficult to debug dependency problems on CI for MacOS (and CI in general really)
For example, this is a transcript of the tns doctor command on a Circle mac vm.
bash-3.2$ yarn tns doctor
yarn run v1.12.1
$ /Users/distiller/project/node_modules/.bin/tns doctor
Do you want to help us improve NativeScript by automatically sending anonymous usage statistics? We will not use this information to identify or contact you. You can read our official Privacy Policy at
? http://www.telerik.com/company/privacy-policy No
TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.
There seem to be issues with your configuration.
You are missing the nativescript-cloud extension and you will not be able to execute cloud builds. Your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options:
Select "Sync to Playground" to enjoy NativeScript without any local setup. All you need is a couple of companion apps installed on your devices.
Select "Configure for Cloud Builds" to install the nativescript-cloud extension and automatically configure your environment for cloud builds.
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.
Select "Configure for Both Local and Cloud Builds" to automatically configure your environment for both options.
? To continue, choose one of the following options:
Sync to Playground
Configure for Cloud Builds
❯ Configure for Local Builds
Configure for Both Local and Cloud Builds
Skip Step and Configure Manually
? To continue, choose one of the following options: Configure for Local Builds
Running the setup script to try and automatically configure your environment.
These scripts require sudo permissions
NativeScript requires Xcode.
If you do not have Xcode installed, download and install it from App Store and run it once to complete its setup.
Do you have Xcode installed? (y/n)
#(snip XCode license agreement)
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel] agree
You can view the license agreements in Xcode's About Box, or at /Applications/Xcode-10.1.app/Contents/Resources/English.lproj/License.rtf
Allow the script to install Homebrew?
(Y)es/(N)o
It goes on from there, updating homebrew, asking to install the android SDK.... In other words, I can't get a diagnosis of the system without changing the system I'm trying to diagnose. Which means that overall, it is not friendly to working with CI.
Describe the solution you'd like
- I'd like first and foremost a command, whether
tns doctoror otherwise that, only reads system state and produces a list of potential problems with its configuration. - In general, never produce side-effects, or prompt for input unless the user is executing an inherently imperative command. For example, the opt-in dialog to collect metrics happens with every single command. IMHO it should only happen on
tns initortns create(and even in these cases have an option to disable it) - Split commands into those that read state and those that write state and don't intertwine them.
Describe alternatives you've considered
I don't see that there is an alternative other than muddling through.
Additional context
I think NativeScript is a great project and that it could really benefit from a little more disentanglement of side-effects inside the CLI. Especially when it comes to using nativescript CLI as a general purpose build and deployment tool rather than just an individual developer tool.
Thank you for listening!
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先追蹤 tns doctor 指令以及 issue 中描述的指標提示,然後找出診斷檢查在哪些地方觸發提示或系統變更。將指令的行為與所要求的唯讀 CI 使用案例進行比較。當診斷路徑能在沒有提示或副作用的情況下回報設定問題,並將命令式設定與狀態檢查分離時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 28/100