This repository was archived by the owner on Nov 17, 2022. It is now read-only.
-
- Notifications
You must be signed in to change notification settings - Fork 447
plugins more readable #1130
Closed
Closed
plugins more readable #1130
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| --- | ||
| title: Using Plugins | ||
| title: Plugins Overview | ||
| description: When the NativeScript modules do not provide the native device or platform capability that you need, you can use NativeScript plugins. | ||
| position: 10 | ||
| slug: plugins-infrastructure | ||
| | @@ -8,56 +8,48 @@ previous_url: /plugins | |
| | ||
| # Using Plugins | ||
| | ||
| NativeScript plugins are npm packages with some added native functionality. Therefore, finding, installing, and removing NativeScript plugins works a lot like working with npm packages you might use in your Node.js or front-end web development. | ||
| NativeScript plugins are [npm packages](https://docs.npmjs.com/getting-started/packages) with added functionality. Finding, installing, and removing NativeScript plugins works the same way as eg: a Node.js server or front-end web development. | ||
| | ||
| * [Finding Plugins](#finding-plugins) | ||
| * [Existing Community Plugins](#existing-community-plugins) | ||
| * [Installing Plugins](#installing-plugins) | ||
| * [Removing Plugins](#removing-plugins) | ||
| | ||
| > **Tip:** Alternatively, you can search, install, and remove plugins with [NativeScript Sidekick](https://www.nativescript.org/nativescript-sidekick). Sidekick also offers starter kits, single page templates, cloud-based builds for iOS and Android, and app store publishing. | ||
| > **Top Tip:** Use [NativeScript Sidekick](https://www.nativescript.org/nativescript-sidekick) to search, install, and remove plugins with. Sidekick also has starter kits, single page templates, cloud-based builds for iOS and Android, and app store publishing with more in development. | ||
| | ||
| ## Finding plugins | ||
| ## Existing Community Plugins | ||
| | ||
| Because NativeScript plugins are npm packages, you can find NativeScript plugins on npm’s own site by searching for “nativescript-plugin-name”. For example a search of “nativescript accelerometer” would point you right at the [NativeScript accelerometer plugin](https://www.npmjs.com/package/nativescript-accelerometer). | ||
| The [market.nativescript.org](https://market.nativescript.org/) site lists NativeScript specific plugins; a filtered list of npm packages from the upstream (npmjs.com)[https://www.npmjs.com] site. | ||
| | ||
| The NativeScript team also maintains an [official marketplace](http://market.nativescript.org/), which displays a filtered list of NativeScript-related plugins from npm. A search for “accelerometer” on the plugins marketplace will point you at the plugin you need. | ||
| - NativeScript targeted plugins generally (not mandatory) use the `nativescript-*` format | ||
| - eg [nativescript-accelerometer](https://www.npmjs.com/package/nativescript-accelerometer) | ||
| | ||
|  | ||
| | ||
| If you don’t find a plugin you need try asking for help on the [NativeScript community forum](https://discourse.nativescript.org/c/plugins). The NativeScript team and community may be able to help find what you’re looking for. | ||
| | ||
| Also, make sure to look through the [NativeScript core modules](https://docs.nativescript.org/core-concepts/modules), which ship as a dependency of every NativeScript app. There’s a chance that the functionality you need is built in. If you’re still not finding what you need, you can request the plugin as an idea on the [NativeScript community forum](https://discourse.nativescript.org/c/plugins), or you can take a stab at [building the plugin yourself](/plugins/building-plugins/). | ||
| Also check or ask for help on the [NativeScript plugins forum](https://discourse.nativescript.org/c/plugins) as NativeScript team and community may be able to help find what is required. | ||
| | ||
| ## Installing Plugins | ||
| | ||
| Once you’ve found the plugin you need, install the plugin into your app using the `tns plugin add` command. | ||
| | ||
| ``` | ||
| tns plugin add <plugin-name> | ||
| ``` | ||
| To install a plugin dependancy into an app use the `tns plugin add` command. | ||
| | ||
| For example, the following command installs the [NativeScript camera plugin](http://market.nativescript.org/plugins/nativescript-camera). | ||
| Eg: the following command installs the [NativeScript camera plugin](http://market.nativescript.org/plugins/nativescript-camera) plugin with a few. Note it also ammends the package.json file and a few other `tns` tricks. | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again as a reading convention, it would be clearer to use "For example" instead of e.g. | ||
| | ||
| ``` | ||
| ```bash | ||
| tns plugin add nativescript-camera | ||
| ``` | ||
| | ||
| The installation of a NativeScript plugin mimics the installation of an npm package. The NativeScript CLI downloads the plugin from npm, and adds the plugin to the `node_modules` folder in the root of your project. During this process, the NativeScript CLI adds the plugin to your project’s root `package.json` file, and also resolves the plugin’s dependencies (if any). | ||
| Installation of a NativeScript plugin mimics the installation of an npm package. | ||
| - downloads the plugin from npm unless 404, 500 or even a 418 | ||
| - extracts the plugin into the `node_modules/` folder at the root of project | ||
| - adds the plugin to the project root `package.json` file | ||
| - resolves the plugin’s dependencies, if any | ||
| | ||
| ## Removing Plugins | ||
| | ||
| To remove a NativeScript plugin from your project, run the following command from your command line. | ||
| To remove a plugin from a project, run the following command | ||
| | ||
| ``` | ||
| tns plugin remove <plugin-name> | ||
| ``` | ||
| | ||
| For example, the following command removes the NativeScript camera plugin. | ||
| | ||
| ``` | ||
| ```bash | ||
| tns plugin remove nativescript-camera | ||
| ``` | ||
| As with installation, the removal of a NativeScript plugin mimics the removal of an npm package | ||
| - removes any plugin files from the app’s `node_modules/` folder in at root of project | ||
| - removes any of the plugin’s dependencies | ||
| - removes the plugin from the project’s root `package.json` file | ||
| | ||
| As with installation, the removal of a NativeScript plugin mimics the removal of an npm package. | ||
| | ||
| The NativeScript CLI removes any plugin files from your app’s `node_modules` folder in the root of your project. The CLI also removes any of the plugin’s dependencies, and also removes the plugin from your project’s root `package.json` file. | ||
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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.
Perhaps we should stick to a global naming convention and use exclusively Tip or Note