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
feat: make it possible for the user to choose what kind of demos (by framework) to be included and create them from online templates #128 (#129)
* feat: use online templates to create demo applications
feat: make it possible for the user to choose what kind of demos (by framework) to be included #128
* chore
* chore: add unit tests for the new postclone prompts
chore: remove some unit tests as they are not needed
* chore
* chore: update readme with latest script changes
* chore: update travis with latest changes to postclone
* chore: remove scripts that are no longer static
* chore: Refactor success message to use variables
* chore: remove redundant npm install calls
* chore: remove left over command symbols
* chore: fix issues when running on cmd on Windows OS
* chore: fix issues with running postclone on Windows OS
Copy file name to clipboardExpand all lines: .travis.yml
+3-3
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ matrix:
7
7
language: node_js
8
8
os: linux
9
9
node_js: "8"
10
-
script: cd src && npm run ci.tslint && cd ../demo && npm run ci.tslint
10
+
script: cd src && npm run ci.tslint
11
11
- stage: "Build and Test"
12
12
env:
13
13
- BuildAndroid="28"
@@ -16,7 +16,7 @@ matrix:
16
16
jdk: oraclejdk8
17
17
before_install: nvm install 8
18
18
script:
19
-
- cd src && npm i && npm run tsc && cd ../demo
19
+
- cd src && npm run postclone gitHubUsername=TheGitHubUser pluginName=ThePlugin initGit=y includeTypescriptDemo=y includeAngularDemo=n && npm run tsc && cd ../demo
20
20
- travis_wait travis_retry tns build android
21
21
- os: osx
22
22
env:
@@ -27,7 +27,7 @@ matrix:
27
27
node_js: "8"
28
28
jdk: oraclejdk8
29
29
script:
30
-
- cd src && npm i && npm run tsc && cd ../demo
30
+
- cd src && npm run postclone gitHubUsername=TheGitHubUser pluginName=ThePlugin initGit=y includeTypescriptDemo=y includeAngularDemo=n && npm run tsc && cd ../demo
Copy file name to clipboardExpand all lines: README.md
+10-52
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,6 @@ What does the seed give you out of the box?
40
40
* the plugin structure with option for easy development and debugging (see [Development setup section](#Developmentsetup) below)
41
41
* a simple working plugin
42
42
* a demo project working with the plugin. It is useful during development and for running tests via Travis CI
43
-
* plugin tests
44
43
* a guideline how to structure your plugin README file that will be published to NPM
45
44
* a shell script to create your plugin package
46
45
* a proper `.gitignore` to keep GitHub tidy
@@ -52,8 +51,8 @@ What does the seed give you out of the box?
52
51
53
52
|Folder/File name| Description
54
53
|---|---|
55
-
|demo| The plugin demo source code|
56
-
|demo/tests| The tests for your plugin|
54
+
|demo| The plugin demo source code (optional during __postclone__ setup)|
55
+
|demo-angular| The plugin demo source code (optional during __postclone__ setup)|
57
56
|src| The plugin source code|
58
57
|src/platform/android| Plugin Android specific configuration|
59
58
|src/platform/ios|Plugin ios specific configuration|
@@ -69,8 +68,9 @@ What does the seed give you out of the box?
69
68
* configure your github username - it will be changed in the package.json for you
70
69
* configure your plugin name - all files and classes in the seed will be renamed for you
71
70
* stub your plugin README.md file
71
+
* add TypeScript NativeScript application which is setup to use your plugin from its local `src` folder
72
+
* add Angular NativeScript application which is setup to use your plugin from its local `src` folder
72
73
* create a new repository for your plugin
73
-
* npm link your plugin the demo app - this will install the plugin dependencies and will add a symbolic link to the plugin code in the demo project allowing you to do changes and review them in the demo without adding/removing the plugin every time you make a change. [Read more about npm link](https://docs.npmjs.com/cli/link). If you encounter an "EACCES" permission denied error, please fix you global npm permissions, which is perfectly explained [here](https://docs.npmjs.com/getting-started/fixing-npm-permissions).
74
74
75
75
Now you can continue with the development of your plugin by using the [Development setup](#Developmentsetup) described below.
76
76
@@ -79,12 +79,12 @@ Now you can continue with the development of your plugin by using the [Developme
79
79
#### Development setup
80
80
For easier development and debugging purposes continue with the following steps:
81
81
82
-
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
+
1. Open a command prompt/terminal, navigate to `src` folder and run `npm run demo.ios`, `npm run demo.android`, `npm run demo-angular.ios`, `npm run demo-angular.android` to run the demo applications created during `postclone`.
83
83
2. Open another command prompt/terminal, navigate to `src` folder and run `npm run plugin.tscwatch` to watch for file changes in your plugin.
84
84
85
85
Now go and make a change to your plugin. It will be automatically applied to the demo project.
86
86
87
-
**NOTE**: Any changes that you need to make in a native library used in your plugin or in any other files inside `src/platforms` directory such as Info.plist or AndroidManifest.xml can't be directly reflected in the demo app. You need to use `npm run demo.reset` and run the application again.
87
+
**NOTE**: Any changes that you need to make in a native library used in your plugin or in any other files inside `src/platforms` directory such as Info.plist or AndroidManifest.xml can't be directly reflected in the demo applications. You need to use `npm run demo.reset` or `npm run demo-angular.ios` and run the application again.
88
88
89
89
### Linking to CocoaPod or Android Arsenal plugins
90
90
@@ -130,24 +130,14 @@ Sometimes you may need to wipe away the `src/node_modules`, `demo/node_modules`
130
130
131
131
Sometimes you just need to wipe out the demo's `platforms` directory only:
132
132
133
-
* Run `npm run demo.reset` to delete the demo's `platforms` directory only.
133
+
* Run `npm run demo.reset`or `npm run demo-angular.ios`to delete the application's `platforms` directory only.
134
134
135
135
Sometimes you may need to ensure plugin files are updated in the demo:
136
136
137
137
* 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.
138
138
139
-
### Unittesting
140
-
The plugin seed automatically adds Jasmine-based unittest support to your plugin.
141
-
Open `demo/app/tests/tests.js` and adjust its contents so the tests become meaningful in the context of your plugin and its features.
142
-
143
-
You can read more about this topic [here](https://docs.nativescript.org/tooling/testing).
144
-
145
-
Once you're ready to test your plugin's API go to `src` folder and execute one of these commands:
146
-
147
-
```
148
-
npm run test.ios
149
-
npm run test.android
150
-
```
139
+
### Unit testing
140
+
In order to add unit testing to the demo applications and in relation to test your plugin inside of them you should follow our latest guide [here](https://docs.nativescript.org/tooling/testing/testing).
151
141
152
142
### Publish to NPM
153
143
@@ -162,42 +152,10 @@ If you just want to create a package, go to `publish` folder and execute `pack.s
162
152
163
153
### TravisCI
164
154
165
-
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.
155
+
The plugin structure comes with a fully functional .travis.yml file that deploys the testing app on Android emulator and iOS simulator to make sure that those apps start correctly while your plugin is linked to them. 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.
166
156
167
157
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.
168
158
169
-
### Referring tns-core-modules in the Plugin
170
-
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).
171
-
172
-
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:
173
-
174
-
**WRONG**
175
-
176
-
*tsconfig.json*
177
-
````
178
-
...
179
-
180
-
"paths": {
181
-
"*": [
182
-
"./node_modules/*",
183
-
"./node_modules/tns-core-modules/*"
184
-
]
185
-
}
186
-
...
187
-
````
188
-
189
-
*yourplugin.common.ts*
190
-
````
191
-
import * as app from 'application';
192
-
````
193
-
194
-
**RIGHT**
195
-
196
-
*yourplugin.common.ts*
197
-
````
198
-
import * as app from 'tns-core-modules/application';
199
-
````
200
-
201
159
## Contribute
202
160
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).
0 commit comments