diff --git a/docs/build-jekyll-md.sh b/docs/build-jekyll-md.sh index 100def93e4..766f974aa7 100755 --- a/docs/build-jekyll-md.sh +++ b/docs/build-jekyll-md.sh @@ -4,4 +4,4 @@ set -e rm -rf docs-cli npm install --ignore-scripts -grunt docs-jekyll +npx grunt docs-jekyll diff --git a/docs/man_pages/config/config-get.md b/docs/man_pages/config/config-get.md new file mode 100644 index 0000000000..e262e557a5 --- /dev/null +++ b/docs/man_pages/config/config-get.md @@ -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 ` + +### Arguments + +* `` — 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. +<% } %> \ No newline at end of file diff --git a/docs/man_pages/config/config-set.md b/docs/man_pages/config/config-set.md new file mode 100644 index 0000000000..ea7769f647 --- /dev/null +++ b/docs/man_pages/config/config-set.md @@ -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 ` + +### Arguments + +* `` — The configuration key in dot-notation. Examples: `ios.id`, `android.codeCache`, `bundler`. +* `` — 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. +<% } %> \ No newline at end of file diff --git a/docs/man_pages/config/config.md b/docs/man_pages/config/config.md new file mode 100644 index 0000000000..7b701e03d1 --- /dev/null +++ b/docs/man_pages/config/config.md @@ -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 ` +Set a value | `$ ns config set ` + +### 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. +<% } %> \ No newline at end of file diff --git a/lib/commands/debug.ts b/lib/commands/debug.ts index 031effbbce..c7478ab09f 100644 --- a/lib/commands/debug.ts +++ b/lib/commands/debug.ts @@ -20,7 +20,8 @@ import * as _ from "lodash"; export class DebugPlatformCommand extends ValidatePlatformCommandBase - implements ICommand { + implements ICommand +{ public allowedParameters: ICommandParameter[] = []; constructor( @@ -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); } @@ -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; } @@ -83,7 +84,7 @@ export class DebugPlatformCommand }, buildPlatform: undefined, skipNativePrepare: false, - } + }, ); } @@ -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.", ); } @@ -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); @@ -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.`, ); } @@ -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.`, ); } } @@ -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(); } diff --git a/lib/common/definitions/extensibility.d.ts b/lib/common/definitions/extensibility.d.ts index cdb55b9230..fbfd3be6d5 100644 --- a/lib/common/definitions/extensibility.d.ts +++ b/lib/common/definitions/extensibility.d.ts @@ -124,7 +124,7 @@ 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. @@ -132,7 +132,7 @@ interface IExtensibilityService { * @returns {IExtensionCommandInfo} Information about the extension and the registered command. */ getExtensionNameWhereCommandIsRegistered( - inputOpts: IGetExtensionCommandInfoParams + inputOpts: IGetExtensionCommandInfoParams, ): Promise; /** diff --git a/lib/common/definitions/mobile.d.ts b/lib/common/definitions/mobile.d.ts index 74d0fb9a2b..0d4b58638b 100644 --- a/lib/common/definitions/mobile.d.ts +++ b/lib/common/definitions/mobile.d.ts @@ -131,7 +131,7 @@ declare global { appId: string, projectName: string, projectDir: string, - ensureAppStarted?: boolean + ensureAppStarted?: boolean, ): Promise; destroyDebugSocket(appId: string): Promise; openDeviceLogStream(options?: IiOSLogStreamOptions): Promise; @@ -146,7 +146,7 @@ declare global { interface IAndroidDeviceFileSystem extends IDeviceFileSystem { getDeviceHashService( - appIdentifier: string + appIdentifier: string, ): Mobile.IAndroidDeviceHashService; } @@ -240,7 +240,7 @@ declare global { */ setProjectNameForDevice( deviceIdentifier: string, - projectName: string + projectName: string, ): void; /** @@ -250,7 +250,7 @@ declare global { */ setProjectDirForDevice( deviceIdentifier: string, - projectDir: string + projectDir: string, ): void; } @@ -293,7 +293,7 @@ declare global { */ startLogProcess( deviceId: string, - options?: Mobile.IiOSLogStreamOptions + options?: Mobile.IiOSLogStreamOptions, ): Promise; } @@ -317,7 +317,7 @@ declare global { filterData( platform: string, data: string, - deviceLogOptions: Mobile.IDeviceLogOptions + deviceLogOptions: Mobile.IDeviceLogOptions, ): string; } @@ -334,7 +334,7 @@ declare global { replaceWithOriginalFileLocations( platform: string, messageData: string, - loggingOptions: Mobile.IDeviceLogOptions + loggingOptions: Mobile.IDeviceLogOptions, ): string; } @@ -351,7 +351,7 @@ declare global { */ filterData( data: string, - deviceLogOptions: Mobile.IDeviceLogOptions + deviceLogOptions: Mobile.IDeviceLogOptions, ): string; } @@ -380,13 +380,13 @@ declare global { installApplication( packageFilePath: string, appIdentifier?: string, - buildData?: IBuildData + buildData?: IBuildData, ): Promise; uninstallApplication(appIdentifier: string): Promise; reinstallApplication( appIdentifier: string, packageFilePath: string, - buildData?: IBuildData + buildData?: IBuildData, ): Promise; startApplication(appData: IStartApplicationData): Promise; stopApplication(appData: IApplicationData): Promise; @@ -395,7 +395,7 @@ declare global { tryStartApplication(appData: IApplicationData): Promise; getDebuggableApps(): Promise; getDebuggableAppViews( - appIdentifiers: string[] + appIdentifiers: string[], ): Promise>; /** * Sets the files transferred on device. @@ -432,34 +432,34 @@ declare global { getFile( deviceFilePath: string, appIdentifier: string, - outputFilePath?: string + outputFilePath?: string, ): Promise; getFileContent( deviceFilePath: string, - appIdentifier: string + appIdentifier: string, ): Promise; putFile( localFilePath: string, deviceFilePath: string, - appIdentifier: string + appIdentifier: string, ): Promise; deleteFile(deviceFilePath: string, appIdentifier: string): Promise; transferFiles( deviceAppData: Mobile.IDeviceAppData, - localToDevicePaths: Mobile.ILocalToDevicePathData[] + localToDevicePaths: Mobile.ILocalToDevicePathData[], ): Promise; transferDirectory( deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], - projectFilesPath: string + projectFilesPath: string, ): Promise; transferFile?( localFilePath: string, - deviceFilePath: string + deviceFilePath: string, ): Promise; createFileOnDevice?( deviceFilePath: string, - fileContent: string + fileContent: string, ): Promise; /** * Updates the hash file on device with the current hashes of files. @@ -468,7 +468,7 @@ declare global { */ updateHashesOnDevice( hashes: IStringDictionary, - appIdentifier: string + appIdentifier: string, ): Promise; } @@ -483,11 +483,11 @@ declare global { interface IAndroidDebugBridge { executeCommand( args: string[], - options?: IAndroidDebugBridgeCommandOptions + options?: IAndroidDebugBridgeCommandOptions, ): Promise; executeShellCommand( args: string[], - options?: IAndroidDebugBridgeCommandOptions + options?: IAndroidDebugBridgeCommandOptions, ): Promise; pushFile(localFilePath: string, deviceFilePath: string): Promise; removeFile(deviceFilePath: string): Promise; @@ -514,7 +514,7 @@ declare global { interface IDeviceAndroidDebugBridge extends IAndroidDebugBridge { sendBroadcastToDevice( action: string, - extras?: IStringDictionary + extras?: IStringDictionary, ): Promise; } @@ -557,7 +557,7 @@ declare global { skipEmulatorStart?: boolean; /** * Currently available only for iOS. Specifies the sdk version of the iOS simulator. - * In case when `tns run ios --device "iPhone 6"` command is executed, the user can specify the sdk of the simulator because it is possible to have more than one device with the same name but with different sdk versions. + * In case when `ns run ios --device "iPhone 6"` command is executed, the user can specify the sdk of the simulator because it is possible to have more than one device with the same name but with different sdk versions. */ sdk?: string; @@ -587,7 +587,7 @@ declare global { execute( action: (device: Mobile.IDevice) => Promise, canExecute?: (dev: Mobile.IDevice) => boolean, - options?: { allowNoDevices?: boolean } + options?: { allowNoDevices?: boolean }, ): Promise[]>; /** @@ -622,7 +622,7 @@ declare global { deviceIdentifiers: string[], appIdentifier: string, framework: string, - projectDir: string + projectDir: string, ): Promise[]; setLogLevel(logLevel: string, deviceIdentifier?: string): void; deployOnDevices( @@ -630,20 +630,20 @@ declare global { packageFile: string, packageName: string, framework: string, - projectDir: string + projectDir: string, ): Promise[]; getDeviceByIdentifier(identifier: string): Mobile.IDevice; mapAbstractToTcpPort( deviceIdentifier: string, appIdentifier: string, - framework: string + framework: string, ): Promise; getDebuggableApps( - deviceIdentifiers: string[] + deviceIdentifiers: string[], ): Promise[]; getDebuggableViews( deviceIdentifier: string, - appIdentifier: string + appIdentifier: string, ): Promise; /** @@ -659,7 +659,7 @@ declare global { * @returns {Promise} Dictionary with the following format: { ios: { devices: Mobile.IDeviceInfo[], errors: string[] }, android: { devices: Mobile.IDeviceInfo[], errors: string[]}}. */ getEmulatorImages( - options?: Mobile.IListEmulatorsOptions + options?: Mobile.IListEmulatorsOptions, ): Promise; /** @@ -674,11 +674,11 @@ declare global { * prompts the user for a manual choice or returns the first one for non interactive terminals. */ pickSingleDevice( - options: IPickSingleDeviceOptions + options: IPickSingleDeviceOptions, ): Promise; getPlatformsFromDeviceDescriptors( - deviceDescriptors: ILiveSyncDeviceDescriptor[] + deviceDescriptors: ILiveSyncDeviceDescriptor[], ): string[]; } @@ -734,7 +734,7 @@ declare global { mapAbstractToTcpPort( deviceIdentifier: string, appIdentifier: string, - framework: string + framework: string, ): Promise; /** @@ -743,7 +743,7 @@ declare global { * @return {Mobile.IDeviceApplicationInformation[]} Returns array of applications information for the applications which are available for debugging. */ getDebuggableApps( - deviceIdentifier: string + deviceIdentifier: string, ): Promise; /** @@ -756,7 +756,7 @@ declare global { getMappedAbstractToTcpPorts( deviceIdentifier: string, appIdentifiers: string[], - framework: string + framework: string, ): Promise>; /** @@ -767,7 +767,7 @@ declare global { */ getAppProcessId( deviceIdentifier: string, - appIdentifier: string + appIdentifier: string, ): Promise; /** @@ -778,7 +778,7 @@ declare global { * @returns {number} The TCP port that is used for the forwarding. */ forwardFreeTcpToAbstractPort( - portForwardInputData: IPortForwardData + portForwardInputData: IPortForwardData, ): Promise; } @@ -840,7 +840,7 @@ declare global { fileName: string, localProjectRootPath: string, onDeviceFileName: string, - deviceProjectRootPath: string + deviceProjectRootPath: string, ): Mobile.ILocalToDevicePathData; } @@ -895,7 +895,7 @@ declare global { * @returns {Promise} Starts the emulator and returns the errors if some error occurs. */ startEmulator( - options: Mobile.IStartEmulatorOptions + options: Mobile.IStartEmulatorOptions, ): Promise; /** @@ -916,7 +916,7 @@ declare global { * Returns array of all available android emulators - genymotion and native avd emulators and array of errors. */ getEmulatorImages( - adbDevicesOutput: string[] + adbDevicesOutput: string[], ): Promise; /** * Gets all identifiers of all running android emulators. @@ -967,7 +967,7 @@ declare global { * @returns {Promise} - Returns a dictionary in the following format: { properties: string; error?: string; } */ enumerateGuestProperties( - id: string + id: string, ): Promise; } @@ -1012,7 +1012,7 @@ declare global { */ parseIniFile( iniFilePath: string, - avdInfo?: Mobile.IAvdInfo + avdInfo?: Mobile.IAvdInfo, ): Mobile.IAvdInfo; } @@ -1056,7 +1056,7 @@ declare global { launchApplication( applicationPath: string, appIdentifier: string, - options: IiOSSimLaunchApplicationOptions + options: IiOSSimLaunchApplicationOptions, ): Promise; printDeviceTypes(): Promise; sendNotification(notification: string, deviceId: string): Promise; @@ -1104,7 +1104,7 @@ declare global { interface IiOSSimulatorService extends IEmulatorPlatformService { postDarwinNotification( notification: string, - deviceId: string + deviceId: string, ): Promise; /** @@ -1206,34 +1206,34 @@ declare global { getDeviceFileContent( device: Mobile.IDevice, deviceFilePath: string, - projectData: IProjectData + projectData: IProjectData, ): Promise; } interface IEmulatorHelper { mapAndroidApiLevelToVersion: IStringDictionary; getEmulatorsFromAvailableEmulatorsOutput( - availableEmulatorsOutput: Mobile.IListEmulatorsOutput + availableEmulatorsOutput: Mobile.IListEmulatorsOutput, ): Mobile.IDeviceInfo[]; getErrorsFromAvailableEmulatorsOutput( - availableEmulatorsOutput: Mobile.IListEmulatorsOutput + availableEmulatorsOutput: Mobile.IListEmulatorsOutput, ): string[]; getEmulatorByImageIdentifier( imageIdentifier: string, - emulators: Mobile.IDeviceInfo[] + emulators: Mobile.IDeviceInfo[], ): Mobile.IDeviceInfo; getEmulatorByIdOrName( emulatorIdOrName: string, - emulators: Mobile.IDeviceInfo[] + emulators: Mobile.IDeviceInfo[], ): Mobile.IDeviceInfo; getEmulatorByStartEmulatorOptions( options: Mobile.IStartEmulatorOptions, - emulators: Mobile.IDeviceInfo[] + emulators: Mobile.IDeviceInfo[], ): Mobile.IDeviceInfo; isEmulatorRunning(emulator: Mobile.IDeviceInfo): boolean; setRunningAndroidEmulatorProperties( emulatorId: string, - emulator: Mobile.IDeviceInfo + emulator: Mobile.IDeviceInfo, ): void; } @@ -1286,13 +1286,13 @@ declare global { * Computes the shasums of localToDevicePaths and updates hash file on device */ updateHashes( - localToDevicePaths: Mobile.ILocalToDevicePathData[] + localToDevicePaths: Mobile.ILocalToDevicePathData[], ): Promise; /** * Computes the shasums of localToDevicePaths and removes them from hash file on device */ removeHashes( - localToDevicePaths: Mobile.ILocalToDevicePathData[] + localToDevicePaths: Mobile.ILocalToDevicePathData[], ): Promise; /** @@ -1309,7 +1309,7 @@ declare global { */ generateHashesFromLocalToDevicePaths( localToDevicePaths: Mobile.ILocalToDevicePathData[], - initialShasums?: IStringDictionary + initialShasums?: IStringDictionary, ): Promise; /** @@ -1318,7 +1318,7 @@ declare global { * @returns {string[]} DevicePaths of all elements from the input localToDevicePaths. */ getDevicePaths( - localToDevicePaths: Mobile.ILocalToDevicePathData[] + localToDevicePaths: Mobile.ILocalToDevicePathData[], ): string[]; /** @@ -1329,7 +1329,7 @@ declare global { */ getChangedShasums( oldShasums: IStringDictionary, - currentShasums: IStringDictionary + currentShasums: IStringDictionary, ): IStringDictionary; } @@ -1371,7 +1371,7 @@ declare global { */ handleErrors( errors: IAndroidDebugBridgeError[], - treatErrorsAsWarnings?: boolean + treatErrorsAsWarnings?: boolean, ): void; } @@ -1401,77 +1401,77 @@ declare global { install( ipaPath: string, deviceIdentifiers: string[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; uninstall( appIdentifier: string, deviceIdentifiers: string[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; startLookingForDevices( deviceFoundCallback: DeviceInfoCallback, deviceUpdatedCallback: DeviceInfoCallback, deviceLostCallback: DeviceInfoCallback, - options?: Mobile.IDeviceLookingOptions + options?: Mobile.IDeviceLookingOptions, ): Promise; startDeviceLog(deviceIdentifier: string): void; apps( deviceIdentifiers: string[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; listDirectory( listArray: IOSDeviceLib.IReadOperationData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; readFiles( deviceFilePaths: IOSDeviceLib.IReadOperationData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; downloadFiles( deviceFilePaths: IOSDeviceLib.IFileOperationData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; uploadFiles( files: IOSDeviceLib.IUploadFilesData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; deleteFiles( deleteArray: IOSDeviceLib.IDeleteFileData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; start( startArray: IOSDeviceLib.IIOSApplicationData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; stop( stopArray: IOSDeviceLib.IIOSApplicationData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; postNotification( postNotificationArray: IOSDeviceLib.IPostNotificationData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; awaitNotificationResponse( awaitNotificationResponseArray: IOSDeviceLib.IAwaitNotificatioNResponseData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise; connectToPort( connectToPortArray: IOSDeviceLib.IConnectToPortData[], - errorHandler?: DeviceOperationErrorHandler + errorHandler?: DeviceOperationErrorHandler, ): Promise>; setShouldDispose(shouldDispose: boolean): void; @@ -1480,7 +1480,7 @@ declare global { type DeviceOperationErrorHandler = (err: IOSDeviceLib.IDeviceError) => void; type DeviceInfoCallback = ( - deviceInfo: IOSDeviceLib.IDeviceActionInfo + deviceInfo: IOSDeviceLib.IDeviceActionInfo, ) => void; type IOSDeviceResponse = IDictionary; diff --git a/lib/common/mobile/android/android-application-manager.ts b/lib/common/mobile/android/android-application-manager.ts index b5fc2d2216..fb8b46e350 100644 --- a/lib/common/mobile/android/android-application-manager.ts +++ b/lib/common/mobile/android/android-application-manager.ts @@ -36,7 +36,7 @@ export class AndroidApplicationManager extends ApplicationManagerBase { protected $deviceLogProvider: Mobile.IDeviceLogProvider, private $errors: IErrors, $logger: ILogger, - $hooksService: IHooksService + $hooksService: IHooksService, ) { super($logger, $hooksService, $deviceLogProvider); } @@ -58,7 +58,7 @@ export class AndroidApplicationManager extends ApplicationManagerBase { public async installApplication( packageFilePath: string, appIdentifier?: string, - buildData?: IAndroidBuildData + buildData?: IAndroidBuildData, ): Promise { if (appIdentifier) { const deviceRootPath = `${LiveSyncPaths.ANDROID_TMP_DIR_NAME}/${appIdentifier}`; @@ -85,15 +85,15 @@ export class AndroidApplicationManager extends ApplicationManagerBase { } public uninstallApplication(appIdentifier: string): Promise { - // Need to set the treatErrorsAsWarnings to true because when using tns run command if the application is not installed on the device it will throw error + // Need to set the treatErrorsAsWarnings to true because when using `ns run` command if the application is not installed on the device it will throw error return this.adb.executeShellCommand( ["pm", "uninstall", `${appIdentifier}`], - { treatErrorsAsWarnings: true } + { treatErrorsAsWarnings: true }, ); } public async startApplication( - appData: Mobile.IStartApplicationData + appData: Mobile.IStartApplicationData, ): Promise { if (appData.waitForDebugger) { await this.adb.executeShellCommand([ @@ -144,7 +144,7 @@ export class AndroidApplicationManager extends ApplicationManagerBase { ]); } else { this.$logger.trace( - `Tried starting activity for: ${appIdentifier}, using activity manager but failed.` + `Tried starting activity for: ${appIdentifier}, using activity manager but failed.`, ); await this.adb.executeShellCommand([ "monkey", @@ -165,22 +165,22 @@ export class AndroidApplicationManager extends ApplicationManagerBase { const deviceIdentifier = this.identifier; const processIdentifier = await this.getAppProcessId( deviceIdentifier, - appIdentifier + appIdentifier, ); if (processIdentifier) { this.$deviceLogProvider.setApplicationPidForDevice( deviceIdentifier, - processIdentifier + processIdentifier, ); this.$deviceLogProvider.setApplicationIdForDevice( deviceIdentifier, - appIdentifier + appIdentifier, ); this.$deviceLogProvider.setProjectDirForDevice( deviceIdentifier, - appData.projectDir + appData.projectDir, ); await this.$logcatHelper.start({ @@ -196,7 +196,7 @@ export class AndroidApplicationManager extends ApplicationManagerBase { } else { await this.$logcatHelper.dump(this.identifier); this.$errors.fail( - `Unable to find running "${appIdentifier}" application on device "${deviceIdentifier}".` + `Unable to find running "${appIdentifier}" application on device "${deviceIdentifier}".`, ); } } @@ -204,7 +204,7 @@ export class AndroidApplicationManager extends ApplicationManagerBase { private async getAppProcessId( deviceIdentifier: string, - appIdentifier: string + appIdentifier: string, ) { const appIdCheckStartTime = new Date().getTime(); let processIdentifier = ""; @@ -213,11 +213,11 @@ export class AndroidApplicationManager extends ApplicationManagerBase { while (!processIdentifier && !hasTimedOut) { processIdentifier = await this.$androidProcessService.getAppProcessId( deviceIdentifier, - appIdentifier + appIdentifier, ); if (!processIdentifier) { this.$logger.trace( - `Wasn't able to get pid of the app. Sleeping for "${this.PID_CHECK_INTERVAL}ms".` + `Wasn't able to get pid of the app. Sleeping for "${this.PID_CHECK_INTERVAL}ms".`, ); await sleep(this.PID_CHECK_INTERVAL); hasTimedOut = @@ -244,13 +244,13 @@ export class AndroidApplicationManager extends ApplicationManagerBase { } public async getDebuggableAppViews( - appIdentifiers: string[] + appIdentifiers: string[], ): Promise> { const mappedAppIdentifierPorts = await this.$androidProcessService.getMappedAbstractToTcpPorts( this.identifier, appIdentifiers, - TARGET_FRAMEWORK_IDENTIFIERS.Cordova + TARGET_FRAMEWORK_IDENTIFIERS.Cordova, ), applicationViews: IDictionary = {}; @@ -269,11 +269,11 @@ export class AndroidApplicationManager extends ApplicationManagerBase { } } catch (err) { this.$logger.trace( - `Error while checking ${localAddress}. Error is: ${err.message}` + `Error while checking ${localAddress}. Error is: ${err.message}`, ); } - } - ) + }, + ), ); return applicationViews; @@ -286,9 +286,9 @@ export class AndroidApplicationManager extends ApplicationManagerBase { return new RegExp( `${regExpEscape( - appIdentifier + appIdentifier, )}${packageActivitySeparator}${fullJavaClassName}`, - `m` + `m`, ); } diff --git a/lib/common/mobile/mobile-core/devices-service.ts b/lib/common/mobile/mobile-core/devices-service.ts index 003b8898d8..15bf11787f 100644 --- a/lib/common/mobile/mobile-core/devices-service.ts +++ b/lib/common/mobile/mobile-core/devices-service.ts @@ -567,7 +567,7 @@ export class DevicesService /** * Returns device depending on the passed index. - * The index refers to assigned number to listed devices by tns device command. + * The index refers to assigned number to listed devices by ns device command. * @param index assigned device number */ private getDeviceByIndex(index: number): Mobile.IDevice { diff --git a/lib/common/yok.ts b/lib/common/yok.ts index cfadfaa888..cf06c51445 100644 --- a/lib/common/yok.ts +++ b/lib/common/yok.ts @@ -70,7 +70,7 @@ export class Yok implements IInjector { public requireCommand(names: any, file: string): void { forEachName(names, (commandName) => { const commands = commandName.split( - CommandsDelimiters.HierarchicalCommand + CommandsDelimiters.HierarchicalCommand, ); if (commands.length > 1) { @@ -79,7 +79,7 @@ export class Yok implements IInjector { this.modules[this.createCommandName(commands[0])] ) { throw new Error( - "Default commands should be required before child commands" + "Default commands should be required before child commands", ); } @@ -90,7 +90,7 @@ export class Yok implements IInjector { } this.hierarchicalCommands[parentCommandName].push( - _.tail(commands).join(CommandsDelimiters.HierarchicalCommand) + _.tail(commands).join(CommandsDelimiters.HierarchicalCommand), ); } @@ -164,7 +164,7 @@ export class Yok implements IInjector { const relativePath = path.join("../", file); const dependency: IDependency = { require: require("fs").existsSync( - path.join(__dirname, relativePath + ".js") + path.join(__dirname, relativePath + ".js"), ) ? relativePath : file, @@ -197,8 +197,8 @@ export class Yok implements IInjector { const subCommands = this.hierarchicalCommands[name]; const defaultCommand = _.find(subCommands, (command) => _.some(command.split(CommandsDelimiters.HierarchicalCommand), (c) => - _.startsWith(c, CommandsDelimiters.DefaultCommandSymbol) - ) + _.startsWith(c, CommandsDelimiters.DefaultCommandSymbol), + ), ); return defaultCommand; @@ -206,7 +206,7 @@ export class Yok implements IInjector { public buildHierarchicalCommand( parentCommandName: string, - commandLineArguments: string[] + commandLineArguments: string[], ): any { let currentSubCommandName: string, finalSubCommandName: string, @@ -226,7 +226,7 @@ export class Yok implements IInjector { (sc) => sc === currentSubCommandName || sc === - `${CommandsDelimiters.DefaultCommandSymbol}${currentSubCommandName}` + `${CommandsDelimiters.DefaultCommandSymbol}${currentSubCommandName}`, )) ) { finalSubCommandName = matchingSubCommandName; @@ -244,8 +244,8 @@ export class Yok implements IInjector { .map((command) => _.startsWith(command, CommandsDelimiters.DefaultCommandSymbol) ? command.substr(1) - : command - ) + : command, + ), ); } @@ -253,7 +253,7 @@ export class Yok implements IInjector { return { commandName: this.getHierarchicalCommandName( parentCommandName, - finalSubCommandName + finalSubCommandName, ), remainingArguments: finalRemainingArguments, }; @@ -274,7 +274,7 @@ export class Yok implements IInjector { if (args.length > 0) { const hierarchicalCommand = this.buildHierarchicalCommand( name, - args + args, ); if (hierarchicalCommand) { commandName = hierarchicalCommand.commandName; @@ -284,11 +284,11 @@ export class Yok implements IInjector { ? this.getHierarchicalCommandName(name, defaultCommand) : "help"; // If we'll execute the default command, but it's full name had been written by the user - // for example "tns run ios", we have to remove the "ios" option from the arguments that we'll pass to the command. + // for example "ns run ios", we have to remove the "ios" option from the arguments that we'll pass to the command. if ( _.includes( this.hierarchicalCommands[name], - CommandsDelimiters.DefaultCommandSymbol + args[0] + CommandsDelimiters.DefaultCommandSymbol + args[0], ) ) { commandArguments = _.tail(args); @@ -301,7 +301,7 @@ export class Yok implements IInjector { if (defaultCommand) { commandName = this.getHierarchicalCommandName( name, - defaultCommand + defaultCommand, ); } else { commandName = "help"; @@ -314,7 +314,7 @@ export class Yok implements IInjector { await commandsService.tryExecuteCommand( commandName, - commandName === "help" ? [name] : commandArguments + commandName === "help" ? [name] : commandArguments, ); }, }; @@ -325,23 +325,23 @@ export class Yok implements IInjector { private getHierarchicalCommandName( parentCommandName: string, - subCommandName: string + subCommandName: string, ) { return [parentCommandName, subCommandName].join( - CommandsDelimiters.HierarchicalCommand + CommandsDelimiters.HierarchicalCommand, ); } public async isValidHierarchicalCommand( commandName: string, - commandArguments: string[] + commandArguments: string[], ): Promise { if (_.includes(Object.keys(this.hierarchicalCommands), commandName)) { const subCommands = this.hierarchicalCommands[commandName]; if (subCommands) { const fullCommandName = this.buildHierarchicalCommand( commandName, - commandArguments + commandArguments, ); if (!fullCommandName) { // In case buildHierarchicalCommand doesn't find a valid command @@ -449,7 +449,7 @@ export class Yok implements IInjector { private resolveConstructor( ctor: any, - ctorArguments?: { [key: string]: any } + ctorArguments?: { [key: string]: any }, ): any { annotate(ctor); @@ -530,10 +530,10 @@ export class Yok implements IInjector { public getRegisteredCommandsNames(includeDev: boolean): string[] { const modulesNames: string[] = _.keys(this.modules); const commandsNames: string[] = _.filter(modulesNames, (moduleName) => - _.startsWith(moduleName, `${this.COMMANDS_NAMESPACE}.`) + _.startsWith(moduleName, `${this.COMMANDS_NAMESPACE}.`), ); let commands = _.map(commandsNames, (commandName: string) => - commandName.substr(this.COMMANDS_NAMESPACE.length + 1) + commandName.substr(this.COMMANDS_NAMESPACE.length + 1), ); if (!includeDev) { commands = _.reject(commands, (command) => _.startsWith(command, "dev-")); @@ -544,10 +544,10 @@ export class Yok implements IInjector { public getRegisteredKeyCommandsNames(): string[] { const modulesNames: string[] = _.keys(this.modules); const commandsNames: string[] = _.filter(modulesNames, (moduleName) => - _.startsWith(moduleName, `${this.KEY_COMMANDS_NAMESPACE}.`) + _.startsWith(moduleName, `${this.KEY_COMMANDS_NAMESPACE}.`), ); let commands = _.map(commandsNames, (commandName: string) => - commandName.substr(this.KEY_COMMANDS_NAMESPACE.length + 1) + commandName.substr(this.KEY_COMMANDS_NAMESPACE.length + 1), ); return commands; } diff --git a/lib/services/extensibility-service.ts b/lib/services/extensibility-service.ts index 395dbd0a03..eff1fb0f0a 100644 --- a/lib/services/extensibility-service.ts +++ b/lib/services/extensibility-service.ts @@ -41,11 +41,11 @@ export class ExtensibilityService implements IExtensibilityService { private $logger: ILogger, private $packageManager: INodePackageManager, private $settingsService: ISettingsService, - private $requireService: IRequireService + private $requireService: IRequireService, ) {} public async installExtension( - extensionName: string + extensionName: string, ): Promise { this.$logger.trace(`Start installation of extension '${extensionName}'.`); @@ -62,10 +62,10 @@ export class ExtensibilityService implements IExtensibilityService { const installResultInfo = await this.$packageManager.install( packageName, this.pathToExtensions, - npmOpts + npmOpts, ); this.$logger.trace( - `Finished installation of extension '${extensionName}'. Trying to load it now.` + `Finished installation of extension '${extensionName}'. Trying to load it now.`, ); return this.getInstalledExtensionData(installResultInfo.name); @@ -79,11 +79,11 @@ export class ExtensibilityService implements IExtensibilityService { await this.$packageManager.uninstall( extensionName, { save: true }, - this.pathToExtensions + this.pathToExtensions, ); this.$logger.trace( - `Finished uninstallation of extension '${extensionName}'.` + `Finished uninstallation of extension '${extensionName}'.`, ); } @@ -95,7 +95,7 @@ export class ExtensibilityService implements IExtensibilityService { public getInstalledExtensionsData(): IExtensionData[] { const installedExtensions = this.getInstalledExtensions(); return _.keys(installedExtensions).map((installedExtension) => - this.getInstalledExtensionData(installedExtension) + this.getInstalledExtensionData(installedExtension), ); } @@ -108,7 +108,7 @@ export class ExtensibilityService implements IExtensibilityService { dependencies = this.getInstalledExtensions(); } catch (err) { this.$logger.trace( - `Error while getting installed dependencies: ${err.message}. No extensions will be loaded.` + `Error while getting installed dependencies: ${err.message}. No extensions will be loaded.`, ); } @@ -148,11 +148,11 @@ export class ExtensibilityService implements IExtensibilityService { return this.getInstalledExtensionData(extensionName); } catch (error) { this.$logger.warn( - `Error while loading ${extensionName} is: ${error.message}` + `Error while loading ${extensionName} is: ${error.message}`, ); const err = ( new Error( - `Unable to load extension ${extensionName}. You will not be able to use the functionality that it adds. Error: ${error.message}` + `Unable to load extension ${extensionName}. You will not be able to use the functionality that it adds. Error: ${error.message}`, ) ); err.extensionName = extensionName; @@ -161,28 +161,28 @@ export class ExtensibilityService implements IExtensibilityService { } public async getExtensionNameWhereCommandIsRegistered( - inputOpts: IGetExtensionCommandInfoParams + inputOpts: IGetExtensionCommandInfoParams, ): Promise { let allExtensions: INpmsSingleResultData[] = []; try { const npmsResult = await this.$packageManager.searchNpms( - "nativescript:extension" + "nativescript:extension", ); allExtensions = npmsResult.results || []; } catch (err) { this.$logger.trace( - `Unable to find extensions via npms. Error is: ${err}` + `Unable to find extensions via npms. Error is: ${err}`, ); return null; } const defaultCommandRegExp = new RegExp( - `${regExpEscape(inputOpts.defaultCommandDelimiter)}.*` + `${regExpEscape(inputOpts.defaultCommandDelimiter)}.*`, ); const commandDelimiterRegExp = createRegExp( inputOpts.commandDelimiter, - "g" + "g", ); for (const extensionData of allExtensions) { @@ -190,9 +190,8 @@ export class ExtensibilityService implements IExtensibilityService { try { // now get full package.json for the latest version of the package - const registryData = await this.$packageManager.getRegistryPackageData( - extensionName - ); + const registryData = + await this.$packageManager.getRegistryPackageData(extensionName); const latestPackageData = registryData.versions[registryData["dist-tags"].latest]; const commands: string[] = @@ -202,12 +201,12 @@ export class ExtensibilityService implements IExtensibilityService { if (commands && commands.length) { // For each default command we need to add its short syntax in the array of commands. // For example in case there's a default command called devices list, the commands array will contain devices|*list. - // However, in case the user executes just tns devices, CLI will still execute the tns devices list command. + // However, in case the user executes just ns devices, CLI will still execute the ns devices list command. // So we need to add the devices command as well. _.filter( commands, (command) => - command.indexOf(inputOpts.defaultCommandDelimiter) !== -1 + command.indexOf(inputOpts.defaultCommandDelimiter) !== -1, ).forEach((defaultCommand) => { commands.push(defaultCommand.replace(defaultCommandRegExp, "")); }); @@ -221,12 +220,12 @@ export class ExtensibilityService implements IExtensibilityService { if (_.some(commands, (c) => c.toLowerCase() === currentCommand)) { const beautifiedCommandName = currentCommand.replace( commandDelimiterRegExp, - " " + " ", ); return { extensionName, registeredCommandName: currentCommand, - installationMessage: `The command ${beautifiedCommandName} is registered in extension ${extensionName}. You can install it by executing 'tns extension install ${extensionName}'`, + installationMessage: `The command ${beautifiedCommandName} is registered in extension ${extensionName}. You can install it by executing 'ns extension install ${extensionName}'`, }; } @@ -236,7 +235,7 @@ export class ExtensibilityService implements IExtensibilityService { } catch (err) { // We do not want to stop the whole process in case we are unable to find data for one of the extensions. this.$logger.trace( - `Unable to get data for ${extensionName}. Error is: ${err}` + `Unable to get data for ${extensionName}. Error is: ${err}`, ); } } @@ -248,7 +247,7 @@ export class ExtensibilityService implements IExtensibilityService { return path.join( this.pathToExtensions, constants.NODE_MODULES_FOLDER_NAME, - extensionName + extensionName, ); } @@ -256,23 +255,23 @@ export class ExtensibilityService implements IExtensibilityService { const pathToExtension = this.getPathToExtension(extensionName); const pathToPackageJson = path.join( pathToExtension, - constants.PACKAGE_JSON_FILE_NAME + constants.PACKAGE_JSON_FILE_NAME, ); const jsonData = this.$fs.readJson(pathToPackageJson); return jsonData; } private async assertExtensionIsInstalled( - extensionName: string + extensionName: string, ): Promise { this.$logger.trace(`Asserting extension ${extensionName} is installed.`); const installedExtensions = this.$fs.readDirectory( - path.join(this.pathToExtensions, constants.NODE_MODULES_FOLDER_NAME) + path.join(this.pathToExtensions, constants.NODE_MODULES_FOLDER_NAME), ); if (installedExtensions.indexOf(extensionName) === -1) { this.$logger.trace( - `Extension ${extensionName} is not installed, starting installation.` + `Extension ${extensionName} is not installed, starting installation.`, ); await this.installExtension(extensionName); } diff --git a/lib/services/pacote-service.ts b/lib/services/pacote-service.ts index 743a1cf75c..847bcb5101 100644 --- a/lib/services/pacote-service.ts +++ b/lib/services/pacote-service.ts @@ -16,7 +16,7 @@ export class PacoteService implements IPacoteService { private $injector: IInjector, private $logger: ILogger, private $npmConfigService: INpmConfigService, - private $proxyService: IProxyService + private $proxyService: IProxyService, ) {} @cache() @@ -27,11 +27,11 @@ export class PacoteService implements IPacoteService { public async manifest( packageName: string, - options?: IPacoteManifestOptions + options?: IPacoteManifestOptions, ): Promise { this.$logger.trace( `Calling pacoteService.manifest for packageName: '${packageName}' and options: `, - options + options, ); const manifestOptions: IPacoteBaseOptions = await this.getPacoteBaseOptions(); @@ -43,7 +43,7 @@ export class PacoteService implements IPacoteService { packageName = this.getRealPackageName(packageName); this.$logger.trace( `Calling pacote.manifest for packageName: ${packageName} and manifestOptions:`, - manifestOptions + manifestOptions, ); const result = await pacote.manifest(packageName, manifestOptions); @@ -55,12 +55,12 @@ export class PacoteService implements IPacoteService { public async extractPackage( packageName: string, destinationDirectory: string, - options?: IPacoteExtractOptions + options?: IPacoteExtractOptions, ): Promise { // strip: Remove the specified number of leading path elements. Pathnames with fewer elements will be silently skipped. More info: https://github.com/npm/node-tar/blob/e89c4d37519b1c20133a9f49d5f6b85fa34c203b/README.md // C: Create an archive this.$logger.trace( - `Calling pacoteService.extractPackage for packageName: '${packageName}', destinationDir: '${destinationDirectory}' and options: ${options}` + `Calling pacoteService.extractPackage for packageName: '${packageName}', destinationDir: '${destinationDirectory}' and options: ${options}`, ); const extractOptions = { strip: 1, C: destinationDirectory }; if (options) { @@ -72,14 +72,14 @@ export class PacoteService implements IPacoteService { return new Promise(async (resolve, reject) => { this.$logger.trace( - `Calling pacoteService.extractPackage for packageName: '${packageName}', destinationDir: '${destinationDirectory}' and options: ${options}` + `Calling pacoteService.extractPackage for packageName: '${packageName}', destinationDir: '${destinationDirectory}' and options: ${options}`, ); const source = await pacote .tarball(packageName, pacoteOptions) .catch((err: Error) => { this.$logger.trace( - `Error in source while trying to extract stream from ${packageName}. Error is ${err}` + `Error in source while trying to extract stream from ${packageName}. Error is ${err}`, ); reject(err); }); @@ -88,8 +88,8 @@ export class PacoteService implements IPacoteService { `Creating extract tar stream with options: ${JSON.stringify( extractOptions, null, - 2 - )}` + 2, + )}`, ); const destination = tar.x(extractOptions); // Initiate the source @@ -99,14 +99,14 @@ export class PacoteService implements IPacoteService { destination.on("error", (err: Error) => { this.$logger.trace( - `Error in destination while trying to extract stream from ${packageName}. Error is ${err}` + `Error in destination while trying to extract stream from ${packageName}. Error is ${err}`, ); reject(err); }); destination.on("finish", () => { this.$logger.trace( - `Successfully extracted '${packageName}' to ${destinationDirectory}` + `Successfully extracted '${packageName}' to ${destinationDirectory}`, ); resolve(); }); @@ -114,7 +114,7 @@ export class PacoteService implements IPacoteService { } private async getPacoteBaseOptions(): Promise { - // In case `tns create myapp --template https://github.com/NativeScript/template-hello-world.git` command is executed, pacote module throws an error if cache option is not provided. + // In case `ns create myapp --template https://github.com/NativeScript/template-hello-world.git` command is executed, pacote module throws an error if cache option is not provided. const cachePath = await this.$packageManager.getCachePath(); // Add NPM Configuration to our Manifest options @@ -131,7 +131,7 @@ export class PacoteService implements IPacoteService { private getRealPackageName(packageName: string): string { if (this.$fs.exists(packageName)) { this.$logger.trace( - `Will resolve the full path to package ${packageName}.` + `Will resolve the full path to package ${packageName}.`, ); packageName = path.resolve(packageName); } diff --git a/packages/doctor/src/sys-info.ts b/packages/doctor/src/sys-info.ts index 7b470601f3..7c71d43491 100644 --- a/packages/doctor/src/sys-info.ts +++ b/packages/doctor/src/sys-info.ts @@ -444,7 +444,7 @@ export class SysInfo implements NativeScriptDoctor.ISysInfo { return this.getValueForProperty( () => this.nativeScriptCliVersionCache, async (): Promise => { - const output = await this.execCommand("tns --version"); + const output = await this.execCommand("ns --version"); return output ? this.getVersionFromCLIOutput(output.trim()) : output; }, ); diff --git a/packages/doctor/test/sys-info.ts b/packages/doctor/test/sys-info.ts index 928cb7f0c4..5b41c32487 100644 --- a/packages/doctor/test/sys-info.ts +++ b/packages/doctor/test/sys-info.ts @@ -82,7 +82,7 @@ const androidToolsInfo: NativeScriptDoctor.IAndroidToolsInfo = { }; function createChildProcessResults( - childProcessResult: IChildProcessResults + childProcessResult: IChildProcessResults, ): IDictionary { return { "uname -a": childProcessResult.uname, @@ -110,7 +110,7 @@ function createChildProcessResults( '"C:\\Program Files/Git/cmd/git.exe" --version': childProcessResult.gitVersion, // When running Windows test on the Non-Windows platform "gradle -v": childProcessResult.gradleVersion, - "tns --version": childProcessResult.nativeScriptCliVersion, + "ns --version": childProcessResult.nativeScriptCliVersion, emulator: { shouldThrowError: false }, "which git": childProcessResult.git, "python3 --version": childProcessResult.pythonInfo, @@ -120,7 +120,7 @@ function createChildProcessResults( function getResultFromChildProcess( childProcessResultDescription: IChildProcessResultDescription, command: string, - options?: ISpawnFromEventOptions + options?: ISpawnFromEventOptions, ): any { if (childProcessResultDescription.shouldThrowError) { if (options && options.ignoreError) { @@ -141,7 +141,7 @@ function getResultFromChildProcess( function mockSysInfo( childProcessResult: IChildProcessResults, hostInfoOptions?: IHostInfoMockOptions, - fileSystemOptions?: IFileSystemMockOptions + fileSystemOptions?: IFileSystemMockOptions, ): SysInfo { hostInfoOptions = hostInfoOptions || {}; const winreg: any = { @@ -149,7 +149,7 @@ function mockSysInfo( valueName: string, hive?: IHiveId, key?: string, - host?: string + host?: string, ) => { return { value: "registryKey" }; }, @@ -170,19 +170,19 @@ function mockSysInfo( exec: async (command: string) => { return getResultFromChildProcess( childProcessResultDictionary[command], - command + command, ); }, spawnFromEvent: async ( command: string, args: string[], event: string, - options: ISpawnFromEventOptions + options: ISpawnFromEventOptions, ) => { return getResultFromChildProcess( childProcessResultDictionary[command], command, - options + options, ); }, execFile: async (): Promise => { @@ -204,7 +204,7 @@ function mockSysInfo( helpers, hostInfo, winreg, - androidToolsInfo + androidToolsInfo, ); } @@ -239,7 +239,7 @@ describe("SysInfo unit tests", () => { spawnFromEvent: async ( command: string, args: string[], - event: string + event: string, ) => { spawnFromEventCommand = `${command} ${args.join(" ")}`; return { stdout: "", stderr: "" }; @@ -271,7 +271,7 @@ describe("SysInfo unit tests", () => { helpers, hostInfo, null, - androidToolsInfo + androidToolsInfo, ); }); @@ -414,7 +414,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), assert.deepEqual(result.javaVersion, "1.8.0_202"); assert.deepEqual( result.nodeGypVer, - childProcessResult.nodeGypVersion.result.stdout + childProcessResult.nodeGypVersion.result.stdout, ); assert.deepEqual(result.adbVer, "1.0.32"); assert.deepEqual(result.androidInstalled, true); @@ -423,7 +423,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), assert.deepEqual(result.gitVer, "1.9.5"); assert.deepEqual( result.nativeScriptCliVersion, - childProcessResult.nativeScriptCliVersion.result.stdout + childProcessResult.nativeScriptCliVersion.result.stdout, ); }; @@ -439,7 +439,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), sysInfo = mockSysInfo( childProcessResult, { isWindows: true, isDarwin: false, dotNetVersion }, - { existsResult: true } + { existsResult: true }, ); const result = await sysInfo.getSysInfo(); process.env[PROGRAM_FILES] = originalProgramFiles; @@ -459,7 +459,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), assert.deepEqual(result.xcodeVer, "6.4.0"); assert.deepEqual( result.cocoaPodsVer, - childProcessResult.podVersion.result.stdout + childProcessResult.podVersion.result.stdout, ); }); @@ -554,7 +554,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), sysInfo = mockSysInfo( childProcessResult, { isWindows: false, isDarwin: false, dotNetVersion: "4.5.1" }, - null + null, ); const adbVersion = await sysInfo.getAdbVersion(); const isAndroidSdkConfiguredCorrectly = @@ -569,7 +569,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), sysInfo = mockSysInfo( childProcessResult, { isWindows: true, isDarwin: false, dotNetVersion: "4.5.1" }, - null + null, ); const pythonInfo = await sysInfo.getPythonInfo(); assert.deepEqual(pythonInfo, null); @@ -578,7 +578,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), sysInfo = mockSysInfo( childProcessResult, { isWindows: false, isDarwin: false, dotNetVersion: "4.5.1" }, - null + null, ); const pythonInfo = await sysInfo.getPythonInfo(); assert.deepEqual(pythonInfo, null); @@ -588,7 +588,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), sysInfo = mockSysInfo( childProcessResult, { isWindows: false, isDarwin: true, dotNetVersion: "4.5.1" }, - null + null, ); const pythonInfo = await sysInfo.getPythonInfo(); assert.deepEqual(pythonInfo, { @@ -600,7 +600,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), sysInfo = mockSysInfo( childProcessResult, { isWindows: false, isDarwin: true, dotNetVersion: "4.5.1" }, - null + null, ); const pythonInfo = await sysInfo.getPythonInfo(); assert.deepEqual(pythonInfo, { @@ -636,7 +636,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), testData.forEach((testCase) => { describe(testCase.testedProperty, () => { - it("is null when tns is not installed", async () => { + it("is null when ns is not installed", async () => { childProcessResult[testCase.testedProperty] = { shouldThrowError: true, }; @@ -665,7 +665,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)`), it("is correct when there are warnings in the command's output", async () => { childProcessResult[testCase.testedProperty] = { result: setStdOut( - `Some warning due to invalid extensions${EOL}3.0.0` + `Some warning due to invalid extensions${EOL}3.0.0`, ), }; sysInfo = mockSysInfo(childProcessResult, { @@ -790,17 +790,17 @@ ${expectedCliVersion}`; assert.deepEqual(result.nodeVer, "6.0.0"); assert.deepEqual( result.nodeGypVer, - childProcessResult.nodeGypVersion.result.stdout + childProcessResult.nodeGypVersion.result.stdout, ); assert.deepEqual(result.gitVer, "1.9.5"); assert.deepEqual( result.nativeScriptCliVersion, - childProcessResult.nativeScriptCliVersion.result.stdout + childProcessResult.nativeScriptCliVersion.result.stdout, ); }; const assertAndroidSysInfo = ( - result: NativeScriptDoctor.IAndroidSysInfoData + result: NativeScriptDoctor.IAndroidSysInfoData, ) => { assert.deepEqual(result.adbVer, "1.0.32"); assert.deepEqual(result.androidInstalled, false); @@ -847,7 +847,7 @@ ${expectedCliVersion}`; sysInfo = mockSysInfo( childProcessResult, { isWindows: false, isDarwin: true, dotNetVersion }, - { existsResult: true } + { existsResult: true }, ); const result = await sysInfo.getSysInfo({ platform: "Android" }); diff --git a/packages/doctor/typings/interfaces.ts b/packages/doctor/typings/interfaces.ts index 1d873a78b8..ca63f2985b 100644 --- a/packages/doctor/typings/interfaces.ts +++ b/packages/doctor/typings/interfaces.ts @@ -212,7 +212,7 @@ declare module NativeScriptDoctor { canExecuteLocalBuild( platform: string, projectDir?: string, - runtimeVersion?: string + runtimeVersion?: string, ): Promise; /** @@ -271,7 +271,7 @@ declare module NativeScriptDoctor { */ gitVer: string; /** - * NativeScript CLI version string, as returned by `tns --version`. + * NativeScript CLI version string, as returned by `ns --version`. * @type {string} */ nativeScriptCliVersion: string; @@ -492,7 +492,7 @@ declare module NativeScriptDoctor { validateJavacVersion( installedJavaVersion: string, projectDir?: string, - runtimeVersion?: string + runtimeVersion?: string, ): NativeScriptDoctor.IWarning[]; /** @@ -513,7 +513,7 @@ declare module NativeScriptDoctor { * @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return []. */ validateMinSupportedTargetSdk( - options: ITargetValidationOptions + options: ITargetValidationOptions, ): NativeScriptDoctor.IWarning[]; /** @@ -522,7 +522,7 @@ declare module NativeScriptDoctor { * @return {NativeScriptDoctor.IWarning[]} An array of errors from the validation checks. If there are no errors will return []. */ validataMaxSupportedTargetSdk( - options: ITargetValidationOptions + options: ITargetValidationOptions, ): NativeScriptDoctor.IWarning[]; /** diff --git a/test/controllers/add-platform-controller.ts b/test/controllers/add-platform-controller.ts index cc2b9e62ae..f7680f789f 100644 --- a/test/controllers/add-platform-controller.ts +++ b/test/controllers/add-platform-controller.ts @@ -45,7 +45,7 @@ function createInjector(data?: { latestFrameworkVersion: string }) { logger.info = (message: string) => (actualMessage = message); const packageInstallationManager = injector.resolve( - "packageInstallationManager" + "packageInstallationManager", ); packageInstallationManager.getLatestCompatibleVersion = async () => version; @@ -68,11 +68,11 @@ const projectDir = "/my/test/dir"; describe("PlatformController", () => { const testCases = [ { - name: "should add the platform (tns platform add @7.0.0)", + name: "should add the platform (ns platform add @7.0.0)", latestFrameworkVersion: "7.0.0", }, { - name: "should add the latest compatible version (tns platform add )", + name: "should add the latest compatible version (ns platform add )", latestFrameworkVersion, getPlatformParam: (platform: string) => `${platform}@${latestFrameworkVersion}`, @@ -117,7 +117,7 @@ describe("PlatformController", () => { const frameworkPath = "invalidPath"; const errorMessage = format( AddPlaformErrors.InvalidFrameworkPathStringFormat, - frameworkPath + frameworkPath, ); const injector = createInjector(); @@ -129,7 +129,7 @@ describe("PlatformController", () => { await assert.isRejected( platformController.addPlatform({ projectDir, platform, frameworkPath }), - errorMessage + errorMessage, ); }); @@ -185,7 +185,7 @@ describe("PlatformController", () => { assert(writeFileCalled, "expected to write gradle.properties"); assert( writeFileContents.includes("# App configuration"), - "expected gradle.properties to have the project data written to it" + "expected gradle.properties to have the project data written to it", ); }); }); diff --git a/test/services/extensibility-service.ts b/test/services/extensibility-service.ts index e538d7dd5e..a23e267988 100644 --- a/test/services/extensibility-service.ts +++ b/test/services/extensibility-service.ts @@ -966,7 +966,7 @@ describe("extensibilityService", () => { .replace( /\|/g, " ", - )} is registered in extension ${extensionName}. You can install it by executing 'tns extension install ${extensionName}'`; + )} is registered in extension ${extensionName}. You can install it by executing 'ns extension install ${extensionName}'`; }; const testData: ITestData[] = [ diff --git a/test/tns-appstore-upload.ts b/test/tns-appstore-upload.ts index 57f216f424..2fac17b6ab 100644 --- a/test/tns-appstore-upload.ts +++ b/test/tns-appstore-upload.ts @@ -55,26 +55,26 @@ class AppStore { errors: {}, fs: {}, hostInfo: {}, - itmsTransporterService: this.itmsTransporterService = {}, - logger: this.loggerService = new LoggerStub(), - options: this.options = {}, - prompter: this.prompter = new PrompterStub(), - projectData: this.projectData = new ProjectDataStub(), + itmsTransporterService: (this.itmsTransporterService = {}), + logger: (this.loggerService = new LoggerStub()), + options: (this.options = {}), + prompter: (this.prompter = new PrompterStub()), + projectData: (this.projectData = new ProjectDataStub()), stringParameterBuilder: {}, devicePlatformsConstants: { iOS: "iOS", }, - prepareNativePlatformService: this.prepareNativePlatformService = < + prepareNativePlatformService: (this.prepareNativePlatformService = < any - >{}, - platformCommandHelper: this.platformCommandHelper = {}, - platformValidationService: this.platformValidationService = {}, - buildController: this.buildController = { + >{}), + platformCommandHelper: (this.platformCommandHelper = {}), + platformValidationService: (this.platformValidationService = {}), + buildController: (this.buildController = { buildPlatform: async () => { this.archiveCalls++; return "/Users/person/git/MyProject/platforms/ios/archive/MyProject.ipa"; }, - }, + }), platformsDataService: { getPlatformData: (platform: string) => { chai.assert.equal(platform, "iOS"); @@ -117,12 +117,12 @@ class AppStore { chai.assert.equal( this.archiveCalls, this.expectedArchiveCalls, - "Mismatched number of iOSProjectService.archive calls." + "Mismatched number of iOSProjectService.archive calls.", ); chai.assert.equal( this.itmsTransporterServiceUploadCalls, this.expectedItmsTransporterServiceUploadCalls, - "Mismatched number of itmsTransporterService.upload calls." + "Mismatched number of itmsTransporterService.upload calls.", ); } @@ -140,7 +140,7 @@ class AppStore { chai.assert.equal(iOSBuildData.projectDir, "/Users/person/git/MyProject"); chai.assert.isTrue(iOSBuildData.buildForAppStore); return Promise.resolve( - "/Users/person/git/MyProject/platforms/ios/archive/MyProject.ipa" + "/Users/person/git/MyProject/platforms/ios/archive/MyProject.ipa", ); }; } @@ -152,15 +152,15 @@ class AppStore { this.itmsTransporterServiceUploadCalls++; chai.assert.equal( options.ipaFilePath, - "/Users/person/git/MyProject/platforms/ios/archive/MyProject.ipa" + "/Users/person/git/MyProject/platforms/ios/archive/MyProject.ipa", ); chai.assert.equal( options.credentials.username, - AppStore.itunesconnect.user + AppStore.itunesconnect.user, ); chai.assert.equal( options.credentials.password, - AppStore.itunesconnect.pass + AppStore.itunesconnect.pass, ); chai.assert.equal(options.verboseLogging, false); return Promise.resolve(); @@ -202,7 +202,7 @@ class AppStore { } } -describe("tns appstore", () => { +describe("ns appstore", () => { it("without args, prompts for itunesconnect credentionals, prepares, archives and uploads", async () => { const instance = new AppStore(); instance.before();