From b0a926bf5a15aa3b5ec76b2cf188474d059ab5e6 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Thu, 16 May 2024 18:40:35 +0200 Subject: [PATCH 1/5] chore: speculatively bundle fsevents to fix https://github.com/NativeScript/NativeScript/issues/10509 --- package-lock.json | 4 +++- package.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0d76d30b6f..329dba9e44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,8 @@ "version": "8.7.1", "bundleDependencies": [ "@npmcli/move-file", - "stringify-package" + "stringify-package", + "fsevents" ], "hasInstallScript": true, "license": "Apache-2.0", @@ -5354,6 +5355,7 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "hasInstallScript": true, + "inBundle": true, "optional": true, "os": [ "darwin" diff --git a/package.json b/package.json index 5b58702a1e..43fc82ee8e 100644 --- a/package.json +++ b/package.json @@ -183,7 +183,8 @@ "bundleDependencies_comment3": "note: @npmcli/move-file is a transient dep of pacote - we dont use it directly.", "bundleDependencies": [ "@npmcli/move-file", - "stringify-package" + "stringify-package", + "fsevents" ], "overrides": { "jimp": { From 9d2ec7cb6a12ea10439ea287991812645a156473 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Mon, 20 May 2024 17:03:13 +0200 Subject: [PATCH 2/5] chore: cleanup package.json, and mark fsevents as optional --- .prettierrc.json | 10 +++++++++- package.json | 25 +++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 661f253672..3c53558cd9 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,3 +1,11 @@ { - "useTabs": true + "useTabs": true, + "overrides": [ + { + "files": "*.json", + "options": { + "useTabs": false + } + } + ] } diff --git a/package.json b/package.json index 43fc82ee8e..97079d5748 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "preferGlobal": true, + "main": "./lib/nativescript-cli-lib.js", "version": "8.7.1", "author": "NativeScript ", "description": "Command-line interface for building NativeScript projects", @@ -10,7 +10,6 @@ "nsc": "./bin/tns", "ns": "./bin/tns" }, - "main": "./lib/nativescript-cli-lib.js", "files": [ "bin/*", "config", @@ -117,7 +116,6 @@ "xml2js": "0.6.2", "yargs": "17.7.1" }, - "analyze": true, "devDependencies": { "@types/archiver": "^5.3.2", "@types/byline": "^4.2.33", @@ -171,21 +169,16 @@ "sinon": "15.0.3", "source-map-support": "0.5.21" }, - "license": "Apache-2.0", - "engines": { - "node": ">=10.0.0" - }, - "lint-staged": { - "*.ts": "prettier --write" - }, "bundleDependencies_comment1": "These dependencies are bundled in the CLI and are not installed from npm to avoid deprecation warnings.", "bundleDependencies_comment2": "Eventually we'll remove them as we replaced their functionality.", "bundleDependencies_comment3": "note: @npmcli/move-file is a transient dep of pacote - we dont use it directly.", "bundleDependencies": [ "@npmcli/move-file", - "stringify-package", - "fsevents" + "stringify-package" ], + "optionalDependencies": { + "fsevents": "*" + }, "overrides": { "jimp": { "xml2js": "0.6.2" @@ -193,5 +186,13 @@ "npm-watch": { "nodemon": "3.0.3" } + }, + "analyze": true, + "license": "Apache-2.0", + "engines": { + "node": ">=14.0.0" + }, + "lint-staged": { + "*.ts": "prettier --write" } } From bac14c06568c7a0538618d9ca1e369a56dd272b5 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Mon, 20 May 2024 22:29:38 +0200 Subject: [PATCH 3/5] feat: don't uninstall app by default --- lib/common/mobile/application-manager-base.ts | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/common/mobile/application-manager-base.ts b/lib/common/mobile/application-manager-base.ts index d5daf3a7ce..c61e89a6bd 100644 --- a/lib/common/mobile/application-manager-base.ts +++ b/lib/common/mobile/application-manager-base.ts @@ -6,7 +6,8 @@ import * as _ from "lodash"; export abstract class ApplicationManagerBase extends EventEmitter - implements Mobile.IDeviceApplicationManager { + implements Mobile.IDeviceApplicationManager +{ private lastInstalledAppIdentifiers: string[]; private lastAvailableDebuggableApps: Mobile.IDeviceApplicationInformation[]; private lastAvailableDebuggableAppViews: IDictionary< @@ -36,7 +37,7 @@ export abstract class ApplicationManagerBase appIdentifier ); - if (isApplicationInstalled) { + if (isApplicationInstalled && buildData?.clean) { await this.uninstallApplication(appIdentifier); } @@ -65,7 +66,8 @@ export abstract class ApplicationManagerBase // use locking, so the next executions will not get into the body, while the first one is still working. // In case we do not break the next executions, we'll report each app as newly installed several times. try { - const currentlyInstalledAppIdentifiers = await this.getInstalledApplications(); + const currentlyInstalledAppIdentifiers = + await this.getInstalledApplications(); const previouslyInstalledAppIdentifiers = this.lastInstalledAppIdentifiers || []; @@ -122,9 +124,7 @@ export abstract class ApplicationManagerBase appIdentifier?: string, buildData?: IBuildData ): Promise; - public abstract uninstallApplication( - appIdentifier: string - ): Promise; + public abstract uninstallApplication(appIdentifier: string): Promise; public abstract startApplication( appData: Mobile.IApplicationData ): Promise; @@ -190,9 +190,8 @@ export abstract class ApplicationManagerBase _.each( currentlyAvailableAppViews, (currentlyAvailableViews, appIdentifier) => { - const previouslyAvailableViews = this.lastAvailableDebuggableAppViews[ - appIdentifier - ]; + const previouslyAvailableViews = + this.lastAvailableDebuggableAppViews[appIdentifier]; const newAvailableViews = _.differenceBy( currentlyAvailableViews, @@ -229,9 +228,8 @@ export abstract class ApplicationManagerBase } }); - this.lastAvailableDebuggableAppViews[ - appIdentifier - ] = currentlyAvailableViews; + this.lastAvailableDebuggableAppViews[appIdentifier] = + currentlyAvailableViews; } ); } From 7287f6099b55022f517498dcb9cf3bc0ec6fe970 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Mon, 20 May 2024 23:28:27 +0200 Subject: [PATCH 4/5] chore: adjust test cases --- .../mobile/application-manager-base.ts | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/common/test/unit-tests/mobile/application-manager-base.ts b/lib/common/test/unit-tests/mobile/application-manager-base.ts index 9da40e8e6c..a2cf93db77 100644 --- a/lib/common/test/unit-tests/mobile/application-manager-base.ts +++ b/lib/common/test/unit-tests/mobile/application-manager-base.ts @@ -321,9 +321,8 @@ describe("ApplicationManagerBase", () => { currentlyAvailableAppsForDebugging, numberOfViewsPerApp ); - const currentDebuggableViews: IDictionary< - Mobile.IDebugWebViewInfo[] - > = {}; + const currentDebuggableViews: IDictionary = + {}; applicationManager.on( "debuggableViewFound", (appIdentifier: string, d: Mobile.IDebugWebViewInfo) => { @@ -368,9 +367,8 @@ describe("ApplicationManagerBase", () => { const expectedResults = _.cloneDeep( currentlyAvailableAppWebViewsForDebugging ); - const currentDebuggableViews: IDictionary< - Mobile.IDebugWebViewInfo[] - > = {}; + const currentDebuggableViews: IDictionary = + {}; applicationManager .checkForApplicationUpdates() @@ -819,9 +817,8 @@ describe("ApplicationManagerBase", () => { removedApps = removedApps.concat(currentlyRemovedApps); const currentlyAddedApps = [`app${index}`]; - currentlyInstalledApps = currentlyInstalledApps.concat( - currentlyAddedApps - ); + currentlyInstalledApps = + currentlyInstalledApps.concat(currentlyAddedApps); installedApps = installedApps.concat(currentlyAddedApps); await testInstalledAppsResults(); @@ -1004,7 +1001,11 @@ describe("ApplicationManagerBase", () => { applicationManager.isApplicationInstalled = (appIdentifier: string) => Promise.resolve(true); - await applicationManager.reinstallApplication("appId", "packageFilePath"); + await applicationManager.reinstallApplication( + "appId", + "packageFilePath", + { clean: true } as any + ); assert.deepStrictEqual(uninstallApplicationAppIdParam, "appId"); }); @@ -1047,7 +1048,11 @@ describe("ApplicationManagerBase", () => { return Promise.resolve(); }; - await applicationManager.reinstallApplication("appId", "packageFilePath"); + await applicationManager.reinstallApplication( + "appId", + "packageFilePath", + { clean: true } as any + ); assert.isTrue( isUninstallApplicationCalled, From a64f25b16a619b2966ae588dd1299cc05ca2f107 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Tue, 28 May 2024 23:55:23 +0200 Subject: [PATCH 5/5] release: 8.7.2 --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95d5556ae7..127b0c6380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## [8.7.2](https://github.com/NativeScript/nativescript-cli/compare/v8.7.1...v8.7.2) (2024-05-28) + +### Bug Fixes + +* fix `npm i -g nativescript` on npm 10.4.0+ ([9d2ec7c](https://github.com/NativeScript/nativescript-cli/commit/9d2ec7cb6a12ea10439ea287991812645a156473)) + +### Features + +* don't uninstall app by default ([bac14c0](https://github.com/NativeScript/nativescript-cli/commit/bac14c06568c7a0538618d9ca1e369a56dd272b5)) + + + ## [8.7.1](https://github.com/NativeScript/nativescript-cli/compare/v8.7.0...v8.7.1) (2024-05-16) diff --git a/package.json b/package.json index 97079d5748..d74038d954 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "main": "./lib/nativescript-cli-lib.js", - "version": "8.7.1", + "version": "8.7.2", "author": "NativeScript ", "description": "Command-line interface for building NativeScript projects", "bin": {