|
2 | 2 | title: tns create
|
3 | 3 | position: 1
|
4 | 4 | ---<% } %>
|
| 5 | + |
5 | 6 | # tns create
|
6 | 7 |
|
| 8 | +### Description |
| 9 | + |
| 10 | +Interactively creates a new NativeScript app based on a predefined template. |
7 | 11 |
|
8 |
| -Usage | Synopsis |
9 |
| ----|--- |
10 |
| -Create from default JavaScript template | `$ tns create [<App Name>] [--js] [--path <Directory>] [--appid <App ID>]` |
11 |
| -Create from default TypeScript template | `$ tns create [<App Name>] --ts [--path <Directory>] [--appid <App ID>]` |
12 |
| -Create from default Angular template | `$ tns create [<App Name>] --ng [--path <Directory>] [--appid <App ID>]` |
13 |
| -Create from default Vue.js template | `$ tns create [<App Name>] --vue [--path <Directory>] [--appid <App ID>]` |
14 |
| -Create from custom template | `$ tns create [<App Name>] [--path <Directory>] [--appid <App ID>] --template <Template>` |
| 12 | +### Commands |
15 | 13 |
|
16 |
| -Interactively creates a new NativeScript app. |
| 14 | +Template | Synopsis |
| 15 | +---------|--------- |
| 16 | +JavaScript based | `$ tns create [<App Name>] [--js] [--path <Directory>] [--appid <App ID>]` |
| 17 | +TypeScript based | `$ tns create [<App Name>] --ts [--path <Directory>] [--appid <App ID>]` |
| 18 | +Angular based | `$ tns create [<App Name>] --ng [--path <Directory>] [--appid <App ID>]` |
| 19 | +Vue.js based | `$ tns create [<App Name>] --vue [--path <Directory>] [--appid <App ID>]` |
| 20 | +Custom template | `$ tns create [<App Name>] [--path <Directory>] [--appid <App ID>] --template <Template>` |
17 | 21 |
|
18 | 22 | ### Options
|
19 |
| -* `--path` - Specifies the directory where you want to create the project, if different from the current directory. The directory must be empty. |
20 |
| -* `--appid` - Sets the application identifier for your project. |
21 |
| -* `--template` - Specifies a valid npm package which you want to use to create your project. If `--template` is not set, the NativeScript CLI will ask you to pick one from a predefined list afterwards.<% if(isHtml) { %> If one or more application assets are missing from the `App_Resources` directory in the package, the CLI adds them using the assets available in the default hello-world template.<% } %> |
| 23 | + |
| 24 | +* `--path` - Specifies the directory where you want to create the project, if different from the current directory. `<Directory>` is the absolute path to an empty directory in which you want to create the project. |
| 25 | +* `--appid` - Sets the application identifier of your project. `<App ID>` is the value of the application identifier and it must meet the specific requirements of each platform that you want to target. If not specified, the application identifier is set to `org.nativescript.<App name>`.<% if(isConsole) { %> For more information about the `<App ID>` requirements, run `$ tns help create`.<% } %><% if(isHtml) { %> The application identifier must be a domain name in reverse. For projects that target Android, you can use uppercase or lowercase letters, numbers, and underscores in the strings of the reversed domain name, separated by a dot. Strings must be separated by a dot and must start with a letter. For example: `com.nativescript.My_Andro1d_App`. For projects that target iOS, you can use uppercase or lowercase letters, numbers, and hyphens in the strings of the reversed domain name. Strings must be separated by a dot. For example: `com.nativescript.My-i0s-App`. |
| 26 | +* `--template` - Specifies a valid npm package which you want to use as a base to create your project. If `--template` is not set, the NativeScript CLI will ask you to pick one from a predefined list afterwards.<% if(isHtml) { %> If one or more application assets are missing from the `App_Resources` directory in the package, the CLI adds them using the assets available in the default hello-world template.<% } %> `<Template>` can be the name of a package in the npm registry, a local path or a GitHub URL to a directory, or a `.tar.gz` archive containing a `package.json` file. The contents of the package will be copied to the `app` directory of your project.<% } %> |
22 | 27 | * `--js`, `--javascript` - Sets the template for your project to the JavaScript template.
|
23 | 28 | * `--ts`, `--tsc`, `--typescript` - Sets the template for your project to the TypeScript template.
|
24 | 29 | * `--ng`, `--angular` - Sets the template for your project to the Angular template.
|
25 | 30 | * `--vue`, `--vuejs` - Sets the template for your project to the Vue.js template.
|
26 | 31 |
|
27 |
| -### Attributes |
28 |
| -* `<App Name>` is the name of project. The specified name must meet the requirements of all platforms that you want to target. If not specified, the NativeScript CLI will ask you for it afterwards. <% if(isConsole) { %>For more information about the `<App Name>` requirements, run `$ tns help create`<% } %><% if(isHtml) { %>For projects that target Android, you can use uppercase or lowercase letters, numbers, and underscores. The name must start with a letter. |
29 |
| -For projects that target iOS, you can use uppercase or lowercase letters, numbers, and hyphens.<% } %> |
30 |
| -* `<App ID>` is the application identifier for your project. It must be a domain name in reverse and must meet the requirements of all platforms that you want to target. If not specified, the application identifier is set to `org.nativescript.<App name>` <% if(isConsole) { %>For more information about the `<App ID>` requirements, run `$ tns help create`<% } %><% if(isHtml) { %>For projects that target Android, you can use uppercase or lowercase letters, numbers, and underscores in the strings of the reversed domain name, separated by a dot. Strings must be separated by a dot and must start with a letter. For example: `com.nativescript.My_Andro1d_App` |
31 |
| -For projects that target iOS, you can use uppercase or lowercase letters, numbers, and hyphens in the strings of the reversed domain name. Strings must be separated by a dot. For example: `com.nativescript.My-i0s-App`. |
32 |
| -* `<Template>` is a valid npm package which you want to use as template for your app. You can specify the package by name in the npm registry or by local path or GitHub URL to a directory or .tar.gz containing a package.json file. The contents of the package will be copied to the `app` directory of your project.<% } %> |
33 |
| - |
34 |
| -<% if(isHtml) { %> |
| 32 | +### Arguments |
35 | 33 |
|
36 |
| -### Templates Usage |
| 34 | +`<App Name>` is the name of project and must meet the requirements of each platform that you want to target. If not specified in the initial command, the NativeScript CLI will ask you for it afterwards.<% if(isConsole) { %> For more information about the `<App Name>` requirements, run `$ tns help create`.<% } %><% if(isHtml) { %> For projects that target Android, you can use uppercase or lowercase letters, numbers, and underscores. The name must start with a letter. For projects that target iOS, you can use uppercase or lowercase letters, numbers, and hyphens. |
| 35 | +<% } %> |
37 | 36 |
|
38 |
| -Based on the selected options, the NativeScript CLI will use the project templates below: |
| 37 | +<% if(isHtml) { %> |
39 | 38 |
|
40 |
| -Selected Option | Template |
41 |
| -----------|---------- |
42 |
| -`Plain JavaScript - Hello World`, `--js`, `--javascript` | tns-template-hello-world |
43 |
| -`Plain JavaScript - SideDrawer` | tns-template-drawer-navigation |
44 |
| -`Plain JavaScript - Tabs` | tns-template-tab-navigation |
45 |
| -`Plain TypeScript - Hello World`, `--ts`, `--tsc`, `--typescript` | tns-template-hello-world-ts |
46 |
| -`Plain TypeScript - SideDrawer` | tns-template-drawer-navigation-ts |
47 |
| -`Plain TypeScript - Tabs` | tns-template-tab-navigation-ts |
48 |
| -`Angular - Hello World`, `--ng`, `--angular` | tns-template-hello-world-ng |
49 |
| -`Angular - SideDrawer` | tns-template-drawer-navigation-ng |
50 |
| -`Angular - Tabs` | tns-template-tab-navigation-ng |
51 |
| -`Vue.js`, `--vue`, `--vuejs` | tns-template-blank-vue |
| 39 | +### Application Templates |
| 40 | + |
| 41 | +Below you can see a list of the recommended NativeScript starting templates and the commands you should use to generate them. |
| 42 | + |
| 43 | +Template | Command |
| 44 | +---------|---------- |
| 45 | +`JavaScript - Hello World`, `--js`, `--javascript` | tns create --template tns-template-hello-world |
| 46 | +`JavaScript - SideDrawer` | tns create tns-template-drawer-navigation |
| 47 | +`JavaScript - Tabs` | tns create tns-template-tab-navigation |
| 48 | +`TypeScript - Hello World`, `--ts`, `--tsc`, `--typescript` | tns create tns-template-hello-world-ts |
| 49 | +`TypeScript - SideDrawer` | tns create tns-template-drawer-navigation-ts |
| 50 | +`TypeScript - Tabs` | tns create tns-template-tab-navigation-ts |
| 51 | +`Angular - Hello World`, `--ng`, `--angular` | tns create tns-template-hello-world-ng |
| 52 | +`Angular - SideDrawer` | tns create tns-template-drawer-navigation-ng |
| 53 | +`Angular - Tabs` | tns create tns-template-tab-navigation-ng |
| 54 | +`Vue.js`, `--vue`, `--vuejs` | tns create tns-template-blank-vue |
52 | 55 |
|
53 | 56 | ### Related Commands
|
54 | 57 |
|
|
0 commit comments