Skip to content

Commit 860d8ac

Browse files
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
1 parent be7ca2e commit 860d8ac

File tree

84 files changed

+537
-1011
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+537
-1011
lines changed

Diff for: .travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ matrix:
77
language: node_js
88
os: linux
99
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
1111
- stage: "Build and Test"
1212
env:
1313
- BuildAndroid="28"
@@ -16,7 +16,7 @@ matrix:
1616
jdk: oraclejdk8
1717
before_install: nvm install 8
1818
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
2020
- travis_wait travis_retry tns build android
2121
- os: osx
2222
env:
@@ -27,7 +27,7 @@ matrix:
2727
node_js: "8"
2828
jdk: oraclejdk8
2929
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
3131
- travis_wait travis_retry tns build ios
3232
- os: linux
3333
language: android

Diff for: README.md

+10-52
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ What does the seed give you out of the box?
4040
* the plugin structure with option for easy development and debugging (see [Development setup section](#Developmentsetup) below)
4141
* a simple working plugin
4242
* a demo project working with the plugin. It is useful during development and for running tests via Travis CI
43-
* plugin tests
4443
* a guideline how to structure your plugin README file that will be published to NPM
4544
* a shell script to create your plugin package
4645
* a proper `.gitignore` to keep GitHub tidy
@@ -52,8 +51,8 @@ What does the seed give you out of the box?
5251

5352
|Folder/File name| Description
5453
|---|---|
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)|
5756
|src| The plugin source code|
5857
|src/platform/android| Plugin Android specific configuration|
5958
|src/platform/ios|Plugin ios specific configuration|
@@ -69,8 +68,9 @@ What does the seed give you out of the box?
6968
* configure your github username - it will be changed in the package.json for you
7069
* configure your plugin name - all files and classes in the seed will be renamed for you
7170
* 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
7273
* 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).
7474

7575
Now you can continue with the development of your plugin by using the [Development setup](#Developmentsetup) described below.
7676

@@ -79,12 +79,12 @@ Now you can continue with the development of your plugin by using the [Developme
7979
#### Development setup
8080
For easier development and debugging purposes continue with the following steps:
8181

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`.
8383
2. Open another command prompt/terminal, navigate to `src` folder and run `npm run plugin.tscwatch` to watch for file changes in your plugin.
8484

8585
Now go and make a change to your plugin. It will be automatically applied to the demo project.
8686

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.
8888

8989
### Linking to CocoaPod or Android Arsenal plugins
9090

@@ -130,24 +130,14 @@ Sometimes you may need to wipe away the `src/node_modules`, `demo/node_modules`
130130

131131
Sometimes you just need to wipe out the demo's `platforms` directory only:
132132

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.
134134

135135
Sometimes you may need to ensure plugin files are updated in the demo:
136136

137137
* 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.
138138

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).
151141

152142
### Publish to NPM
153143

@@ -162,42 +152,10 @@ If you just want to create a package, go to `publish` folder and execute `pack.s
162152

163153
### TravisCI
164154

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.
166156

167157
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.
168158

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-
201159
## Contribute
202160
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).
203161

Diff for: demo/.npmrc

-1
This file was deleted.

Diff for: demo/app/App_Resources/Android/app.gradle

-15
This file was deleted.

Diff for: demo/app/App_Resources/Android/src/main/AndroidManifest.xml

-43
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Diff for: demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml

-8
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Diff for: demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml

-4
This file was deleted.

Diff for: demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml

-23
This file was deleted.

Diff for: demo/app/App_Resources/Android/src/main/res/values/colors.xml

-7
This file was deleted.

Diff for: demo/app/App_Resources/Android/src/main/res/values/styles.xml

-45
This file was deleted.

0 commit comments

Comments
 (0)