Skip to content

Commit acd21a7

Browse files
committed
init
1 parent 339e3e8 commit acd21a7

File tree

86 files changed

+1069
-0
lines changed

Some content is hidden

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

86 files changed

+1069
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*.js
2+
*.js.map
3+
*.log
4+
!scripts/*.js
5+
demo/app/*.js
6+
!demo/karma.conf.js
7+
!demo/app/tests/*.js
8+
demo/*.d.ts
9+
demo/lib
10+
demo/platforms
11+
demo/node_modules
12+
node_modules

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
demo/
2+
screenshots/
3+
*.gif
4+
*.png
5+
*.log
6+
*.map
7+
*.ts
8+
!*.d.ts

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
nativescript-https
4+
Copyright (c) 2016, GetHuman
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy of
7+
this software and associated documentation files (the "Software"), to deal in
8+
the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10+
the Software, and to permit persons to whom the Software is furnished to do so,
11+
subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Develop a NativeScript plugin now (w/ TypeScript)
2+
3+
## Getting started
4+
5+
1. `git clone https://github.com/NathanWalker/nativescript-plugin-seed.git myplugin`
6+
2. `npm install -g typescript`
7+
3. `cd myplugin`
8+
4. `npm run postclone`
9+
5. `npm run setup`
10+
6. Get to work.
11+
12+
This seed expands on several things [presented here](http://developer.telerik.com/featured/creating-nativescript-plugins-in-typescript/).
13+
14+
## Usage
15+
16+
The seed is prepared to allow you to test and try out your plugin via the `demo` folder.
17+
Additionally it provides a proper `.gitignore` to keep GitHub tidy as well as `.npmignore` to ensure everyone is happy when you publish your plugin via npm.
18+
19+
### Linking to CocoaPod or Android Arsenal plugins
20+
21+
You will want to create these folders and files in the root:
22+
23+
```
24+
platforms --
25+
ios --
26+
Podfile
27+
android --
28+
include.gradle
29+
```
30+
31+
Doing so will open up those native apis to your plugin :)
32+
33+
Take a look at these existing plugins for how that can be done very simply:
34+
35+
* [nativescript-cardview](https://github.com/bradmartin/nativescript-cardview/tree/master/platforms)
36+
* [nativescript-floatingactionbutton](https://github.com/bradmartin/nativescript-floatingactionbutton/tree/master/platforms)
37+
38+
### Typical development workflow:
39+
40+
1. Make changes to plugin files
41+
2. Make changes in `demo` that would test those changes out
42+
3. `npm run demo.ios` or `npm run demo.android` **(must be run from the root directory)**
43+
44+
Those `demo` tasks are just general helpers. You may want to have more granular control on the device and/or emulator you want to run. For that, you can just run things the manual way:
45+
46+
```
47+
cd demo
48+
49+
// when developing, to ensure the latest code is built into the demo, it's a guarantee to remove the plugin and add it back
50+
tns plugin remove nativescript-https
51+
tns plugin add ..
52+
53+
// manual platform adds
54+
tns platform add ios
55+
// and/or
56+
tns platform add android
57+
```
58+
59+
Then use any of the available options from the `tns` command line:
60+
61+
* [Emulate your project](https://github.com/NativeScript/nativescript-cli#emulate-your-project)
62+
* [Run your project](https://github.com/NativeScript/nativescript-cli#run-your-project)
63+
* [Full list of commands](https://github.com/NativeScript/nativescript-cli#the-commands)
64+
65+
## Unittesting
66+
This plugin automatically adds Jasmine-based unittest support to your plugin.
67+
Open `demo/app/tests/tests.js` and adjust its contents.
68+
69+
You can read more about this topic [here](https://docs.nativescript.org/tooling/testing).
70+
71+
Once you're ready to test your plugin's API execute one of these commands in the plugin root:
72+
73+
```
74+
npm run test.ios
75+
npm run test.android
76+
```
77+
78+
## Publish
79+
80+
When you have everything ready to publish:
81+
82+
* Bump the version number in `package.json`
83+
* `npm run build` - **very important** - ensure the latest is built **before** you publish
84+
* `npm publish`
85+
86+
## Contributing - Want to make the seed better?
87+
88+
Or at least help keep it up to date with NativeScript releases, which would be excellent.
89+
90+
```
91+
npm install -g typescript // if you don't already have it
92+
git clone https://github.com/NathanWalker/nativescript-plugin-seed
93+
cd nativescript-plugin-seed
94+
95+
// Improve!
96+
```
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="__PACKAGE__"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
7+
<supports-screens
8+
android:smallScreens="true"
9+
android:normalScreens="true"
10+
android:largeScreens="true"
11+
android:xlargeScreens="true"/>
12+
13+
<uses-sdk
14+
android:minSdkVersion="17"
15+
android:targetSdkVersion="__APILEVEL__"/>
16+
17+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
18+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
19+
<uses-permission android:name="android.permission.INTERNET"/>
20+
21+
<application
22+
android:name="com.tns.NativeScriptApplication"
23+
android:allowBackup="true"
24+
android:icon="@drawable/icon"
25+
android:label="@string/app_name"
26+
android:theme="@style/AppTheme">
27+
28+
<activity
29+
android:name="com.tns.NativeScriptActivity"
30+
android:label="@string/title_activity_kimera"
31+
android:configChanges="keyboardHidden|orientation|screenSize"
32+
android:theme="@style/LaunchScreenTheme">
33+
34+
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
35+
36+
<intent-filter>
37+
<action android:name="android.intent.action.MAIN" />
38+
<category android:name="android.intent.category.LAUNCHER" />
39+
</intent-filter>
40+
</activity>
41+
<activity android:name="com.tns.ErrorReportActivity"/>
42+
</application>
43+
</manifest>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Add your native dependencies here:
2+
3+
// Uncomment to add recyclerview-v7 dependency
4+
//dependencies {
5+
// compile 'com.android.support:recyclerview-v7:+'
6+
//}
7+
8+
android {
9+
defaultConfig {
10+
generatedDensities = []
11+
applicationId = "org.nativescript.starter"
12+
}
13+
aaptOptions {
14+
additionalParameters "--no-version-vectors"
15+
}
16+
}
3.42 KB
Loading
10.7 KB
Loading
32.4 KB
Loading
1.31 KB
Loading

0 commit comments

Comments
 (0)