Skip to content

Commit 8da6286

Browse files
author
Iva Koevska
committed
Added contribute article, updated draft
1 parent 88a042b commit 8da6286

File tree

2 files changed

+192
-17
lines changed

2 files changed

+192
-17
lines changed

CONTRIBUTING.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Contribute to the Telerik NativeScript Command-Line Interface
2+
===
3+
4+
*Help us improve the Telerik NativeScript CLI*
5+
6+
The Telerik NativeScript CLI lets you create, build, and deploy NativeScript-based projects on iOS and Android devices.
7+
8+
* [Report an Issue](#bug "Learn how to report an issue")
9+
* [Request a Feature](#request "Learn how to submit a feature or improvement request")
10+
* [Contribute to the Code Base](#contribute "Learn how to submit your own improvements to the code")
11+
12+
Report an Issue
13+
===
14+
If you find a bug in the source code or a mistake in the documentation, you can submit an issue to our [GitHub Repository][2].
15+
Before you submit your issue, search the archive to check if a similar issues has been logged or addressed. This will let us focus on fixing issues and adding new features.
16+
If your issue appears to be a bug, and hasn't been reported, open a new issue. To help us investigate your issue and respond in a timely manner, you can provide is with the following details.
17+
18+
* **Overview of the issue:** Provide a short description of the visible symptoms. If applicable, include error messages, screen shots, and stack traces.
19+
* **Motivation for or use case:** Let us know how this particular issue affects your work.
20+
* **Telerik NativeScript version(s):** List the current version and build number of the CLI interface. You can get it by running `tns --version`. Let us know if you have not observed this behavior in earlier versions and if you consider it a regression.
21+
* **System configuration:** Provide us with relevant system configuration information such as operating system, network connection, proxy usage, etc. Let us know if you have been able to reproduce the issue on multiple setups.
22+
* **Steps to reproduce:** If applicable, submit a step-by-step walkthrough of how to reproduce the issue.
23+
* **Related issues:** If you discover a similar issue in our archive, give us a heads up - it might help us identify the culprit.
24+
* **Suggest a fix:** You are welcome to suggest a bug fix or pinpoint the line of code or the commit that you believe has introduced the issue.
25+
26+
[Back to Top][1]
27+
28+
Request a Feature
29+
===
30+
You can request a new feature by submitting an issue with the *enhancement* label to our [GitHub Repository][2].
31+
If you want to implement a new feature yourself, consider submitting it to the [GitHub Repository][2] as a Pull Request.
32+
33+
[Back to Top][1]
34+
35+
Contribute to the Code Base
36+
===
37+
38+
Before you submit a Pull Request, consider the following guidelines.
39+
40+
* Search <a href="https://github.com/Icenium/icenium-cli/pulls">GitHub</a> for an open or closed Pull Request that relates to your submission.
41+
* Make your changes in a new `git` branch. We use the <a href="http://nvie.com/posts/a-successful-git-branching-model/">Gitflow branching model</a> so you will have to branch from our develop branch.
42+
```bash
43+
git checkout -b my-fix-branch develop
44+
```
45+
* Create your patch and include appropriate test cases.
46+
* Commit your changes and create a descriptive commit message (the commit message is used to generate release notes).
47+
```bash
48+
git commit -a
49+
```
50+
* Build your changes locally.
51+
```bash
52+
grunt
53+
```
54+
* Ensure all the tests pass.
55+
```bash
56+
grunt test
57+
```
58+
* Push your branch to GitHub.
59+
```bash
60+
git push origin my-fix-branch
61+
```
62+
* In GitHub, send a Pull Request to icenium-cli:develop.
63+
* If we suggest changes, you can modify your branch, rebase, and force a new push to your GitHub repository to update the Pull Request.
64+
```bash
65+
git rebase develop -i
66+
git push -f
67+
```
68+
69+
That's it! Thank you for your contribution!
70+
71+
When the patch is reviewed and merged, you can safely delete your branch and pull the changes from the main (upstream) repository.
72+
73+
* Delete the remote branch on GitHub.
74+
```bash
75+
git push origin --delete my-fix-branch
76+
```
77+
* Check out the develop branch.
78+
```bash
79+
git checkout develop -f
80+
```
81+
* Delete the local branch.
82+
```bash
83+
git branch -D my-fix-branch
84+
```
85+
* Update your develop branch with the latest upstream version.
86+
```
87+
git pull --ff upstream develop
88+
```
89+
90+
[Back to Top][1]
91+
92+
[1]: #contribute-to-the-telerik-nativescript-command-line-interface
93+
[2]: https://github.com/NativeScript/nativescript-cli

README.md

Lines changed: 99 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Telerik NativeScript Command-Line Interface
22
================
33
[![Build Status](https://travis-ci.org/NativeScript/nativescript-cli.svg?branch=build)][2]
44

5-
*Create, build, and run native apps for iOS and Android using JavaScript*
5+
*Create, build, and run native apps for iOS and Android using JavaScript or TypeScript*
66

77
The Telerik NativeScript CLI lets you create, build, and deploy NativeScript-based projects on iOS and Android devices.
88

@@ -11,7 +11,16 @@ The Telerik NativeScript CLI lets you create, build, and deploy NativeScript-bas
1111
* [System Requirements](#system-requirements "The hardware and software requirements for setting up and working with the Telerik NativeScript CLI")
1212
* [Installation](#installation "How to configure and install the Telerik NativeScript CLI")
1313
* [Quick Start](#quick-start "Get started with the Telerik NativeScript CLI")
14-
* [How to Contribute](#how-to-contribute "")
14+
* [The Commands](#the-commands)
15+
* [Create Project](#create-project)
16+
* [Add Platforms](#add-platforms)
17+
* [Develop Your Project](#develop-your-project)
18+
* [Prepare for Build](#prepare-for-build)
19+
* [Build Your Project](#build-your-project)
20+
* [Deploy Your Project](#deploy-your-project)
21+
* [Emulate Your Project](#emulate-your-project)
22+
* [Known Issues](#troubleshooting)
23+
* [How to Contribute](#how-to-contribute)
1524
* [License](#license)
1625

1726
What is NativeScript
@@ -39,8 +48,8 @@ Supported Platforms
3948

4049
With the Telerik NativeScript CLI, you can target the following mobile platforms.
4150

42-
* Android 4.2 or later
43-
* iOS 7.0 or later
51+
* Android 4.2 or a later stable official release
52+
* iOS 7.0 or later stable official release
4453

4554
[Back to Top][1]
4655

@@ -63,6 +72,19 @@ You can install and run the Telerik NativeScript CLI on Windows or OS X.
6372
* Apache Ant 1.8 or later
6473
* Android SDK 19 or later
6574

75+
If you want to develop for Android, verify that you have added the following paths in the `PATH` system environment variable.
76+
77+
```
78+
Path to the bin directory in the Apache Ant installation folder
79+
Path to tools directory in the Android SDK installation folder
80+
Path to platform-tools directory in the Android SDK installation folder
81+
```
82+
83+
For example:
84+
```
85+
PATH=...;...;C:\tools\apache-ant-1.9.4\bin;%localappdata%\Android\android-sdk\tools;%localappdata%\Android\android-sdk\platform-tools;
86+
```
87+
6688
If you have installed Chocolatey, you can complete these steps to set up JDK, Apache Ant, and Android SDK.
6789

6890
1. Run a Windows command prompt.
@@ -130,6 +152,7 @@ If you want to develop for Android, verify that you have added the following pat
130152
```
131153
Path to the bin subdirectory in the Apache Ant installation directory
132154
Path to the tools subdirectory in the Android SDK installation directory
155+
Path to the platform-tools subdirectory in the Android SDK installation directory
133156
```
134157

135158
For example:
@@ -168,19 +191,19 @@ Quick Start
168191

169192
## The Commands
170193

171-
Run `tns help` to list all available commands. Run or `tns <Command> help` to view more information about a selected command.
194+
Run `tns help` to list all available commands. Run or `tns <Command> --help` to view more information about a selected command.
172195

173196
* `help` lists all available commands.
174197
* `create <App name> [--path <Directory>] [--appid <App ID>] [--copy-from <Directory>]` creates a new project with the specified settings.
175198
* `platform list` lists the current target platforms for your project.
176199
* `platform add <Platform>` adds a new target platform to your project.
177200
* `platform remove <Platform>` removes the selected platform from the target platforms of the project.
178-
* `prepare <Platform>` copies cross-platform and platform-specific content to the subdirectory for the selected target platform.
201+
* `prepare <Platform>` copies cross-platform and selected platform-specific content to the subdirectory for the target platform.
179202
* `build <Platform>` builds the project for the selected target platform.
180203
* `emulate <Platform>` builds the project for the selected target platform and runs it in the native emulator, if configured.
181204
* `deploy <Platform> [--device <Device ID>]` deploys an already built application on connected device.
182205
* `run <Platform>` executes `prepare`, `build`, and `deploy`.
183-
* `list-devices` lists connected devices.
206+
* `list-devices` lists connected devices, including any running Android Virtual Devices.
184207
* `feature-usage-tracking` configures anonymous feature usage tracking.
185208

186209
[Back to Top][1]
@@ -227,11 +250,16 @@ MyApp/
227250
`-- .tnsproject
228251
```
229252

253+
* The `app` directory is the development space for your application. You should modify all common and platform-specific code within this directory. When you run `prepare <Platform>`, the Telerik NativeScript CLI copies relevant content to the platform-specific folders for each target platform.
254+
* The `hooks` directory is an empty directory. In a future release of the Telerik NativeScript CLI, in `hooks`, you will be able to store scripts that are automatically executed before and after a specified command.
255+
* The `platforms` directory is created empty. When you add a target platform to your project, the Telerik NativeScript CLI creates a new subdirectory with the platform name. The subdirectory contains the ready-to-build resources of your app. When you run `prepare <Platform>`, the Telerik NativeScript CLI copies relevant content from the `app` directory to the platform-specific subdirectory for each target platform.<br/>In the `platforms` directory, you can safely modify configuration files such as `AndroidManifest.xml` and `Info.plist`.
256+
* The `tns_modules` is an empty directory. In a future release of the Telerik NativeScript CLI, in `tns_modules`, you will be able to add custom Telerik NativeScript modules to extend the functionality of the basic framework.
257+
230258
[Back to Top][1]
231259

232260
## Add Platforms
233261

234-
After you have created your project, you can start adding target platforms to it. To be able to build your project into an application package for a selected target platform, you need to add the platform to your project. Currently, you can target Android and iOS with your NativeScript projects.
262+
After you have created your project, you can start adding target platforms to it. To be able to build your project into an application package for a selected target platform, you need to add the platform to your project first. Currently, you can target Android and iOS with your NativeScript projects.
235263

236264
Navigate to the directory that contains your newly created project and run the following commands.
237265

@@ -240,7 +268,7 @@ tns platform add android
240268
tns platform add ios
241269
```
242270

243-
`platform add` creates the `android` and the `ios` subdirectories in the `platforms` directory. These subdirectories have the platform-specific project structure required for native development with the platform.
271+
`platform add` creates the `android` and the `ios` subdirectories in the `platforms` directory. These subdirectories have the platform-specific project structure required for native development with the native SDKs for the platform.
244272

245273
```
246274
...
@@ -266,13 +294,47 @@ platforms/
266294
...
267295
```
268296

297+
For more information about the structure of Android native projects, see [Android Projects](http://developer.android.com/tools/projects/index.html#ApplicationProjects).
298+
For more information about the structure iOS native projects, see [Code Organization in Xcode Projects](http://akosma.com/2009/07/28/code-organization-in-xcode-projects/).
299+
269300
[Back to Top][1]
270301

271302
## Develop Your Project
272303

273-
Develop your project in the `app` directory in the root of the project. Avoid making changes to the platform-specific subdirectories in `platforms`. The Telerik NativeScript CLI overrides such changes during the `prepare` operation.
304+
* [Development with NativeScript](#development-with-nativescript)
305+
* [Development in app](#development-in-app)
306+
* [Development in platforms](#development-in-platforms)
307+
* [Development in hooks](#development-in-hooks)
308+
* [Development in tns_modules](#development-in-tns-modules)
309+
310+
### Development with NativeScript
311+
312+
For more information about working with Telerik NativeScript, see the following resources.
313+
314+
* [The Telerik NativeScript Documentation Wiki][6]
315+
* [The Telerik NativeScript API Reference][7]
316+
317+
### Development in `app`
274318

275-
You can use platform-specific files to provide customized functionality and design for each target platform. To indicate that a file is platform-specific, make sure that the file name is in the following format: `name.ios.extension` or `name.android.extension`. For example: `main.ios.js` or `main.android.js`. You can develop shared functionality or design in common files. To indicate that a file is common, make sure that the file name does not contain a `.android.` or `.ios.` string.
319+
The `app` directory in the root of the project is the development space for your project. Place all your common and platform-specific code in this directory. When you run `prepare <Platform>`, the Telerik NativeScript CLI copies relevant content to the platform-specific folders for each target platform.
320+
321+
In the `app` directory, you can use **platform-specific files** to provide customized functionality and design for each target platform. To indicate that a file is platform-specific, make sure that the file name is in the following format: `name.ios.extension` or `name.android.extension`. For example: `main.ios.js` or `main.android.js`.
322+
323+
You can develop shared functionality or design in common files. To indicate that a file is common, make sure that the file name does not contain a `.android.` or `.ios.` string.
324+
325+
### Development in `platforms`
326+
327+
In `platforms`, you can safely modify files which are part of the native project structure and do not have a corresponding source located in the `app` directory in the root. For example, `AndroidManifest.xml` and `Info.plist`.
328+
329+
Do not modify files and resources that have a corresponding file in the `app` directory in the root, such as application scripts, icons, and splash screens. The Telerik NativeScript CLI overrides such files during the `prepare <Platform>` operation with the content from `app`.
330+
331+
### Development in `hooks`
332+
333+
In this version of the Telerik NativeScript CLI, you cannot create and use hooks.
334+
335+
### Development in `tns_modules`
336+
337+
In this version of the Telerik NativeScript CLI, you cannot create and use custom Telerik NativeScript modules to extend the functionality of the framework.
276338

277339
[Back to Top][1]
278340

@@ -285,11 +347,11 @@ tns prepare android
285347
tns prepare ios
286348
```
287349

288-
`prepare <Platform>` takes content from `app`, analyzes it and copies it to the platform-specific subdirectory in `platforms`. This operation copies common content and platform-specific content that applies only to the selected platform. This ensures that your Android or iOS application will contain the correct assets.
350+
`prepare <Platform>` takes content from `app`, analyzes it and copies it to the platform-specific subdirectory in `platforms`. This operation copies common and relevant platform-specific content that applies to the selected platform. This ensures that your Android or iOS application contain only the correct assets.
289351

290-
Keep in mind that `prepare` overrides any changes made to the platform-specific subdirectory in `platforms`. To develop platform-specific functionality and design for your native apps, use platform-specific files in the `app` directory.
352+
Keep in mind that `prepare` overrides changes made to the platform-specific subdirectory in `platforms`. For more information, see [Development in platforms](#development-in-platforms).
291353

292-
> **IMPORTANT:** Always run `prepare <Platform>` before running `build <Platform>` or `deploy <Platform>`. This ensures that the Telerik NativeScript CLI will build an application package that contains your latest code and resources.
354+
> **IMPORTANT:** Always run `prepare <Platform>` before running `build <Platform>` or `deploy <Platform>`. This ensures that the Telerik NativeScript CLI will build an application package with your latest code and resources.
293355
294356
[Back to Top][1]
295357

@@ -322,7 +384,7 @@ To verify that the Telerik NativeScript CLI recognizes your connected devices, r
322384
tns list-devices
323385
```
324386

325-
The Telerik NativeScript CLI lists all connected physical devices and running virtual Android devices managed by the Android Virtual Device manager.
387+
The Telerik NativeScript CLI lists all connected physical devices and running Android Virtual Devices.
326388

327389
After you have listed the available devices, you can deploy your app on all devices from the selected target platform.
328390

@@ -332,7 +394,7 @@ tns deploy android
332394
tns deploy ios
333395
```
334396

335-
The Telerik NativeScript CLI calls the SDK for the selected target platform and uses it to build your app locally. After the build is complete, the Telerik NativeScript CLI downloads and installs the application package on your connected devices. The app does not run automatically on the device.
397+
The Telerik NativeScript CLI calls the SDK for the selected target platform and uses it to build your app locally. After the build is complete, the Telerik NativeScript CLI downloads and installs the application package on your connected devices. The app does not run automatically on the device. To run the app, tap the app icon.
336398

337399
> **IMPORTANT:** To deploy your app on iOS devices, you need to configure a valid pair of certificate and provisioning profile for code signing your application package. For more information, see [iOS Code Signing - A Complete Walkthrough](http://seventhsoulmountain.blogspot.com/2013/09/ios-code-sign-in-complete-walkthrough.html).
338400
@@ -349,12 +411,32 @@ tns emulate ios
349411

350412
This operation launches the native device emulator for the selected target platform and runs your project in the virtual device.
351413

352-
For Android, the Telerik NativeScript CLI runs your app in the earliest created virtual device. Before running your app in the Android native emulator, make sure that you have configured at least one virtual device in the Android Virtual Device manager.
414+
For Android, the Telerik NativeScript CLI runs your app in the earliest created virtual device or the currently running Android Virtual Device. Before running your app in the Android native emulator, make sure that you have configured at least one virtual device in the Android Virtual Device manager.
353415

354416
For iOS, the Telerik NativeScript CLI runs your app in the iOS Simulator.
355417

356418
[Back to Top][1]
357419

420+
Known Issues
421+
===
422+
423+
* On OS X systems with Xcode 6, you cannot run your app in the native iOS emulator.
424+
* You can run your app only in the earliest created Android Virtual Device or the currently running Android Virtual Device.<br/>**Workaround:** Run your app on a selected virtual device from the `deploy` command.
425+
1. Run the following command, to start the Android Virtual Device manager.
426+
427+
```Shell
428+
android avd
429+
```
430+
1. Select the virtual device on which you want to run your app and click **Start**.
431+
1. Click **Launch** and wait for the device to load.
432+
1. In a new command prompt, run the following command.
433+
434+
```Shell
435+
tns run android --device <Device ID>
436+
```
437+
438+
Where `<Device ID>` is the index or name of the device as listed by `tns list-devices`.
439+
358440
How to Contribute
359441
===
360442

0 commit comments

Comments
 (0)