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
2 changes: 1 addition & 1 deletion docs/build-jekyll-md.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -e
rm -rf docs-cli
npm install --ignore-scripts

grunt docs-jekyll
npx grunt docs-jekyll
36 changes: 36 additions & 0 deletions docs/man_pages/config/config-get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<% if (isJekyll) { %>---
title: ns config get
position: 2
---<% } %>

# ns config get

### Description

Prints the value for a specific key from the project's NativeScript configuration.

### Commands

Usage | Synopsis
------|-------
General | `$ ns config get <key>`

### Arguments

* `<key>` — The configuration key in dot-notation. Examples: `ios.id`, `android.codeCache`, `bundler`.

### Examples

* `$ ns config get ios.id`
* `$ ns config get android.codeCache`
* `$ ns config get bundler`

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[config](config.html) | Lists all configuration values for the current project.
[config set](config-set.html) | Sets the value for the specified configuration key.
<% } %>
40 changes: 40 additions & 0 deletions docs/man_pages/config/config-set.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<% if (isJekyll) { %>---
title: ns config set
position: 3
---<% } %>

# ns config set

### Description

Sets the value for a specific key in the project's NativeScript configuration.

### Commands

Usage | Synopsis
------|-------
General | `$ ns config set <key> <value>`

### Arguments

* `<key>` — The configuration key in dot-notation. Examples: `ios.id`, `android.codeCache`, `bundler`.
* `<value>` — The value to set. Parsed as JSON when possible (e.g. `true`, `42`, `{ "foo": "bar" }`). Otherwise treated as a string.

### Examples

* `$ ns config set ios.id org.nativescript.myapp`
* `$ ns config set android.codeCache true`
* `$ ns config set bundler vite`

### Notes

* Setting whole objects is not supported. Update individual keys instead. For example, use:
`$ ns config set android.codeCache true`

### Related Commands

Command | Description
----------|----------
[config](config.html) | Lists all configuration values for the current project.
[config get](config-get.html) | Prints the value for the specified configuration key.
<% } %>
39 changes: 39 additions & 0 deletions docs/man_pages/config/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<% if (isJekyll) { %>---
title: ns config
position: 1
---<% } %>

# ns config

### Description

View and manage your project's NativeScript configuration stored in `nativescript.config.(js|ts)` (or legacy `nsconfig.json`).

### Commands

Usage | Synopsis
------|---------
List all config | `$ ns config`
Get a value | `$ ns config get <key>`
Set a value | `$ ns config set <key> <value>`

### Examples

* `$ ns config` — prints all configuration values.
* `$ ns config get ios.id` — prints the iOS bundle identifier.
* `$ ns config set android.codeCache true` — enables Android V8 code cache.

### Notes

* Keys use dot-notation, for example: `ios.id`, `android.codeCache`, `bundler`.
* Values are parsed as JSON when possible. Use quotes for strings with spaces.

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[config get](config-get.html) | Prints the value for the specified configuration key.
[config set](config-set.html) | Sets the value for the specified configuration key.
<% } %>
33 changes: 17 additions & 16 deletions lib/commands/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import * as _ from "lodash";

export class DebugPlatformCommand
extends ValidatePlatformCommandBase
implements ICommand {
implements ICommand
{
public allowedParameters: ICommandParameter[] = [];

constructor(
Expand All @@ -36,13 +37,13 @@ export class DebugPlatformCommand
private $debugDataService: IDebugDataService,
private $debugController: IDebugController,
private $liveSyncCommandHelper: ILiveSyncCommandHelper,
private $migrateController: IMigrateController
private $migrateController: IMigrateController,
) {
super(
$options,
$platformsDataService,
$platformValidationService,
$projectData
$projectData,
);
$cleanupService.setShouldDispose(false);
}
Expand All @@ -66,10 +67,10 @@ export class DebugPlatformCommand
const debugData = this.$debugDataService.getDebugData(
selectedDeviceForDebug.deviceInfo.identifier,
this.$projectData,
debugOptions
debugOptions,
);
await this.$debugController.printDebugInformation(
await this.$debugController.startDebug(debugData)
await this.$debugController.startDebug(debugData),
);
return;
}
Expand All @@ -83,7 +84,7 @@ export class DebugPlatformCommand
},
buildPlatform: undefined,
skipNativePrepare: false,
}
},
);
}

Expand All @@ -98,17 +99,17 @@ export class DebugPlatformCommand
if (
!this.$platformValidationService.isPlatformSupportedForOS(
this.platform,
this.$projectData
this.$projectData,
)
) {
this.$errors.fail(
`Applications for platform ${this.platform} can not be built on this OS`
`Applications for platform ${this.platform} can not be built on this OS`,
);
}

if (this.$options.release) {
this.$errors.failWithHelp(
"--release flag is not applicable to this command."
"--release flag is not applicable to this command.",
);
}

Expand Down Expand Up @@ -138,12 +139,12 @@ export class DebugIOSCommand implements ICommand {
private $sysInfo: ISysInfo,
private $projectData: IProjectData,
$iosDeviceOperations: IIOSDeviceOperations,
$iOSSimulatorLogProvider: Mobile.IiOSSimulatorLogProvider
$iOSSimulatorLogProvider: Mobile.IiOSSimulatorLogProvider,
) {
this.$projectData.initializeProjectData();
// Do not dispose ios-device-lib, so the process will remain alive and the debug application (NativeScript Inspector or Chrome DevTools) will be able to connect to the socket.
// In case we dispose ios-device-lib, the socket will be closed and the code will fail when the debug application tries to read/send data to device socket.
// That's why the `$ tns debug ios --justlaunch` command will not release the terminal.
// That's why the `$ ns debug ios --justlaunch` command will not release the terminal.
// In case we do not set it to false, the dispose will be called once the command finishes its execution, which will prevent the debugging.
$iosDeviceOperations.setShouldDispose(false);
$iOSSimulatorLogProvider.setShouldDispose(false);
Expand All @@ -157,18 +158,18 @@ export class DebugIOSCommand implements ICommand {
if (
!this.$platformValidationService.isPlatformSupportedForOS(
this.$devicePlatformsConstants.iOS,
this.$projectData
this.$projectData,
)
) {
this.$errors.fail(
`Applications for platform ${this.$devicePlatformsConstants.iOS} can not be built on this OS`
`Applications for platform ${this.$devicePlatformsConstants.iOS} can not be built on this OS`,
);
}

const isValidTimeoutOption = this.isValidTimeoutOption();
if (!isValidTimeoutOption) {
this.$errors.fail(
`Timeout option specifies the seconds NativeScript CLI will wait to find the inspector socket port from device's logs. Must be a number.`
`Timeout option specifies the seconds NativeScript CLI will wait to find the inspector socket port from device's logs. Must be a number.`,
);
}

Expand All @@ -179,7 +180,7 @@ export class DebugIOSCommand implements ICommand {
macOSWarning.severity === SystemWarningsSeverity.high
) {
this.$errors.fail(
`You cannot use NativeScript Inspector on this OS. To use it, please update your OS.`
`You cannot use NativeScript Inspector on this OS. To use it, please update your OS.`,
);
}
}
Expand Down Expand Up @@ -224,7 +225,7 @@ export class DebugAndroidCommand implements ICommand {
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
private $injector: IInjector,
private $projectData: IProjectData,
private $options: IOptions
private $options: IOptions,
) {
this.$projectData.initializeProjectData();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/common/definitions/extensibility.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ interface IExtensibilityService {
* Gives the name of the extension that contains a required command.
* The method finds all extensions from npm and checks the command property defined in the nativescript key of the package.json.
* Based on specified input array, the method tries to find a suitable command that is defined in the extension.
* @example In case the input is `tns execute this command now`, the array will be ["execute", "this", "command", "now"].
* @example In case the input is `ns execute this command now`, the array will be ["execute", "this", "command", "now"].
* There may be an extension that defines execute|this as a command. The method will check each extension for the following commands:
* execute|this|command|now, execute|this|command, execute|this, execute
* In case it finds any of this commands, the method will return the extension name and the command name.
* @param {string[]} inputStrings All strings written on the terminal.
* @returns {IExtensionCommandInfo} Information about the extension and the registered command.
*/
getExtensionNameWhereCommandIsRegistered(
inputOpts: IGetExtensionCommandInfoParams
inputOpts: IGetExtensionCommandInfoParams,
): Promise<IExtensionCommandInfo>;

/**
Expand Down
Loading