You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We, the rest of the NativeScript community, thank you for your
3
+
contribution!
4
+
To help the rest of the community review your change, please follow the instructions in the template.
5
+
-->
6
+
7
+
<!-- PULL REQUEST TEMPLATE -->
8
+
<!-- (Update "[ ]" to "[x]" to check a box) -->
9
+
10
+
## PR Checklist
11
+
12
+
-[ ] The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/CONTRIBUTING.md#commit-messages.
13
+
-[ ] There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
14
+
-[ ] All existing tests are passing
15
+
-[ ] Tests for the changes are included
16
+
17
+
## What is the current behavior?
18
+
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
19
+
20
+
## What is the new behavior?
21
+
<!-- Describe the changes. -->
22
+
23
+
Fixes/Implements/Closes #[Issue Number].
24
+
25
+
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
26
+
27
+
<!--
28
+
BREAKING CHANGES:
29
+
30
+
31
+
[Describe the impact of the changes here.]
32
+
33
+
Migration steps:
34
+
[Provide a migration path for existing applications.]
:+1: First of all, thank you for taking the time to contribute! :+1:
4
+
5
+
Here are some guides on how to do that:
6
+
7
+
<!-- TOC depthFrom:2 -->
8
+
9
+
-[Code of Conduct](#code-of-conduct)
10
+
-[Reporting Bugs](#reporting-bugs)
11
+
-[Requesting Features](#requesting-features)
12
+
-[Submitting a PR](#submitting-a-pr)
13
+
-[Where to Start](#where-to-start)
14
+
15
+
<!-- /TOC -->
16
+
17
+
## Code of Conduct
18
+
Help us keep a healthy and open community. We expect all participants in this project to adhere to the [NativeScript Code Of Conduct](https://github.com/NativeScript/codeofconduct).
19
+
20
+
21
+
## Reporting Bugs
22
+
23
+
1. Always update to the most recent master release; the bug may already be resolved.
24
+
2. Search for similar issues in the issues list for this repo; it may already be an identified problem.
25
+
3. If this is a bug or problem that is clear, simple, and is unlikely to require any discussion -- it is OK to open an issue on GitHub with a reproduction of the bug including workflows and screenshots. If possible, submit a Pull Request with a failing test, entire application or module. If you'd rather take matters into your own hands, fix the bug yourself (jump down to the [Submitting a PR](#submitting-a-pr) section).
26
+
27
+
## Requesting Features
28
+
29
+
1. Use Github Issues to submit feature requests.
30
+
2. First, search for a similar request and extend it if applicable. This way it would be easier for the community to track the features.
31
+
3. When requesting a new feature, please provide as much detail as possible about why you need the feature in your apps. We prefer that you explain a need rather than explain a technical solution for it. That might trigger a nice conversation on finding the best and broadest technical solution to a specific need.
32
+
33
+
## Submitting a PR
34
+
35
+
Before you begin:
36
+
* Make sure there is an issue for the bug or feature you will be working on.
37
+
38
+
Following these steps is the best way to get your code included in the project:
39
+
40
+
1. Fork and clone the nativescript-plugin-seed repo:
3. The fun part! Make your code changes. Make sure you:
54
+
- Follow the [code conventions guide](https://github.com/NativeScript/NativeScript/blob/master/CodingConvention.md).
55
+
- Follow the [commit message guidelines](https://github.com/NativeScript/NativeScript/blob/pr-template/CONTRIBUTING.md#commit-messages)
56
+
- Setup your development workflow. The seed itself is a plugin so you can follow the [development setup][https://github.com/NativeScript/nativescript-plugin-seed#development-setup] described in the README.
57
+
- Write unit tests for your fix or feature. If this is not possible, explain how your change can be tested.
58
+
> NOTE: For changes in the postclone step, make sure you create tests in `seed-tests/postclone.tests.js`!
59
+
60
+
4. Before you submit your PR:
61
+
- Rebase your changes to the latest master: `git pull --rebase upstream master`.
62
+
- Ensure all unit test are green. How?
63
+
- Go to `seed-tests`
64
+
- Run `npm install`
65
+
- Run `npm run test.ios` or `npm run test.android`
66
+
- Ensure your changes pass tslint validation. (run `npm run tslint` in the root of the repo).
67
+
68
+
6. Push your fork. If you have rebased you might have to use force-push your branch:
69
+
```
70
+
git push origin <my-fix-branch> --force
71
+
```
72
+
73
+
7.[Submit your pull request](https://github.com/NativeScript/nativescript-plugin-seed/compare) and compare to `NativeScript/nativescript-plugin-seed`. Please, fill in the Pull Request template - it will help us better understand the PR and increase the chances of it getting merged quickly.
74
+
75
+
It's our turn from there on! We will review the PR and discuss changes you might have to make before merging it! Thanks!
76
+
77
+
## Where to Start
78
+
79
+
If you want to contribute, but you are not sure where to start - look for issues labeled [`help wanted`](https://github.com/NativeScript/nativescript-plugin-seed/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).
Copy file name to clipboardExpand all lines: README.md
+55-30
Original file line number
Diff line number
Diff line change
@@ -2,36 +2,38 @@
2
2
3
3
> This repo is heavily based on [@NathanWalker](https://github.com/NathanWalker)'s [Plugin Seed](https://github.com/NathanWalker/nativescript-plugin-seed). Thanks, Nathan!
4
4
5
-
<!-- vscode-markdown-toc -->
6
-
*[TL;DR](#TLDR)
7
-
*[Long Description](#LongDescription)
8
-
* [What is NativeScript plugin seed?](#WhatisNativeScriptpluginseed)
-[Linking to CocoaPod or Android Arsenal plugins](#linking-to-cocoapod-or-android-arsenal-plugins)
14
+
-[Generating typings for iOS](#generating-typings-for-ios)
15
+
-[Generating typings for Android](#generating-typings-for-android)
16
+
-[Clean plugin and demo files](#clean-plugin-and-demo-files)
17
+
-[Unittesting](#unittesting)
18
+
-[Publish to NPM](#publish-to-npm)
19
+
-[TravisCI](#travisci)
20
+
-[Referring tns-core-modules in the Plugin](#referring-tns-core-modules-in-the-plugin)
21
+
-[Contribute](#contribute)
22
+
-[Get Help](#get-help)
23
+
24
+
<!-- /TOC -->
25
+
26
+
## TL;DR
25
27
The NativeScript plugin seed is built to be used as a starting point by NativeScript plugin developers. To bootstrap your plugin development execute the following:
26
28
27
29
1.`git clone https://github.com/NativeScript/nativescript-plugin-seed nativescript-yourplugin` where `nativescript-yourplugin` is the name of your plugin.
28
30
2.`cd nativescript-yourplugin/src`
29
31
3.`npm run postclone`
30
32
4.`npm run demo.ios` or `npm run demo.android` to run the demo. This will automatically watch for TypeScript changes also in your plugin and do the transpilation.
31
33
32
-
## <aname='LongDescription'></a>Long Description
34
+
## Long Description
33
35
34
-
### <aname='WhatisNativeScriptpluginseed'></a>What is NativeScript plugin seed?
36
+
### What is NativeScript plugin seed?
35
37
36
38
The NativeScript plugin seed is built to be used as a starting point by NativeScript plugin developers. It expands on several things [presented here](http://developer.telerik.com/featured/creating-nativescript-plugins-in-typescript/).
37
39
What does the seed give you out of the box?
@@ -46,7 +48,7 @@ What does the seed give you out of the box?
@@ -59,7 +61,7 @@ What does the seed give you out of the box?
59
61
|src/scripts|The postclone script run when you execute `npm run postclone`. Feel free to delete it after you have executed the postclone step from the [Getting started](#Gettingstarted) section|
60
62
|publish|Contains a shell script to create and publish your package. Read more on creating a package and publishing in the [Publish to NPM](#Publishtonpm) section|
61
63
62
-
### <aname='Gettingstarted'></a>Getting started
64
+
### Getting started
63
65
64
66
1. Open a command prompt/terminal and execute `git clone https://github.com/NativeScript/nativescript-plugin-seed nativescript-yourplugin` to clone the plugin seed repository into the `nativescript-yourplugin` folder where `nativescript-yourplugin` is the name of your plugin..
65
67
2. Open a command prompt/terminal and navigate to `nativescript-yourplugin/src` folder using `cd nativescript-yourplugin/src`
@@ -72,7 +74,7 @@ What does the seed give you out of the box?
72
74
73
75
Now you can continue with the development of your plugin by using the [Development setup](#Developmentsetup) described below.
For easier development and debugging purposes continue with the following steps:
77
79
78
80
1. Open a command prompt/terminal, navigate to `src` folder and run `npm run demo.ios` or `npm run demo.android` to run the demo.
@@ -82,7 +84,7 @@ Now go and make a change to your plugin. It will be automatically applied to the
82
84
83
85
NOTE: If you need to use a native library in your plugin or do some changes in Info.plist/AndroidManifest.xml, these cannot be applied to the demo project only by npm link. In such scenario, you need to use `tns plugin add ../src` from the `demo` so that the native libraries and changes in the above-mentioned files are applied in the demo. Then you can link again the code of your plugin in the demo by using `npm run plugin.link` from the `src`.
84
86
85
-
### <aname='LinkingtoCocoaPodorAndroidArsenalplugins'></a>Linking to CocoaPod or Android Arsenal plugins
87
+
### Linking to CocoaPod or Android Arsenal plugins
86
88
87
89
You will want to create these folders and files in the `src` folder in order to use native APIs:
88
90
@@ -101,6 +103,23 @@ Take a look at these existing plugins for how that can be done very simply:
It's highly recommended to generate typings for the native libraries used in your plugin. By generating typings you'll be able to see what APIs exactly are exposed to Javascript and use them easily in your plugin code
107
+
108
+
#### Generating typings for iOS
109
+
110
+
- Run the command for typings generation as explained in the [documentation](https://docs.nativescript.org/runtimes/ios/how-to/Use-Native-Libraries#troubleshooting)
111
+
- Open `demo/typings/x86_64` and copy the `d.ts` files that you plan to use in your plugin to `src\platforms\ios\typings`
112
+
- Open `src\references.d.ts` and add a reference to each of the files added to `src\platforms\ios\typings`
113
+
114
+
**NOTE**: Swift APIs that are not exported to Objective-C are not supported. This means that you can only call APIs from JavaScript that are visible to the Objective-C runtime. This include all Objective-C APIs and only the subset of all Swift APIs that are exposed to Objective-C. So, to use a Swift API (class/function/method etc.) from NativeScript, first make sure that it can be used from Objective-C code. For more information which Swfit APIs can be exposed to Objective-C, see [here](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithObjective-CAPIs.html#//apple_ref/doc/uid/TP40014216-CH4-ID53).
- Follow the steps in the [README](https://github.com/NativeScript/android-dts-generator/blob/master/README.md)
120
+
- Copy the generated d.ts files in `src\platforms\android\typings`. Feel free to rename the generated files for readablity.
121
+
- Open `src\references.d.ts` and add a reference to each of the files added to `src\platforms\android\typings`
122
+
104
123
### Clean plugin and demo files
105
124
106
125
Sometimes you may need to wipe away the `node_modules` and `demo/platforms` folders to reinstall them fresh.
@@ -115,7 +134,7 @@ Sometimes you may need to ensure plugin files are updated in the demo:
115
134
116
135
* Run `npm run plugin.prepare` will do a fresh build of the plugin then remove itself from the demo and add it back for assurance.
117
136
118
-
### <aname='Unittesting'></a>Unittesting
137
+
### Unittesting
119
138
The plugin seed automatically adds Jasmine-based unittest support to your plugin.
120
139
Open `demo/app/tests/tests.js` and adjust its contents so the tests become meaningful in the context of your plugin and its features.
121
140
@@ -128,7 +147,7 @@ npm run test.ios
128
147
npm run test.android
129
148
```
130
149
131
-
### <aname='PublishtoNPM'></a>Publish to NPM
150
+
### Publish to NPM
132
151
133
152
When you have everything ready to publish:
134
153
@@ -139,13 +158,13 @@ If you just want to create a package, go to `publish` folder and execute `pack.s
139
158
140
159
**NOTE**: To run bash script on Windows you can install [GIT SCM](https://git-for-windows.github.io/) and use Git Bash.
141
160
142
-
### <aname='TravisCI'></a>TravisCI
161
+
### TravisCI
143
162
144
163
The plugin structure comes with a fully functional .travis.yml file that deploys the testing app on Android emulator and iOS simulator and as a subsequent step runs the tests from [UnitTesting section](#Unittesting). All you have to do, after cloning the repo and implementing your plugin and tests, is to sign up at [https://travis-ci.org/](https://travis-ci.org/). Then enable your plugin's repo on "https://travis-ci.org/profile/<your github user\>" and that's it. Next time a PR is opened or change is committed to a branch TravisCI will trigger a build testing the code.
145
164
146
165
To properly show current build status you will have to edit the badge at the start of the README.md file so it matches your repo, user and branch.
147
166
148
-
### <aname='ReferringtnscoremodulesinthePlugin'></a>Referring tns-core-modules in the Plugin
167
+
### Referring tns-core-modules in the Plugin
149
168
We recommend to use full imports of `tns-core-modules` due to [an issue in Angular CLI](https://github.com/angular/angular-cli/issues/5618#issuecomment-306479219). Read more detailed explanation in [this discussion](https://github.com/NativeScript/nativescript-plugin-seed/pull/32#discussion_r131147787).
150
169
151
170
Ultimately after the issue in Angular CLI is fixed this would not be a restriction, but till then the recommended approach is to import from `tns-core-modules` using full path. Here is an example:
@@ -176,3 +195,9 @@ import * as app from 'application';
176
195
````
177
196
import * as app from 'tns-core-modules/application';
178
197
````
198
+
199
+
## Contribute
200
+
We love PRs! Check out the [contributing guidelines](CONTRIBUTING.md). If you want to contribute, but you are not sure where to start - look for issues labeled [`help wanted`](https://github.com/NativeScript/tns-core-modules-widgets/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).
201
+
202
+
## Get Help
203
+
Please, use [github issues](https://github.com/NativeScript/tns-core-modules-widgets/issues) strictly for [reporting bugs](CONTRIBUTING.md#reporting-bugs) or [requesting features](CONTRIBUTING.md#requesting-new-features). For general questions and support, check out the [NativeScript community forum](https://discourse.nativescript.org/) or ask our experts in [NativeScript community Slack channel](http://developer.telerik.com/wp-login.php?action=slack-invitation).
0 commit comments