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
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 <ahref="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 <ahref="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.
* 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
+
230
258
[Back to Top][1]
231
259
232
260
## Add Platforms
233
261
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.
235
263
236
264
Navigate to the directory that contains your newly created project and run the following commands.
237
265
@@ -240,7 +268,7 @@ tns platform add android
240
268
tns platform add ios
241
269
```
242
270
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.
244
272
245
273
```
246
274
...
@@ -266,13 +294,47 @@ platforms/
266
294
...
267
295
```
268
296
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
+
269
300
[Back to Top][1]
270
301
271
302
## Develop Your Project
272
303
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`
274
318
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.
276
338
277
339
[Back to Top][1]
278
340
@@ -285,11 +347,11 @@ tns prepare android
285
347
tns prepare ios
286
348
```
287
349
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.
289
351
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).
291
353
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.
293
355
294
356
[Back to Top][1]
295
357
@@ -322,7 +384,7 @@ To verify that the Telerik NativeScript CLI recognizes your connected devices, r
322
384
tns list-devices
323
385
```
324
386
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.
326
388
327
389
After you have listed the available devices, you can deploy your app on all devices from the selected target platform.
328
390
@@ -332,7 +394,7 @@ tns deploy android
332
394
tns deploy ios
333
395
```
334
396
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.
336
398
337
399
> **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).
338
400
@@ -349,12 +411,32 @@ tns emulate ios
349
411
350
412
This operation launches the native device emulator for the selected target platform and runs your project in the virtual device.
351
413
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.
353
415
354
416
For iOS, the Telerik NativeScript CLI runs your app in the iOS Simulator.
355
417
356
418
[Back to Top][1]
357
419
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`.
0 commit comments