Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
NativeScript CLI Changelog
================

1.1.0 (2015, June 10)
==

### Breaking

* Replaced `.tnsproject` with `package.json` to let you use npm and work with custom plugins in your project.<br/>The first time you run any NativeScript command on an existing project, your `.tnsproject` file will be automatically transformed into a `package.json` file describing your project configuration and data. After this, make sure to commit and push your changes if you are using version control.<br/>After the transformation is complete, you can install and use custom NativeScript plugins inside your project.

### New

* [Implemented #510](https://github.com/NativeScript/nativescript-cli/issues/510): You can work with custom NativeScript plugins in your project. You can add a plugin from an npm package, a local folder, a URL or a `.tar.gz` file. For more information, run `$ tns help plugin`
* [Implemented #362](https://github.com/NativeScript/nativescript-cli/issues/362): You can use npm as package manager for your NativeScript projects.

### Updated

* [Updated #358](https://github.com/NativeScript/nativescript-cli/issues/358): Multiple improvements and bug fixes for iOS debugging.

### Fixed

* [Fixed #446](https://github.com/NativeScript/nativescript-cli/issues/446): Autocompletion might continue to work after disabling because `tns autocomplete disable` does not update `.profile` files.
* [Fixed #391](https://github.com/NativeScript/nativescript-cli/issues/391): The default 9-patch image for Android projects is malformed and causes error messages in the build log.
* [Fixed #324](https://github.com/NativeScript/nativescript-cli/issues/324): When you run commands for the `ios` platform, the NativeScript CLI might show the following unrelated adb warning: `Unable to find adb in PATH. Default one from %s resources will be used.`
* [Fixed #309](https://github.com/NativeScript/nativescript-cli/issues/309): You cannot open the device log for streaming with the `tns device log` command.

1.0.2 (2015, May 27)
==

Expand Down
159 changes: 159 additions & 0 deletions PLUGINS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
PLUGINS
=========

NativeScript plugin is a npm package that consist of the following:

* Metadata about the package itself: name, version, supported runtime versions, etc.
* CommonJS module(one or many) that expose the native API via a single JavaScript API.
* Native libraries and resources.

A package json file has the following structure:
```
{
"name": "myplugin",
"version": "0.0.1",
"nativescript": {
"platforms": {
"ios": "1.0.0",
"android": "1.1.0"
}
}
}
```
`nativescript` key is a mandatory section for a NativeScript plugin. `platforms` section describes the supported runtime versions for each platform.

A plugin directory has the following structure:
```
myPlugin/
-- index.js
-- package.json
-- platforms
-- Android
-- myjar.jar
-- Android.manifest
-- iOS
-- myFramework.framework
-- Info.plist
```

You can use `platforms` folder and place platform specific files in each platform directory.

Here is an example.

Let you say that you have the following `Android.manifest` file in `platforms\android\` folder in your plugin:
```
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.basiccontactables"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.example.towntour.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
```

and the default `Android.manifest` file in your app in `platforms\android\` folder.
```
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.nativescript.test"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
```

The produced result xml will be:
```
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android" package="org.nativescript.test" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="21"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.example.towntour.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<!--
Some comment here
-->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<application android:name="com.tns.NativeScriptApplication" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppTheme">
<activity android:name="com.tns.NativeScriptActivity" android:label="@string/title_activity_kimera" android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.EDIT"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
```


1 change: 1 addition & 0 deletions docs/man_pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Command | Description
[emulate `<Platform>`](project/testing/emulate.html) | Deploys the project in the native emulator for the selected target platform.
[run `<Platform>`](project/testing/run.html) | Runs your project on a connected device or in the native emulator, if configured.
[debug `<Platform>`](project/testing/debug.html) | Debugs your project on a connected device.
[plugin](plugin.html) | Lists all installed plugins for your project or lets you manage the plugins for your project.

## Device Commands
Command | Description
Expand Down
33 changes: 33 additions & 0 deletions docs/man_pages/lib-management/plugin-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugin add
==========

Usage | Synopsis
------|-------
General | `$ tns plugin add <Plugin>`

<% if(isConsole) { %>Installs the specified plugin and any packages that it depends on.<% } %>
<% if(isHtml) { %>Installs the specified plugin and its dependencies in the local `node_modules` folder, adds it to the `dependencies` section in `package.json`, and prepares the plugin for all installed platforms. If you have not configured any platforms for the project, the NativeScript CLI will prepare the plugin when you add a platform. For more information about working with plugins, see [NativeScript Plugins](https://github.com/NativeScript/nativescript-cli/PLUGINS.md).<% } %>

### Attributes

* `<Plugin>` is a valid NativeScript plugin, specified by any of the following.
* A `<Name>` or `<Name>@<Version>` where `<Name>` is the name of a plugin that is published in the npm registry and `<Version>` is a valid version of this plugin.
* A `<Local Path>` to the directory which contains the plugin, including its `package.json` file.
* A `<Local Path>` to a `.tar.gz` archive containing a directory with the plugin and its `package.json` file.
* A `<URL>` which resolves to a `.tar.gz` archive containing a directory with the plugin and its `package.json` file.
* A `<git Remote URL>` which resolves to a `.tar.gz` archive containing a directory with the plugin and its `package.json` file.

<% if(isHtml) { %>
### Prerequisites

* Verify that the plugin that you want to add contains a valid `package.json` file. Valid `package.json` files contain a `nativescript` section.

### Related Commands

Command | Description
----------|----------
[library](library.html) | You must run the library command with a related command.
[library add](library-add.html) | Adds a native library to the current project.
[plugin](plugin.html) | Lets you manage the plugins for your project.
[plugin remove](plugin-remove.html) | Uninstalls the specified plugin and its dependencies.
<% } %>
24 changes: 24 additions & 0 deletions docs/man_pages/lib-management/plugin-remove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugin remove
==========

Usage | Synopsis
------|-------
General | `$ tns plugin remove <Plugin>`

<% if(isConsole) { %>Uninstalls a plugin by its name.<% } %>
<% if(isHtml) { %>Removes the specified plugin and its dependencies from the local `node_modules` folder and the `dependencies` section in `package.json`. This operation does not remove the plugin from the installed platforms and you need to run `$ tns prepare` to finish uninstalling the plugin. For more information about working with plugins, see [NativeScript Plugins](https://github.com/NativeScript/nativescript-cli/PLUGINS.md).<% } %>

### Attributes

* `<Plugin>` is the name of the plugin as listed in its `package.json` file.

<% if(isHtml) { %>
### Related Commands

Command | Description
----------|----------
[library](library.html) | You must run the library command with a related command.
[library add](library-add.html) | Adds a native library to the current project.
[plugin](plugin.html) | Lets you manage the plugins for your project.
[plugin add](plugin-add.html) | Installs the specified plugin and its dependencies.
<% } %>
25 changes: 25 additions & 0 deletions docs/man_pages/lib-management/plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plugin
==========

Usage | Synopsis
---|---
List plugins | `$ tns plugin`
Manage plugins | `$ tns plugin <Command>`

Lets you manage the plugins for your project.

### Attributes
`<Command>` extends the `plugin` command. You can set the following values for this attribute.
* `add` - Installs the specified plugin and its dependencies.
* `remove` - Uninstalls the specified plugin and its dependencies.

<% if(isHtml) { %>
### Related Commands

Command | Description
----------|----------
[library](library.html) | You must run the library command with a related command.
[library add](library-add.html) | Adds a native library to the current project.
[plugin add](plugin-add.html) | Installs the specified plugin and its dependencies.
[plugin remove](plugin-remove.html) | Uninstalls the specified plugin and its dependencies.
<% } %>
2 changes: 1 addition & 1 deletion lib/common
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nativescript",
"preferGlobal": true,
"version": "1.0.2",
"version": "1.1.0",
"author": "Telerik <support@telerik.com>",
"description": "Command-line interface for building NativeScript projects",
"bin": {
Expand Down