Skip to content
Open
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
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ NativeScript provides platform APIs directly to the JavaScript runtime (_with st

Some popular use cases:

- Building Web, iOS, Android and Vision Pro apps with a shared codebase (aka, cross platform apps)
- Building Web, iOS, Android, Windows and Vision Pro apps with a shared codebase (aka, cross platform apps)
- Building native platform apps with portable JavaScript skills
- Augmenting JavaScript projects with platform API capabilities
- AndroidTV and Watch development
Expand All @@ -84,20 +84,21 @@ The NativeScript CLI is the command-line interface for interacting with NativeSc
![NativeScript CLI diagram](https://github.com/NativeScript/nativescript-cli/raw/release/ns-cli.png)

* **Commands** - pretty much what every CLI does - support of different command options, input validation and help
* **Devices Service** - provides the communication between NativeScript and devices/emulators/simulators used to run/debug the app. Uses iTunes to talk to iOS and adb for Android
* **Devices Service** - provides the communication between NativeScript and devices/emulators/simulators used to run/debug the app. Uses iTunes to talk to iOS, adb for Android, and local MSIX deployment for Windows.
* **LiveSync Service** - redeploys applications when code changes during development
* **Hooks Service** - executes custom-written hooks in developed application, thus modifying the build process
* **Platforms Service** - provides app build functionalities, uses Gradle to build Android packages and Xcode for iOS.
* **Platforms Service** - provides app build functionalities, uses Gradle to build Android packages, Xcode for iOS, and MSBuild for Windows.

[Back to Top][1]

Supported Platforms
===

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

* Android 4.2 or a later stable official release
* iOS 9.0 or later stable official release
* Windows 10 version 1809 (build 17763) or later — via `@nativescript/windows`

[Back to Top][1]

Expand Down Expand Up @@ -277,11 +278,12 @@ You can always override the generated entitlements file, by pointing to your own

## Build Your Project

You can build it for your target mobile platforms.
You can build it for your target platforms.

```Shell
ns build android
ns build ios
ns build windows
```

The NativeScript CLI calls the SDK for the selected target platform and uses it to build your app locally.
Expand All @@ -290,25 +292,28 @@ When you build for iOS, the NativeScript CLI will either build for a device, if

> **IMPORTANT:** To build your app for an iOS device, you must configure a valid certificate and provisioning profile pair, and have that pair present on your system for code signing your application package. For more information, see [iOS Code Signing - A Complete Walkthrough](https://seventhsoulmountain.blogspot.com/2013/09/ios-code-sign-in-complete-walkthrough.html).

To build for Windows, you need the [.NET 10 SDK](https://dotnet.microsoft.com/download) with the Windows App SDK workload (`dotnet workload install windows`) and Developer Mode enabled. `ns build windows` produces an MSIX package.

[Back to Top][1]

## Run Your Project

You can test your work in progress on connected Android or iOS devices.
You can test your work in progress on connected Android or iOS devices, or on the local Windows machine.

To verify that the NativeScript CLI recognizes your connected devices, run the following command.

```Shell
ns devices
```

The NativeScript CLI lists all connected physical devices and running emulators/simulators.
The NativeScript CLI lists all connected physical devices and running emulators/simulators. On Windows, the local machine is also listed as a Windows device.

After you have listed the available devices, you can quickly run your app on connected devices by executing:
After you have listed the available devices, you can quickly run your app by executing:

```Shell
ns run android
ns run ios
ns run windows # Windows only — runs on the local machine
```

[Back to Top][1]
Expand Down
64 changes: 64 additions & 0 deletions docs/man_pages/project/testing/build-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<% if (isJekyll) { %>---
title: ns build windows
position: 4
---<% } %>

# ns build windows

### Description

Builds the project for Windows and produces an MSIX package that you can deploy on any Windows 10/11 machine with Developer Mode enabled.

<% if(isConsole && (isLinux || isMacOS)) { %>WARNING: You can run this command only on Windows systems. To view the complete help for this command, run `$ ns help build windows`<% } %>
<% if((isConsole && isWindows) || isHtml) { %>
### Commands

Usage | Synopsis
---|---
General | `$ ns build windows [--release [--certificate <File Path> --certificate-password <Password>] [--certificate-thumbprint <Thumbprint>] [--store-upload] [--msixbundle]] [--arch <Architecture>] [--copy-to <File Path>] [--env.*]`

### Options

* `--release` - If set, produces a release build and packages it as an MSIX. By default this produces a sideloadable `.msix` (sign it with the `--certificate*` options); pass `--store-upload` to produce a `.msixupload` bundle for the Microsoft Store instead. Without `--release`, produces a debug build with DevTools support enabled.
* `--certificate` - Specifies the file path to the code-signing certificate (`.pfx`) used to sign the release MSIX. Path is resolved relative to the project directory if not absolute. Used together with `--release`.
* `--certificate-password` - Provides the password for the certificate specified with `--certificate`.
* `--certificate-thumbprint` - Signs the release MSIX using an already-installed certificate identified by its thumbprint, instead of a `.pfx` file. Used together with `--release`. Takes precedence over `--certificate`.
* `--store-upload` - When set with `--release`, produces an unsigned `.msixupload` bundle for submission to the Microsoft Store (the Store re-signs it). No local certificate is required.
* `--msixbundle` - When set with `--release`, produces an MSIX bundle (`.msixbundle`). Implied by `--store-upload`.
* `--arch` - Sets the target architecture for the build (for example `x64`, `arm64`). Defaults to `x64`.
* `--copy-to` - Specifies the file path where the built package will be copied. If it points to a non-existent directory path, it will be created. If the specified value is an existing directory, the original file name will be used.
* `--env.*` - Specifies additional flags that the bundler may process. Can be passed multiple times. Supported additional flags:
* `--env.aot` - creates Ahead-Of-Time build (Angular only).
* `--env.uglify` - provides basic obfuscation and smaller app size.
* `--env.report` - creates a Webpack report inside a `report` folder in the root folder.
* `--env.sourceMap` - creates inline source maps.
* `--force` - If set, skips the application compatibility checks and forces `npm i` to ensure all dependencies are installed.

<% } %>

<% if(isHtml) { %>

### Prerequisites

* Windows 10 version 1809 (build 17763) or later.
* [.NET 10 SDK](https://dotnet.microsoft.com/download) with the Windows App SDK workload installed (`dotnet workload install windows`).
* MSBuild available in `PATH` (installed with Visual Studio or the .NET SDK).

### Command Limitations

* You can run `$ ns build windows` only on Windows systems.
* A `--release` build without `--store-upload`, `--certificate` or `--certificate-thumbprint` produces an unsigned `.msix` that cannot be installed until it is signed.

### Related Commands

Command | Description
----------|----------
[build android](build-android.html) | Builds the project for Android and produces an APK.
[build ios](build-ios.html) | Builds the project for iOS and produces an APP or IPA.
[build](build.html) | Builds the project for the selected target platform.
[debug windows](debug-windows.html) | Debugs your project on the local Windows machine.
[run windows](run-windows.html) | Runs your project on the local Windows machine.
[run android](run-android.html) | Runs your project on a connected Android device or in a native Android emulator, if configured.
[run ios](run-ios.html) | Runs your project on a connected iOS device or in the iOS Simulator, if configured.
[run](run.html) | Runs your project on a connected device or in the native emulator for the selected platform.
<% } %>
6 changes: 4 additions & 2 deletions docs/man_pages/project/testing/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Usage | Synopsis
<% if((isConsole && isMacOS) || isHtml) { %>General | `$ ns build <Platform>`<% } %><% if(isConsole && (isLinux || isWindows)) { %>General | `$ ns build android`<% } %>

<% if((isConsole && isMacOS) || isHtml) { %>### Arguments
`<Platform>` is the target mobile platform for which you want to build your project. You can set the following target platforms.
`<Platform>` is the target platform for which you want to build your project. You can set the following target platforms.
* `android` - Build the project for Android and produces an `APK` that you can manually deploy on a device or in the native emulator.
* `ios` - Build the project for iOS and produces an `APP` or `IPA` that you can manually deploy in the iOS Simulator or on a device.<% } %>
* `ios` - Build the project for iOS and produces an `APP` or `IPA` that you can manually deploy in the iOS Simulator or on a device.
* `windows` - Build the project for Windows and produces an `MSIX` package (Windows only).<% } %>

### Options

Expand Down Expand Up @@ -53,6 +54,7 @@ Command | Description
[appstore upload](../../publishing/appstore-upload.html) | Uploads project to iTunes Connect.
[build android](build-android.html) | Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.
[build ios](build-ios.html) | Builds the project for iOS and produces an APP or IPA that you can manually deploy in the iOS Simulator or on device, respectively.
[build windows](build-windows.html) | Builds the project for Windows and produces an MSIX package.
[debug android](debug-android.html) | Debugs your project on a connected Android device or in a native emulator.
[debug ios](debug-ios.html) | Debugs your project on a connected iOS device or in a native emulator.
[debug](debug.html) | Debugs your project on a connected device or in a native emulator.
Expand Down
69 changes: 69 additions & 0 deletions docs/man_pages/project/testing/debug-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<% if (isJekyll) { %>---
title: ns debug windows
position: 7
---<% } %>

# ns debug windows

### Description

Initiates a debugging session for your project on the local Windows machine. When necessary, the command will prepare, build, deploy and launch the app before starting the debug session. The NativeScript runtime starts a Chrome DevTools Protocol server on port 9229 — attach Chrome DevTools or any CDP-compatible debugger to `ws://localhost:9229`.

<% if(isConsole && (isLinux || isMacOS)) { %>WARNING: You can run this command only on Windows systems. To view the complete help for this command, run `$ ns help debug windows`<% } %>
<% if((isConsole && isWindows) || isHtml) { %>
### Commands

Usage | Synopsis
---|---
Deploy, run and attach the Chrome DevTools debugger | `$ ns debug windows [--device <Device ID>] [--timeout <timeout>]`
Deploy, run and stop at the first code statement | `$ ns debug windows --debug-brk [--timeout <timeout>]`
Attach the debug tools to a running app | `$ ns debug windows --start [--timeout <timeout>]`

### Options

* `--debug-brk` - Builds, deploys and launches the application and stops at the first JavaScript statement.
* `--start` - Attaches the debug tools to a deployed and running app without restarting it.
* `--timeout` - Sets the number of seconds that the NativeScript CLI will wait for the app to launch. Default: 90 seconds.
* `--no-watch` - If set, changes in your code will not be reflected during the execution of this command.
* `--no-hmr` - Disables Hot Module Replacement (HMR).
* `--env.*` - Specifies additional flags that the bundler may process. Can be passed multiple times.
* `--force` - If set, skips the application compatibility checks and forces `npm i` to ensure all dependencies are installed.

<% } %>

<% if(isHtml) { %>

### Prerequisites

* Windows 10 version 1809 (build 17763) or later.
* [.NET 10 SDK](https://dotnet.microsoft.com/download) with the Windows App SDK workload installed.
* Developer Mode enabled in Windows Settings.
* Google Chrome or any debugger supporting the Chrome DevTools Protocol (CDP).

### How to attach Chrome DevTools

1. Run `ns debug windows`
2. Open Chrome and navigate to `chrome://inspect`
3. Under **Devices**, click **Configure** and add `localhost:9229`
4. The NativeScript runtime will appear under **Remote Target** — click **inspect**

### Command Limitations

* You can run `$ ns debug windows` only on Windows systems.

### Related Commands

Command | Description
----------|----------
[build windows](build-windows.html) | Builds the project for Windows and produces an MSIX package.
[build android](build-android.html) | Builds the project for Android.
[build ios](build-ios.html) | Builds the project for iOS.
[build](build.html) | Builds the project for the selected target platform.
[debug android](debug-android.html) | Debugs your project on a connected Android device or in a native emulator.
[debug ios](debug-ios.html) | Debugs your project on a connected iOS device or in a native emulator.
[debug](debug.html) | Debugs your project on a connected device or in a native emulator.
[run windows](run-windows.html) | Runs your project on the local Windows machine.
[run android](run-android.html) | Runs your project on a connected Android device or in a native Android emulator, if configured.
[run ios](run-ios.html) | Runs your project on a connected iOS device or in the iOS Simulator, if configured.
[run](run.html) | Runs your project on a connected device or in the native emulator for the selected platform.
<% } %>
7 changes: 5 additions & 2 deletions docs/man_pages/project/testing/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ Usage | Synopsis
<% if((isConsole && isMacOS) || isHtml) { %>General | `$ ns debug <Platform>`<% } %><% if(isConsole && (isLinux || isWindows)) { %>General | `$ ns debug android`<% } %>

<% if((isConsole && isMacOS) || isHtml) { %>### Arguments
`<Platform>` is the target mobile platform for which you want to debug your project. You can set the following target platforms:
`<Platform>` is the target platform for which you want to debug your project. You can set the following target platforms:
* `android` - Start a debugging session for your project on a connected Android device or Android emulator.
* `ios` - Start a debugging session for your project on a connected iOS device or in the native iOS simulator.<% } %>
* `ios` - Start a debugging session for your project on a connected iOS device or in the native iOS simulator.
* `windows` - Start a debugging session on the local Windows machine via Chrome DevTools Protocol on port 9229 (Windows only).<% } %>

<% if(isHtml) { %>

### Command Limitations

* You can run `$ ns debug ios` only on macOS systems.
* You can run `$ ns debug windows` only on Windows systems.

### Related Commands

Expand All @@ -57,6 +59,7 @@ Command | Description
[build](build.html) | Builds the project for the selected target platform and produces an application package that you can manually deploy on device or in the native emulator.
[debug android](debug-android.html) | Debugs your project on a connected Android device or in a native emulator.
[debug ios](debug-ios.html) | Debugs your project on a connected iOS device or in a native emulator.
[debug windows](debug-windows.html) | Debugs your project on the local Windows machine.
[deploy](deploy.html) | Builds and deploys the project to a connected physical or virtual device.
[run android](run-android.html) | Runs your project on a connected Android device or in a native Android emulator, if configured.
[run ios](run-ios.html) | Runs your project on a connected iOS device or in the iOS Simulator, if configured.
Expand Down
63 changes: 63 additions & 0 deletions docs/man_pages/project/testing/run-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<% if (isJekyll) { %>---
title: ns run windows
position: 11
---<% } %>

# ns run windows

### Description

Runs your project on the local Windows machine. This is shorthand for prepare, build, deploy and launch. While your app is running, prints the output from the application in the console and watches for changes in your code. Once a change is detected, it synchronizes the change with the running application.

<% if(isConsole && (isLinux || isMacOS)) { %>WARNING: You can run this command only on Windows systems. To view the complete help for this command, run `$ ns help run windows`<% } %>
<% if((isConsole && isWindows) || isHtml) { %>
When running this command without passing `--release` flag, the app is built in debug configuration with the DevTools server enabled on port 9229.
<% } %>

### Commands

Usage | Synopsis
---|---
Run on the local Windows device | `$ ns run windows [--release] [--justlaunch] [--env.*]`

### Options

* `--justlaunch` - If set, does not print the application output in the console.
* `--release` - If set, produces a release build. Otherwise, produces a debug build.
* `--no-hmr` - Disables Hot Module Replacement (HMR). When a change in the code is applied, CLI will transfer the modified files and restart the application.
* `--env.*` - Specifies additional flags that the bundler may process. Can be passed multiple times. Supported additional flags:
* `--env.aot` - creates Ahead-Of-Time build (Angular only).
* `--env.uglify` - provides basic obfuscation and smaller app size.
* `--env.report` - creates a Webpack report inside a `report` folder in the root folder.
* `--env.sourceMap` - creates inline source maps.
* `--force` - If set, skips the application compatibility checks and forces `npm i` to ensure all dependencies are installed.

<% if(isHtml) { %>

### Prerequisites

Before running your app, verify that your system meets the following requirements.
* Windows 10 version 1809 (build 17763) or later.
* [.NET 10 SDK](https://dotnet.microsoft.com/download) with the Windows App SDK workload installed.
* Developer Mode enabled in Windows Settings → Privacy & Security → For Developers.

### Command Limitations

* You can run `$ ns run windows` only on Windows systems.

### Related Commands

Command | Description
----------|----------
[build windows](build-windows.html) | Builds the project for Windows and produces an MSIX package.
[build android](build-android.html) | Builds the project for Android.
[build ios](build-ios.html) | Builds the project for iOS.
[build](build.html) | Builds the project for the selected target platform.
[debug windows](debug-windows.html) | Debugs your project on the local Windows machine.
[debug android](debug-android.html) | Debugs your project on a connected Android device or in a native emulator.
[debug ios](debug-ios.html) | Debugs your project on a connected iOS device or in a native emulator.
[debug](debug.html) | Debugs your project on a connected device or in a native emulator.
[run android](run-android.html) | Runs your project on a connected Android device or in a native Android emulator, if configured.
[run ios](run-ios.html) | Runs your project on a connected iOS device or in the iOS Simulator, if configured.
[run](run.html) | Runs your project on a connected device or in the native emulator for the selected platform.
<% } %>
Loading
Loading