-
- Notifications
You must be signed in to change notification settings - Fork 447
Add article "Ensure Plugins Quality" #824
Conversation
8cced80
to f224c75
Compare plugins/plugin-sanity-check.md Outdated
- built for iOS | ||
- bundled with webpack | ||
| ||
Ignoring any of these non-functional requirements could lead to not working app. Let’s call verification of these requirements – sanity checks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatical - change to could lead to an app not working
Also grammatical/logical - Throughout the article we'll be referring to the verification of those requirements as 'sanity checks'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't get the first one. Is this really correct?
Agree on the second one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few comments concerning style, grammar, and logic, which I believe will improve the article.
plugins/plugin-sanity-check.md Outdated
| ||
Ignoring any of these non-functional requirements could lead to not working app. Let’s call verification of these requirements – sanity checks. | ||
| ||
This article answers the following questions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to This article will cover:
and proceed with statements instead of questions. For example: What you need to setup sanity checks for your NS plugins
; Check your plugin's code for readability....
The (lack of a) question mark makes all the difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prerequisites
might also be shorter for What you need ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
## What do you need to setup sanity checks for your NativeScript plugin? | ||
| ||
As we mentioned earlier, NativeScript plugins are building blocks. They work as part of the NativeScript application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. as part of Nativescript application**s**.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pluralize 'application'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
## What do you need to setup sanity checks for your NativeScript plugin? | ||
| ||
As we mentioned earlier, NativeScript plugins are building blocks. They work as part of the NativeScript application. | ||
Add a simple `demo` application that shows how the plugin works. If the plugin is Angular compatible, there should be another `demo-angular` application as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence doesn't sound logically related to the previous one - As we mentioned earlier...
Consider adding something along the lines of NativeScript apps can be written in both Angular, or just plain JavaScript/TypeScript, they can also take advantage of the webpack feature to cut off the excess code. In order to ensure that your/our plugin runs reliably in any NativeScript application, there are certain prerequisites you may need to complete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
"prepublishOnly": "npm run build" | ||
``` | ||
| ||
This script will be executed before the package is prepared and packed, only on npm publish. More details can be found in the [npm-script documentation](https://docs.npmjs.com/misc/scripts). The build script (defined above) will be executed. This is important because in this way the TypeScript of the plugin will be compiled and the required metadata will be generated any time before publishing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script will be executed before the package is prepared and packed, only on npm publish.
is shortly followed by The build script (defined above) will be executed.
Which statement is correct, and when?
also (grammatical) ... will be generated any time ...
replace with ... will be generated every time ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
## How to check your plugin’s code for readability, maintainability, and functionality errors? | ||
| ||
[TSLint](https://palantir.github.io/tslint/) is a great tool for static analysis of your plugin’s code. It will test the plugin for readability and maintainability as well as functionality errors based on customizable rules. This is a [list of all TSLint rules](https://palantir.github.io/tslint/rules/) you can check for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Logical) change the last sentence to A complete list with the available TSLint rules can be found in the [tsling repository](https://palantir.github.io/tslint/rules/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
`tools` and `platform-tools` components define that the latest revision of Android SDK Tools will be installed. More info [here](https://docs.travis-ci.com/user/languages/android/#Overview) | ||
| ||
`build-tools-23.0.1` component defines the BuildTools version that will be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we recommend building with build-tools 25.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should clarify this! My understanding was that {N} works great with the latest versions of Android and iOS but I think the right approach is to test the apps and plugins with the most popular versions of Android and iOS and as you can see from the statistics for Android it is not 25.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you are confusing build-tools with compileSdk, or possibly even with targetSdk. {N} works equally well with all compileSdks. And we do also recommend building against the latest compileSdk, we do it implicitly too, unless stated otherwise while tns build
-ing with the --compileSdk
flag.
As for the build-tools - it is a set of libraries and executables that processes resources, packages your application, signs your app package, etc. They are required to build android applications.
The build-tools requirement is also in our setup articles - http://uatdocs.nativescript.org/start/ns-setup-os-x#system-requirements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it. Thanks for the info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
`extra-android-m2repository` component defines the support library repositories. | ||
| ||
`sys-img-armeabi-v7a-android-23` component defines the system image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component defines the system image of the android emulator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
``` | ||
The scripts (`ci.android.build` and `ci.ios.build`) that are executed for building for iOS and Android are located in [package.json](https://github.com/NativeScript/nativescript-facebook/blob/master/demo/package.json#L48) file of any of the demo apps. | ||
| ||
If everything is configured appropriately these sanity checks will be executed on every code change. The result will look like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If everything is configured appropriately these sanity checks will be executed on every code change. The result will look like this:
-> If everything is configured properly, the sanity checks will execute on every code change. The result, and whether the checks pass or not, will look like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
 | ||
| ||
The huge benefit for NativeScript plugin authors is that once having this sanity checks set up, You guys can be more confident about the quality of your plugins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are addressing plugin authors directly, you can talk about their plugins. The huge benefit for NativeScript plugin authors is that once having this sanity checks set up, You guys can be more confident about the quality of your plugins.
-> The main benefit of having sanity checks in place for your NativeScript plugins is that you can develop without spending additional time to ensure your changes don't break existing applications depending on your plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
The huge benefit for NativeScript plugin authors is that once having this sanity checks set up, You guys can be more confident about the quality of your plugins. | ||
| ||
By the way, do not forget to [add TravisCI badge](https://docs.travis-ci.com/user/status-images/) in your NativeScript plugin's project! It's fancy! No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, do not forget to [add TravisCI badge](https://docs.travis-ci.com/user/status-images/) in your NativeScript plugin's project! It's fancy!
-> Do not forget to .... plugin repository/project/readme. It reports live status of your CI build and makes your plugin look more reliable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I think this is great. My comments are mostly minor grammatical things, although I did have a few relatively trivial things I thought could use some clarifications.
If you have any questions let me know, although I will be out next Monday & Tuesday for a US holiday 🇺🇸 🎆
plugins/plugin-sanity-check.md Outdated
@@ -0,0 +1,291 @@ | |||
--- | |||
title: Sanity Check A Plugin | |||
description: Guideline how to sanity check NativeScript plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A series of tips on how to sanity check a NativeScript plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
--- | ||
title: Sanity Check A Plugin | ||
description: Guideline how to sanity check NativeScript plugin | ||
position: 60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same position
as the “Plugin Reference” article. I think we’d want this article to come before that one... but I could go either way. In any case make sure you alter these numbers before you publish. I’d probably just change the position
in plugin-reference.md
to something like 100
because I think we’ll always want that one last.
plugins/plugin-sanity-check.md Outdated
- built for iOS | ||
- bundled with webpack | ||
| ||
Ignoring any of these non-functional requirements could lead to not working app. Throughout the article we'll be referring to the verification of those requirements as 'sanity checks'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could lead to not working app
could lead to an app that doesn’t work as expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throughout the article
Throughout this article,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
Ignoring any of these non-functional requirements could lead to not working app. Throughout the article we'll be referring to the verification of those requirements as 'sanity checks'. | ||
| ||
This article will cover: | ||
- [Setup sanity checks for your NativeScript plugin](#setup-sanity-checks-for-your-nativescript-plugin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setup sanity checks
Setting up sanity checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
This article will cover: | ||
- [Setup sanity checks for your NativeScript plugin](#setup-sanity-checks-for-your-nativescript-plugin) | ||
- [Check your plugin’s code for readability, maintainability, and functionality errors](#check-your-plugins-code-for-readability-maintainability-and-functionality-errors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
``` | ||
- npm install -g nativescript | ||
- npm install -g tslint | ||
- npm install -g typescript@2.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it have to be TypeScript version 2.2.2? Seems like that might become a maintenance nightmare for this documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
``` | ||
- tns usage-reporting disable | ||
``` | ||
Configures anonymous usage reporting for the NativeScript CLI. More info [here](https://github.com/NativeScript/nativescript-cli/blob/master/docs/man_pages/general/usage-reporting.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean error reporting here....? You’re including the same text twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
``` | ||
Refer to nativescript-facebook [.travis.yml file](https://github.com/NativeScript/nativescript-facebook/blob/doc/.travis.yml#L61-L67) to see this in reality. | ||
| ||
As we mention earlier the plugin should be sanity checked on Android as well as on iOS. The Android specific requirements can be defined in `.travis.yml` file in `android` section: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we mentioned earlier,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
before_install: nvm install 6.10.3 | ||
script: cd demo && npm run build.plugin && npm i && npm run build-android-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-android-bundle | ||
``` | ||
This stage includes 2 builds that run in parallel. One for Android and one for iOS. Note that the nodejs on the Linux machine is installed because it is not included in the image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stage includes two builds that run in parallel—one for Android, and one for iOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
The main benefit of having sanity checks in place for your NativeScript plugins is that you can develop without spending additional time to ensure your changes don't break existing applications depending on your plugin. | ||
| ||
Do not forget to [add TravisCI badge](https://docs.travis-ci.com/user/status-images/) in your NativeScript plugin's project! It reports live status of your CI build and makes your plugin look more reliable. No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to add a Travis CI badge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
position: 50 | ||
slug: sanity-check-plugin | ||
--- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to add your article title here as h1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
NativeScript apps can be written in both Angular, or just plain JavaScript/TypeScript and they can also take advantage of the [webpack bundling]({% slug bundling-with-webpack %}) to cut off the excess code. In order to ensure that your plugin runs reliably in any NativeScript application, there are certain prerequisites you may need to complete. | ||
| ||
All plugins should have a demo folder that contains a demo application showing how the plugin works. If you use the NativeScript plugin seed you will have this folder by default. If your plugin is a user interface plugin, and you need to test the plugin in both Angular and non-Angular apps, you should have an additional demo-angular folder containing an Angular app you can test your plugin in. Refer to the article ["Supporting Angular in UI Plugins"]({% slug supporting-angular-in-ui-plugins %}) for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can link the plugin seed when you mention it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
[TSLint](https://palantir.github.io/tslint/) is a great tool for static analysis of your plugin’s code. It will test the plugin for readability and maintainability as well as functionality errors based on customizable rules. A complete list with the available TSLint rules can be found in the [tsling repository](https://palantir.github.io/tslint/rules/). | ||
| ||
The official NativeScript plugin seed recommends TSLint rules defined in this [tslint.json](https://github.com/NativeScript/nativescript-plugin-seed/blob/master/tslint.json) file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LInk the seed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
``` | ||
| ||
This script executes the `tslint` command passing the tslint rules defined in `tslint.json` file. The installed `node_modules` will be excluded from the static analysis. | ||
Having `tslint.json` on root level allows using same TSLint rules for demo apps as well adding the same script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Having tslint.json
on root level allows using same TSLint rules for demo apps as well adding the same script." -> @tjvantoll can correct this better but I would say it like "Having tslint.json
on root level allows using the same TSLint rules for both demo apps by adding the same script."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
| ||
The NativeScript command for building Android and iOS apps is: | ||
| ||
`tns build Android` and `tns build ios` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the casing doesn't matter but for integrity I would suggest to use "android" instead of "Android"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
``` | ||
Refer to nativescript-facebook [.travis.yml file](https://github.com/NativeScript/nativescript-facebook/blob/doc/.travis.yml#L60-L62) to see this in reality. | ||
| ||
As we mention earlier, the plugin should be sanity checked on Android as well as on iOS. The Android specific requirements can be defined in `.travis.yml` file in `android` section: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: mention -> mentioned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
before_install: nvm install 6.10.3 | ||
script: cd demo && npm run build.plugin && npm i && npm run build-android-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-android-bundle | ||
``` | ||
This stage includes two builds that run in parallel—one for Android, and one for iOS. Note that the nodejs on the Linux machine is installed because it is not included in the image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add spaces before and after the dash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
plugins/plugin-sanity-check.md Outdated
jdk: oraclejdk8 | ||
script: cd demo && npm run ci.ios.build && cd ../demo-angular && npm run ci.ios.build | ||
``` | ||
The scripts (`ci.android.build` and `ci.ios.build`) that are executed for building for iOS and Android are located in [package.json](https://github.com/NativeScript/nativescript-facebook/blob/master/demo/package.json#L49) file of any of the demo apps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can escape the repetition of "for" -> .. executed to build for iOS and Android..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| ||
The main benefit of having sanity checks in place for your NativeScript plugins is that you can develop without spending additional time to ensure your changes don't break existing applications depending on your plugin. | ||
| ||
Do not forget to [add a Travis CI badge](https://docs.travis-ci.com/user/status-images/) in your NativeScript plugin's project! It reports live status of your CI build and makes your plugin look more reliable. No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add ".. in github" -> Do not forget to add a Travis CI badge in your NativeScript plugin's project in github.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is no other place I think it is common sense that we are talking about GitHub repo.
| ||
Travis CI is a great way to automate plugin’s sanity checks. It is free for open-source projects. More details can be found in [Travis CI documentation](https://docs.travis-ci.com/). Travis CI will boot a virtual machine and execute commands based on the provided configuration in your `.travis.yml` file. | ||
| ||
First things first! Add an empty `.travis.yml` file on the root level of your plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think somewhere between these row you can add a sentence saying that if you use the seed, you have an initial .travis.yml file setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
4182d02
to e1d53ed
Compare 557c9d0
to e6654fa
Compare e6654fa
to 0b6b3a8
Compare This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
No description provided.