diff --git a/docs/man_pages/project/configuration/prepare.md b/docs/man_pages/project/configuration/prepare.md index 99f8efe46b..7749afa15d 100644 --- a/docs/man_pages/project/configuration/prepare.md +++ b/docs/man_pages/project/configuration/prepare.md @@ -10,6 +10,12 @@ position: 7 Copies common and relevant platform-specific content from the `app` directory to the subdirectory for the selected target platform in the `platforms` directory. This lets you build the project with the SDK for the selected platform. <% if(isMacOS) { %>You must specify the target platform for which you want to prepare your project.<% } %> +When running this command the HMR (Hot Module Replacement) is not enabled by default. In case you want to enable HMR, you can pass `--hmr` flag. + +<% if(isHtml) { %> +> NOTE: When passing `--release` CLI will disable HMR. +<% } %> + ### Commands Usage | Synopsis @@ -21,6 +27,10 @@ Usage | Synopsis * `android` - Prepares your project for an Android build. * `ios` - Prepares your project for an iOS build.<% } %> +### Options + +* `--hmr` - Enables the hot module replacement (HMR) feature. + <% if(isHtml) { %> ### Command Limitations diff --git a/docs/man_pages/project/testing/build-android.md b/docs/man_pages/project/testing/build-android.md index a68d6e2543..835e62e254 100644 --- a/docs/man_pages/project/testing/build-android.md +++ b/docs/man_pages/project/testing/build-android.md @@ -13,7 +13,7 @@ Builds the project for Android and produces an APK that you can manually deploy Usage | Synopsis ---|--- -General | `$ tns build android [--compileSdk ] [--key-store-path --key-store-password --key-store-alias --key-store-alias-password ] [--release] [--static-bindings] [--copy-to ] [--bundle [] [--env.*]] [--aab]` +General | `$ tns build android [--compileSdk ] [--key-store-path --key-store-password --key-store-alias --key-store-alias-password ] [--release] [--static-bindings] [--copy-to ] [--env.*]] [--aab]` ### Options @@ -25,7 +25,6 @@ General | `$ tns build android [--compileSdk ] [--key-store-path ] [--provision []] [--bundle [] [--env.*]]` +General | `$ tns build ios [--for-device] [--release] [--copy-to ] [--provision []] [--env.*]]` ### Options @@ -27,7 +27,6 @@ General | `$ tns build ios [--for-device] [--release] [--copy-to ] [- * `--copy-to` - Specifies the file path where the built `.ipa` will be copied. If it points to a non-existent directory path, it will be created. If the specified value is existing directory, the original file name will be used. * `--team-id` - If used without parameter, lists all team names and ids. If used with team name or id, it will switch to automatic signing mode and configure the .xcodeproj file of your app. In this case .xcconfig should not contain any provisioning/team id flags. This team id will be further used for codesigning the app. For Xcode 9.0+, xcodebuild will be allowed to update and modify automatically managed provisioning profiles. * `--provision` - If used without parameter, lists all eligible provisioning profiles. If used with UUID or name of your provisioning profile, it will switch to manual signing mode and configure the .xcodeproj file of your app. In this case xcconfig should not contain any provisioning/team id flags. This provisioning profile will be further used for codesigning the app. -* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application. * `--env.*` - Specifies additional flags that the bundler may process. May be passed multiple times. Supported additional flags: * `--env.aot` - creates Ahead-Of-Time build (Angular only). * `--env.snapshot`- creates [Snapshot](https://docs.nativescript.org/performance-optimizations/bundling-with-webpack#v8-heap-snapshot) (only for release builds on Mac OS & for Android). diff --git a/docs/man_pages/project/testing/build.md b/docs/man_pages/project/testing/build.md index ca58867483..eb4e7d7954 100644 --- a/docs/man_pages/project/testing/build.md +++ b/docs/man_pages/project/testing/build.md @@ -9,6 +9,12 @@ position: 3 Builds the project for Android <% if(isMacOS) { %>or iOS <% } %>and produces an application package that you can manually deploy on a device or native emulator. <% if(isMacOS) { %>You must specify the target platform for which you want to build your project.<% } %> +When running this command the HMR (Hot Module Replacement) is not enabled by default. In case you want to enable HMR, you can pass `--hmr` flag. + +<% if(isHtml) { %> +> NOTE: When passing `--release` CLI will disable HMR. +<% } %> + ### Commands Usage | Synopsis @@ -20,15 +26,12 @@ Usage | Synopsis * `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.<% } %> -<% if(isHtml) { %> - ### 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. +* `--release` -If set, produces a release build by running webpack in production mode and native build in release mode. Otherwise, produces a debug build. * `--device` - Specifies a connected device/emulator to start and run the app. `` is the index or `Device Identifier` of the target device as listed by the `$ tns device --available-devices` command. -* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application. -* `--hmr` - (Beta) Enables the hot module replacement (HMR) feature. HMR depends on `webpack` and adding the `--hmr` flag to the command will automatically enable the `--bundle` option as well. <% if(isConsole) { %> The HMR feature is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.<% } %> +* `--hmr` - Enables the hot module replacement (HMR) feature. * `--env.*` - Specifies additional flags that the bundler may process. May be passed multiple times. Supported additional flags: * `--env.aot` - creates Ahead-Of-Time build (Angular only). * `--env.snapshot`- creates [Snapshot](https://docs.nativescript.org/performance-optimizations/bundling-with-webpack#v8-heap-snapshot) (only for release builds on Mac OS & for Android). @@ -36,8 +39,8 @@ Usage | Synopsis * `--env.report` - creates a Webpack report inside a `report` folder in the root folder. * `--env.sourceMap` - creates inline source maps (useful for debbuging bundled app). * `--env.hiddenSourceMap` - creates sources maps in the root folder (useful for Crashlytics usage with bundled app in release). -* `--syncAllFiles` - Watches all production dependencies inside node_modules for changes. Triggers project rebuild if necessary! +<% if(isHtml) { %> ### Related Commands diff --git a/docs/man_pages/project/testing/debug-android.md b/docs/man_pages/project/testing/debug-android.md index 2553e63ace..706ad97259 100644 --- a/docs/man_pages/project/testing/debug-android.md +++ b/docs/man_pages/project/testing/debug-android.md @@ -9,8 +9,6 @@ position: 4 Initiates a debugging session for your project on a connected Android device or Android emulator. When necessary, the command will prepare, build, deploy and launch the app before starting the debug session. While debugging, the output from the application is printed in the console and any changes made to your code are synchronizes with the deployed app. -To enable Hot Module Replacement (HMR) in Angular projects, follow the steps outlined in [the HMR documentation section](https://docs.nativescript.org/performance-optimizations/bundling-with-webpack#hot-module-replacement). - ### Commands Usage | Synopsis @@ -30,14 +28,10 @@ Attach the debug tools to a running app in the native emulator | `$ tns debug an * `--timeout` - Sets the number of seconds that the NativeScript CLI will wait for the emulator/device to boot. If not set, the default timeout is 90 seconds. * `--no-watch` - If set, changes in your code will not be reflected during the execution of this command. * `--clean` - If set, forces the complete rebuild of the native application. -* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application. -* `--hmr` - Enables the hot module replacement (HMR) feature. HMR depends on `webpack` and adding the `--hmr` flag to the command will automatically enable the `--bundle` option as well.<% if(isConsole) { %> For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.<% } %> -* `--syncAllFiles` - Watches all production dependencies inside node_modules for changes. Triggers project rebuild if necessary! +* `--no-hmr` - Disables Hot Module Replacement (HMR). In this case, when a change in the code is applied, CLI will transfer the modified files and restart the application. <% if(isHtml) { %> ->Note: For more information about HMR, the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398. - ### Command Limitations * You must have Google Chrome installed on your machine. diff --git a/docs/man_pages/project/testing/debug-ios.md b/docs/man_pages/project/testing/debug-ios.md index 99efd2064e..c7fd745f7f 100644 --- a/docs/man_pages/project/testing/debug-ios.md +++ b/docs/man_pages/project/testing/debug-ios.md @@ -13,8 +13,6 @@ Initiates a debugging session for your project on a connected iOS device or in t <% if((isConsole && isMacOS) || isHtml) { %> <% if(isHtml) { %>> <% } %>IMPORTANT: Before building for iOS device, verify that you have configured a valid pair of certificate and provisioning profile on your macOS system. <% if(isHtml) { %>For more information, see the [Code Signing](https://developer.apple.com/support/code-signing/) and [Maintain Signing Assets](https://help.apple.com/xcode/mac/current/#/dev3a05256b8) sections from the Apple Developer documentation.<% } %> -To enable Hot Module Replacement (HMR) in Angular projects, follow the steps outlined in this wiki: https://github.com/NativeScript/nativescript-angular/wiki/HMR. - ### Commands Usage | Synopsis @@ -35,17 +33,13 @@ Attach the debug tools to a running app in the iOS simulator | `$ tns debug ios * `--timeout` - Sets the number of seconds that NativeScript CLI will wait to find the inspector socket port from device's logs. If not set, the default timeout is 10 seconds. * `--no-watch` - If set, changes in your code will not be reflected during the execution of this command. * `--clean` - If set, forces the complete rebuild of the native application. -* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application. -* `--hmr` - (Beta) Enables the hot module replacement (HMR) feature. HMR depends on `webpack` and adding the `--hmr` flag to the command will automatically enable the `--bundle` option as well. <% if(isConsole) { %> The HMR feature is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.<% } %> +* `--no-hmr` - Disables Hot Module Replacement (HMR). In this case, when a change in the code is applied, CLI will transfer the modified files and restart the application. * `--chrome` - Deprecated - default behavior uses '--chrome' implicitly. Allows debugging in Chrome Developer Tools. If set, Safari Web Inspector is not started and debugging is attached to Chrome Developer Tools. * `--inspector` - If set, the developer tools in the Safari Web Inspector are used for debugging the application. -* `--syncAllFiles` - Watches all production dependencies inside node_modules for changes. Triggers project rebuild if necessary! <% } %> <% if(isHtml) { %> ->Note: Hot Module Replacement (HMR) is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398. - ### Command Limitations * You can run `$ tns debug ios` only on macOS systems. diff --git a/docs/man_pages/project/testing/debug.md b/docs/man_pages/project/testing/debug.md index 40e1bb37d7..c37a49c4e6 100644 --- a/docs/man_pages/project/testing/debug.md +++ b/docs/man_pages/project/testing/debug.md @@ -9,6 +9,28 @@ position: 6 Initiates a debugging session for your project on a connected device or native emulator. <% if(isMacOS) { %>You must specify the target platform on which you want to debug.<% } %> When necessary, the command will prepare, build, deploy and launch the app before starting the debug session. While debugging, the output from the application is printed in the console and any changes made to your code are synchronized on all connected devices or running emulators. +<% if(isHtml) { %> +#### How file changes are handled +With HMR (Hot Module Replacement): +* Changes in `.js`, `.ts`, `.less`, `.sass` and other file types that are accepted will cause a refresh of the application. +* Changes in `App_Resources` will cause a rebuild of the application. +* Changes in any `package.json` file inside the project will cause a rebuild of the application. +* Changes in `node_modules/somePlugin` if accepted will cause a refresh of the application. +* Changes in `node_modules/somePlugin/platforms` will cause a rebuild of the application. +* Changes in `node_modules/somePlugin/package.json` file will cause a rebuild of the application. +* Changes that are not accepted and HMR fails will cause a restart of the native application. + +With **no** HMR: +* Changes in `.js`, `.ts`, `.less`, `.sass` and other file types will cause a restart of the native application. +* Changes in `App_Resources` will cause a rebuild of the application. +* Changes in any `package.json` file inside the project will cause a rebuild of the application. +* Changes in `node_modules/somePlugin` will cause a restart of the native application. +* Changes in `node_modules/somePlugin/platforms` will cause a rebuild of the application. +* Changes in `node_modules/somePlugin/package.json` file will cause a rebuild of the application. + +When running this command with `--debug-brk` any file change will cause a restart of the native application (HMR is disabled). Changes in `App_Resources` and `node_modules/somePlugin/platforms` will cause a rebuild of the application. +<% } %> + ### Commands Usage | Synopsis diff --git a/docs/man_pages/project/testing/preview.md b/docs/man_pages/project/testing/preview.md index 8ab4fa79dc..e7d6063309 100644 --- a/docs/man_pages/project/testing/preview.md +++ b/docs/man_pages/project/testing/preview.md @@ -15,8 +15,6 @@ To scan the QR code and deploy your app on a device, you need to have the Native After scanning the QR code with the scanner provided in the NativeScript Playground app, your app will be launched on your device through the Preview app. Additionally, any changes made to your project will be automatically synchronized with the deployed app. -To enable Hot Module Replacement (HMR) in Angular projects, follow the steps outlined in this wiki: https://github.com/NativeScript/nativescript-angular/wiki/HMR. - ### Commands Usage | Synopsis @@ -25,15 +23,10 @@ Generates a QR code that can be scanned by the NativeScript PlayGround app | `tn ### Options -* `--bundle` - (Beta) Specifies that the `webpack` bundler will be used to bundle the application.<% if(isConsole) { %> The support for webpack in preview is currently in Beta. Please, do not hesitate to report any problems that you experience with the feature by opening a new issue in the NativeScript CLI repository: https://github.com/NativeScript/nativescript-cli/issues/new/choose.<% } %> -* `--hmr` - (Beta) Enables the hot module replacement (HMR) feature. HMR depends on `webpack` and adding the `--hmr` flag to the command will automatically enable the `--bundle` option as well.<% if(isConsole) { %> The HMR feature is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.<% } %> +* `--no-hmr` - Disables Hot Module Replacement (HMR). In this case, when a change in the code is applied, CLI will transfer the modified files and restart the application. <% if(isHtml) { %> ->Note: Hot Module Replacement (HMR) is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398. - ->Note: Webpack support for the `tns preview` command is currently in Beta. Please, do not hesitate to report any problems that you experience with the feature by opening a new issue in the NativeScript CLI repository: https://github.com/NativeScript/nativescript-cli/issues/new/choose. - ### Command Limitations * The Preview app comes with a predefined set of NativeScript plugins. If your app utilizes a plugin that is not present in the Preview app, you will see a warning message and your app might not work as expected. diff --git a/docs/man_pages/project/testing/run-android.md b/docs/man_pages/project/testing/run-android.md index 2026e0b4da..f95712f7e8 100644 --- a/docs/man_pages/project/testing/run-android.md +++ b/docs/man_pages/project/testing/run-android.md @@ -9,15 +9,17 @@ position: 10 Runs your project on a connected Android device or Android emulator, if configured. This is shorthand for prepare, build and deploy. 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 all selected devices and restarts/refreshes the application. -To enable Hot Module Replacement (HMR) in Angular projects, follow the steps outlined in this wiki: https://github.com/NativeScript/nativescript-angular/wiki/HMR. +<% if(isHtml) { %> +When running this command without passing `--release` flag, the HMR (Hot Module Replacement) is enabled by default. In case you want to disable HMR, you can pass `--no-hmr` flag. When `--release` is passed, CLI disables HMR. +<% } %> ### Commands Usage | Synopsis ---|--- -Run on all connected devices and running emulators | `$ tns run android [--key-store-path --key-store-password --key-store-alias --key-store-alias-password ] [--release] [--justlaunch] [--bundle [] [--env.*]]` -Run on a selected connected device or running emulator. Will start emulator with specified `Device Identifier`, if not already running. | `$ tns run android --device [--key-store-path --key-store-password --key-store-alias --key-store-alias-password ] [--release] [--justlaunch] [--bundle [] [--env.*]]` -Start a default emulator if none are running, or run application on all connected emulators. | `$ tns run android --emulator [--key-store-path --key-store-password --key-store-alias --key-store-alias-password ] [--release] [--justlaunch] [--bundle [] [--env.*]]` +Run on all connected devices and running emulators | `$ tns run android [--key-store-path --key-store-password --key-store-alias --key-store-alias-password ] [--release] [--justlaunch] [--env.*]]` +Run on a selected connected device or running emulator. Will start emulator with specified `Device Identifier`, if not already running. | `$ tns run android --device [--key-store-path --key-store-password --key-store-alias --key-store-alias-password ] [--release] [--justlaunch] [--env.*]]` +Start a default emulator if none are running, or run application on all connected emulators. | `$ tns run android --emulator [--key-store-path --key-store-password --key-store-alias --key-store-alias-password ] [--release] [--justlaunch] [--env.*]]` ### Options @@ -26,13 +28,12 @@ Start a default emulator if none are running, or run application on all connecte * `--justlaunch` - If set, does not print the application output in the console. * `--clean` - If set, forces the complete rebuild of the native application. * `--no-watch` - If set, changes in your code will not be reflected during the execution of this command. -* `--release` - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the `--key-store-*` options. +* `--release` - If set, produces a release build by running webpack in production mode and native build in release mode. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options. * `--key-store-path` - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the `--key-store-*` options along with `--release` to produce a signed release build. You need to specify all `--key-store-*` options. * `--key-store-password` - Provides the password for the keystore file specified with `--key-store-path`. You can use the `--key-store-*` options along with `--release` to produce a signed release build. You need to specify all `--key-store-*` options. * `--key-store-alias` - Provides the alias for the keystore file specified with `--key-store-path`. You can use the `--key-store-*` options along with `--release` to produce a signed release build. You need to specify all `--key-store-*` options. * `--key-store-alias-password` - Provides the password for the alias specified with `--key-store-alias-password`. You can use the `--key-store-*` options along with `--release` to produce a signed release build. You need to specify all `--key-store-*` options. -* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application. -* `--hmr` - (Beta) Enables the hot module replacement (HMR) feature. HMR depends on `webpack` and adding the `--hmr` flag to the command will automatically enable the `--bundle` option as well. <% if(isConsole) { %> The HMR feature is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.<% } %> +* `--no-hmr` - Disables Hot Module Replacement (HMR). In this case, 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. May be passed multiple times. * `--env.aot` - creates Ahead-Of-Time build (Angular only). * `--env.snapshot`- creates [Snapshot](https://docs.nativescript.org/performance-optimizations/bundling-with-webpack#v8-heap-snapshot) (only for release builds on Mac OS & for Android). @@ -40,12 +41,9 @@ Start a default emulator if none are running, or run application on all connecte * `--env.report` - creates a Webpack report inside a `report` folder in the root folder. * `--env.sourceMap` - creates inline source maps (useful for debbuging bundled app). * `--env.hiddenSourceMap` - creates sources maps in the root folder (useful for Crashlytics usage with bundled app in release). -* `--syncAllFiles` - Watches all production dependencies inside node_modules for changes. Triggers project rebuild if necessary! <% if(isHtml) { %> ->Note: Hot Module Replacement (HMR) is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398. - ### Prerequisites Before running your app in the Android emulator from the Android SDK, verify that your system meets the following requirements. diff --git a/docs/man_pages/project/testing/run-ios.md b/docs/man_pages/project/testing/run-ios.md index 997464e95e..3e30c3f4c9 100644 --- a/docs/man_pages/project/testing/run-ios.md +++ b/docs/man_pages/project/testing/run-ios.md @@ -13,15 +13,17 @@ Runs your project on a connected iOS device or in the iOS Simulator, if configur <% if((isConsole && isMacOS) || isHtml) { %> <% if(isHtml) { %>> <% } %>IMPORTANT: Before building for iOS device, verify that you have configured a valid pair of certificate and provisioning profile on your macOS system. <% if(isHtml) { %>For more information, see the [Code Signing](https://developer.apple.com/support/code-signing/) and [Maintain Signing Assets](https://help.apple.com/xcode/mac/current/#/dev3a05256b8) sections from the Apple Developer documentation.<% } %> -To enable Hot Module Replacement (HMR) in Angular projects, follow the steps outlined in this wiki: https://github.com/NativeScript/nativescript-angular/wiki/HMR. +<% if(isHtml) { %> +When running this command without passing `--release` flag, the HMR (Hot Module Replacement) is enabled by default. In case you want to disable HMR, you can pass `--no-hmr` flag. When `--release` is passed, CLI disables HMR. +<% } %> ### Commands Usage | Synopsis ---|--- -Run on all connected devices | `$ tns run ios [--release] [--justlaunch] [--bundle [] [--env.*]]` -Run on a selected connected device. Will start simulator with specified `Device Identifier`, if not already running. | `$ tns run ios [--device ] [--release] [--justlaunch] [--bundle [] [--env.*]]` -Start an emulator and run the app inside it | `$ tns run ios --emulator [--release] [--bundle [] [--env.*]]` +Run on all connected devices | `$ tns run ios [--release] [--justlaunch] [--env.*]]` +Run on a selected connected device. Will start simulator with specified `Device Identifier`, if not already running. | `$ tns run ios [--device ] [--release] [--justlaunch] [--env.*]]` +Start an emulator and run the app inside it | `$ tns run ios --emulator [--release] [--env.*]]` Start an emulator with specified device name and sdk | `$ tns run ios [--device ] [--sdk ]` Start an emulator with specified device identifier and sdk | `$ tns run ios [--device ] [--sdk ]` @@ -33,9 +35,8 @@ Start an emulator with specified device identifier and sdk | `$ tns run ios [--d * `--justlaunch` - If set, does not print the application output in the console. * `--clean` - If set, forces the complete rebuild of the native application. * `--no-watch` - If set, changes in your code will not be reflected during the execution of this command. -* `--release` - If set, produces a release build. Otherwise, produces a debug build. -* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application. -* `--hmr` - (Beta) Enables the hot module replacement (HMR) feature. HMR depends on `webpack` and adding the `--hmr` flag to the command will automatically enable the `--bundle` option as well. <% if(isConsole) { %> The HMR feature is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.<% } %> +* `--release` - If set, produces a release build by running webpack in production mode and native build in release mode. Otherwise, produces a debug build. +* `--no-hmr` - Disables Hot Module Replacement (HMR). In this case, 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. May be passed multiple times. * `--env.aot` - creates Ahead-Of-Time build (Angular only). * `--env.snapshot`- creates [Snapshot](https://docs.nativescript.org/performance-optimizations/bundling-with-webpack#v8-heap-snapshot) (only for release builds on Mac OS & for Android). @@ -43,13 +44,10 @@ Start an emulator with specified device identifier and sdk | `$ tns run ios [--d * `--env.report` - creates a Webpack report inside a `report` folder in the root folder. * `--env.sourceMap` - creates inline source maps (useful for debbuging bundled app). * `--env.hiddenSourceMap` - creates sources maps in the root folder (useful for Crashlytics usage with bundled app in release). -* `--syncAllFiles` - Watches all production dependencies inside node_modules for changes. Triggers project rebuild if necessary! <% } %> <% if(isHtml) { %> ->Note: Hot Module Replacement (HMR) is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398. - ### Prerequisites Before running the iOS Simulator, verify that your system meets the following requirements. diff --git a/docs/man_pages/project/testing/run.md b/docs/man_pages/project/testing/run.md index ed555af37f..99c6d1a8e5 100644 --- a/docs/man_pages/project/testing/run.md +++ b/docs/man_pages/project/testing/run.md @@ -9,21 +9,42 @@ position: 12 Runs your project on all connected devices or in native emulators for the selected platform.<% if(isConsole && (isLinux || isWindows)) { %>The command will work with all currently running Android devices and emulators.<% } %> The command will prepare, build and deploy the app when necessary. By default listens for changes in your code, synchronizes those changes and refreshes all selected devices. +<% if(isHtml) { %> +When running this command without passing `--release` flag, the HMR (Hot Module Replacement) is enabled by default. In case you want to disable HMR, you can pass `--no-hmr` flag. When `--release` is passed, CLI disables HMR. + +#### How file changes are handled +With HMR (Hot Module Replacement): +* Changes in `.js`, `.ts`, `.less`, `.sass` and other file types that are accepted will cause a refresh of the application. +* Changes in `App_Resources` will cause a rebuild of the application. +* Changes in any `package.json` file inside the project will cause a rebuild of the application. +* Changes in `node_modules/somePlugin` if accepted will cause a refresh of the application. +* Changes in `node_modules/somePlugin/platforms` will cause a rebuild of the application. +* Changes in `node_modules/somePlugin/package.json` file will cause a rebuild of the application. +* Changes that are not accepted and HMR fails will cause a restart of the native application. + +With **no** HMR: +* Changes in `.js`, `.ts`, `.less`, `.sass` and other file types will cause a restart of the native application. +* Changes in `App_Resources` will cause a rebuild of the application. +* Changes in any `package.json` file inside the project will cause a rebuild of the application. +* Changes in `node_modules/somePlugin` will cause a restart of the native application. +* Changes in `node_modules/somePlugin/platforms` will cause a rebuild of the application. +* Changes in `node_modules/somePlugin/package.json` file will cause a rebuild of the application. +<% } %> + ### Commands Usage | Synopsis ---|--- Run on all connected devices | `$ tns run [--release] [--justlaunch]` Run on a selected connected device or running emulator. Will start emulator with specified `Device Identifier`, if not already running. | `$ tns run --device [--release] [--justlaunch]` -<% if((isConsole && isMacOS) || isHtml) { %>Run on all connected devices of the speficied `Platform` | `$ tns run [--release] [--justlaunch]`<% } %> +<% if((isConsole && isMacOS) || isHtml) { %>Run on all connected devices of the specified `Platform` | `$ tns run [--release] [--justlaunch]`<% } %> ### 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. +* `--release` - If set, produces a release build by running webpack in production mode and native build in release mode. Otherwise, produces a debug build. * `--device` - Specifies a connected device/emulator to start and run the app. `` is the index or `Device Identifier` of the target device as listed by the `$ tns device --available-devices` command. -* `--bundle` - Specifies that the `webpack` bundler will be used to bundle the application. -* `--hmr` - (Beta) Enables the hot module replacement (HMR) feature. HMR depends on `webpack` and adding the `--hmr` flag to the command will automatically enable the `--bundle` option as well. <% if(isConsole) { %> The HMR feature is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398.<% } %> +* `--no-hmr` - Disables Hot Module Replacement (HMR). In this case, 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. May be passed multiple times. Supported additional flags: * `--env.aot` - creates Ahead-Of-Time build (Angular only). * `--env.snapshot`- creates [Snapshot](https://docs.nativescript.org/performance-optimizations/bundling-with-webpack#v8-heap-snapshot) (only for release builds on Mac OS & for Android). @@ -31,7 +52,6 @@ Run on a selected connected device or running emulator. Will start emulator with * `--env.report` - creates a Webpack report inside a `report` folder in the root folder. * `--env.sourceMap` - creates inline source maps (useful for debbuging bundled app). * `--env.hiddenSourceMap` - creates sources maps in the root folder (useful for Crashlytics usage with bundled app in release). -* `--syncAllFiles` - Watches all production dependencies inside node_modules for changes. Triggers project rebuild if necessary! <% if((isConsole && isMacOS) || isHtml) { %>### Arguments @@ -43,8 +63,6 @@ Run on a selected connected device or running emulator. Will start emulator with <% if(isHtml) { %> ->Note: Hot Module Replacement (HMR) is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/NativeScript/issues/6398. - ### Command Limitations * The command will work with all connected devices and running emulators on macOS. On Windows and Linux the command will work with Android devices only. diff --git a/docs/man_pages/project/testing/test.md b/docs/man_pages/project/testing/test.md index c09a07f54d..59edac7c60 100644 --- a/docs/man_pages/project/testing/test.md +++ b/docs/man_pages/project/testing/test.md @@ -9,6 +9,16 @@ position: 23 Runs unit tests on the selected mobile platform.<% if(isConsole) { %> Your project must already be configured for unit testing by running `$ tns test init`.<% } %> +<% if(isHtml) { %> +#### How file changes are handled +* Changes in `.js`, `.ts`, `.less`, `.sass` and other file types will cause a restart of the native application. +* Changes in `App_Resources` will cause a rebuild of the application. +* Changes in any `package.json` file inside the project will cause a rebuild of the application. +* Changes in `node_modules/somePlugin` will cause a restart of the native application. +* Changes in `node_modules/somePlugin/platforms` will cause a rebuild of the application. +* Changes in `node_modules/somePlugin/package.json` file will cause a rebuild of the application. +<% } %> + ### Commands Usage | Synopsis