Skip to content

Commit 0e60915

Browse files
committed
Merge branch 'main' of github.com:farfromrefug/nativescript-cli
2 parents d3fd9ed + 12df250 commit 0e60915

45 files changed

Lines changed: 655 additions & 491 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierrc.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
{
2-
"useTabs": true
2+
"useTabs": true,
3+
"overrides": [
4+
{
5+
"files": "*.json",
6+
"options": {
7+
"useTabs": false
8+
}
9+
}
10+
]
311
}

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
## [8.7.2](https://github.com/NativeScript/nativescript-cli/compare/v8.7.1...v8.7.2) (2024-05-28)
2+
3+
### Bug Fixes
4+
5+
* fix `npm i -g nativescript` on npm 10.4.0+ ([9d2ec7c](https://github.com/NativeScript/nativescript-cli/commit/9d2ec7cb6a12ea10439ea287991812645a156473))
6+
7+
### Features
8+
9+
* don't uninstall app by default ([bac14c0](https://github.com/NativeScript/nativescript-cli/commit/bac14c06568c7a0538618d9ca1e369a56dd272b5))
10+
11+
12+
13+
## [8.7.1](https://github.com/NativeScript/nativescript-cli/compare/v8.7.0...v8.7.1) (2024-05-16)
14+
15+
16+
### Bug Fixes
17+
18+
* **windows:** make compatible with latest node patch levels ([#5802](https://github.com/NativeScript/nativescript-cli/issues/5802)) ([8795e98](https://github.com/NativeScript/nativescript-cli/commit/8795e98e7876d11ac0032135607fb13bf00d246d))
19+
20+
21+
### Features
22+
23+
* interactive typings generation for android ([#5798](https://github.com/NativeScript/nativescript-cli/issues/5798)) ([d3f2e70](https://github.com/NativeScript/nativescript-cli/commit/d3f2e70101d44a9bc8450c5d0b90419945c2604f))
24+
25+
26+
127
# [8.7.0](https://github.com/NativeScript/nativescript-cli/compare/v8.6.5...v8.7.0) (2024-04-08)
228

329

Gruntfile.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,21 @@ module.exports = function (grunt) {
191191
grunt.file.write(CONFIG_DATA.filePath, stringConfigContent);
192192
}
193193

194-
grunt.registerTask("set_live_ga_id", function () {
195-
setConfig(CONFIG_DATA.gaKey, GA_TRACKING_IDS[ENVIRONMENTS.live]);
196-
});
194+
// grunt.registerTask("set_live_ga_id", function () {
195+
// setConfig(CONFIG_DATA.gaKey, GA_TRACKING_IDS[ENVIRONMENTS.live]);
196+
// });
197197

198-
grunt.registerTask("set_dev_ga_id", function () {
199-
setConfig(CONFIG_DATA.gaKey, GA_TRACKING_IDS[ENVIRONMENTS.dev]);
200-
});
198+
// grunt.registerTask("set_dev_ga_id", function () {
199+
// setConfig(CONFIG_DATA.gaKey, GA_TRACKING_IDS[ENVIRONMENTS.dev]);
200+
// });
201201

202-
grunt.registerTask("verify_live_ga_id", function () {
203-
var configJson = grunt.file.readJSON(CONFIG_DATA.filePath);
202+
// grunt.registerTask("verify_live_ga_id", function () {
203+
// var configJson = grunt.file.readJSON(CONFIG_DATA.filePath);
204204

205-
if (configJson[CONFIG_DATA.gaKey] !== GA_TRACKING_IDS[ENVIRONMENTS.live]) {
206-
throw new Error("Google Analytics id is not configured correctly.");
207-
}
208-
});
205+
// if (configJson[CONFIG_DATA.gaKey] !== GA_TRACKING_IDS[ENVIRONMENTS.live]) {
206+
// throw new Error("Google Analytics id is not configured correctly.");
207+
// }
208+
// });
209209

210210
grunt.registerTask("test", ["ts:devall", "shell:npm_test"]);
211211

@@ -214,15 +214,15 @@ module.exports = function (grunt) {
214214
grunt.registerTask("prepare", [
215215
"clean",
216216
"ts:release_build",
217-
"generate_unit_testing_dependencies",
218-
"verify_unit_testing_dependencies",
219-
"shell:npm_test",
217+
// "generate_unit_testing_dependencies",
218+
// "verify_unit_testing_dependencies",
219+
// "shell:npm_test",
220220

221-
"set_live_ga_id",
222-
"verify_live_ga_id"
221+
// "set_live_ga_id",
222+
// "verify_live_ga_id"
223223
]);
224224
grunt.registerTask("pack", [
225-
"set_package_version",
225+
// "set_package_version",
226226
"shell:build_package"
227227
]);
228228

lib/base-package-manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export abstract class BasePackageManager implements INodePackageManager {
111111
await this.$childProcess.spawnFromEvent(npmExecutable, params, "close", {
112112
cwd: opts.cwd,
113113
stdio: stdioValue,
114+
shell: this.$hostInfo.isWindows,
114115
});
115116

116117
// Whenever calling "npm install" or "yarn add" without any arguments (hence installing all dependencies) no output is emitted on stdout

lib/commands/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
5555
{
5656
...this.$options.argv,
5757
// we disable buildFilterDevicesArch for build only to ensure we dont use it in production builds
58-
buildFilterDevicesArch: false
58+
buildFilterDevicesArch: false,
5959
}
6060
);
6161
const outputPath = await this.$buildController.prepareAndBuild(buildData);

lib/commands/plugin/build-plugin.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ICommand, ICommandParameter } from "../../common/definitions/commands";
1010
import { IErrors, IFileSystem } from "../../common/declarations";
1111
import { injector } from "../../common/yok";
1212
import { ITempService } from "../../definitions/temp-service";
13+
import { IProjectData } from "../../definitions/project";
1314

1415
export class BuildPluginCommand implements ICommand {
1516
public allowedParameters: ICommandParameter[] = [];
@@ -21,7 +22,8 @@ export class BuildPluginCommand implements ICommand {
2122
private $logger: ILogger,
2223
private $fs: IFileSystem,
2324
private $options: IOptions,
24-
private $tempService: ITempService
25+
private $tempService: ITempService,
26+
private $projectData: IProjectData
2527
) {
2628
this.pluginProjectPath = path.resolve(this.$options.path || ".");
2729
}
@@ -50,14 +52,16 @@ export class BuildPluginCommand implements ICommand {
5052
const tempAndroidProject = await this.$tempService.mkdirSync(
5153
"android-project"
5254
);
53-
55+
const gradleArgs = (this.$projectData.nsConfig.android.gradleArgs || []).concat(this.$options.gradleArgs || []);
56+
const pluginOptions = (this.$projectData.nsConfig.android.plugins || {})[pluginName] || {};
5457
const options: IPluginBuildOptions = {
5558
gradlePath: this.$options.gradlePath,
56-
gradleArgs: this.$options.gradleArgs,
59+
gradleArgs,
5760
aarOutputDir: platformsAndroidPath,
5861
platformsAndroidDirPath: platformsAndroidPath,
5962
pluginName: pluginName,
6063
tempPluginDirPath: tempAndroidProject,
64+
...pluginOptions
6165
};
6266

6367
const androidPluginBuildResult = await this.$androidPluginBuildService.buildAar(

lib/commands/typings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class TypingsCommand implements ICommand {
173173
this.$hostInfo.isWindows ? "ns.cmd" : "ns",
174174
["prepare", "android"],
175175
"exit",
176-
{ stdio: "inherit" }
176+
{ stdio: "inherit", shell: this.$hostInfo.isWindows }
177177
);
178178
}
179179

lib/common/mobile/android/android-device.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ interface IAndroidDeviceDetails {
1313
name: string;
1414
release: string;
1515
brand: string;
16-
'cpu.abi': string;
17-
'cpu.abilist64': string;
18-
'cpu.abilist32': string;
16+
"cpu.abi": string;
17+
"cpu.abilist64": string;
18+
"cpu.abilist32": string;
1919
}
2020

2121
interface IAdbDeviceStatusInfo {
@@ -99,7 +99,10 @@ export class AndroidDevice implements Mobile.IAndroidDevice {
9999
identifier: this.identifier,
100100
displayName: details.name,
101101
model: details.model,
102-
abis: details['cpu.abilist64'].split(',').concat(details['cpu.abilist32'].split(',')),
102+
abis: [
103+
...details["cpu.abilist64"].split(","),
104+
...details["cpu.abilist32"].split(","),
105+
],
103106
version,
104107
vendor: details.brand,
105108
platform: this.$devicePlatformsConstants.Android,
@@ -115,12 +118,14 @@ export class AndroidDevice implements Mobile.IAndroidDevice {
115118
: [DeviceConnectionType.USB];
116119

117120
if (this.isEmulator) {
118-
this.deviceInfo.displayName = await this.$androidEmulatorServices.getRunningEmulatorName(
119-
this.identifier
120-
);
121-
this.deviceInfo.imageIdentifier = await this.$androidEmulatorServices.getRunningEmulatorImageIdentifier(
122-
this.identifier
123-
);
121+
this.deviceInfo.displayName =
122+
await this.$androidEmulatorServices.getRunningEmulatorName(
123+
this.identifier
124+
);
125+
this.deviceInfo.imageIdentifier =
126+
await this.$androidEmulatorServices.getRunningEmulatorImageIdentifier(
127+
this.identifier
128+
);
124129
}
125130

126131
this.$logger.trace(this.deviceInfo);
@@ -165,9 +170,10 @@ export class AndroidDevice implements Mobile.IAndroidDevice {
165170
// sample line is "ro.build.version.release=4.4" in /system/build.prop
166171
// sample line from getprop is: [ro.build.version.release]: [6.0]
167172
// NOTE: some props do not have value: [ro.build.version.base_os]: []
168-
const match = /(?:\[?ro\.build\.version|ro\.product|ro\.build)\.(.+?)]?(?:\:|=)(?:\s*?\[)?(.*?)]?$/.exec(
169-
value
170-
);
173+
const match =
174+
/(?:\[?ro\.build\.version|ro\.product|ro\.build)\.(.+?)]?(?:\:|=)(?:\s*?\[)?(.*?)]?$/.exec(
175+
value
176+
);
171177
if (match) {
172178
parsedDetails[match[1]] = match[2];
173179
}
@@ -193,7 +199,8 @@ export class AndroidDevice implements Mobile.IAndroidDevice {
193199
}
194200

195201
private async getType(): Promise<string> {
196-
const runningEmulatorIds = await this.$androidEmulatorServices.getRunningEmulatorIds();
202+
const runningEmulatorIds =
203+
await this.$androidEmulatorServices.getRunningEmulatorIds();
197204
if (
198205
_.find(runningEmulatorIds, (emulatorId) => emulatorId === this.identifier)
199206
) {

lib/common/mobile/android/android-virtual-device-service.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import {
2222
import { injector } from "../../yok";
2323

2424
export class AndroidVirtualDeviceService
25-
implements Mobile.IAndroidVirtualDeviceService {
25+
implements Mobile.IAndroidVirtualDeviceService
26+
{
2627
private androidHome: string;
2728
private mapEmulatorIdToImageIdentifier: IStringDictionary = {};
2829

@@ -211,7 +212,8 @@ export class AndroidVirtualDeviceService
211212
let result: ISpawnResult = null;
212213
let devices: Mobile.IDeviceInfo[] = [];
213214
let errors: string[] = [];
214-
const canExecuteAvdManagerCommand = await this.canExecuteAvdManagerCommand();
215+
const canExecuteAvdManagerCommand =
216+
await this.canExecuteAvdManagerCommand();
215217
if (!canExecuteAvdManagerCommand) {
216218
errors = [
217219
"Unable to execute avdmanager, ensure JAVA_HOME is set and points to correct directory",
@@ -221,7 +223,8 @@ export class AndroidVirtualDeviceService
221223
if (canExecuteAvdManagerCommand) {
222224
result = await this.$childProcess.trySpawnFromCloseEvent(
223225
this.pathToAvdManagerExecutable,
224-
["list", "avds"]
226+
["list", "avds"],
227+
{ shell: this.$hostInfo.isWindows }
225228
);
226229
} else if (
227230
this.pathToAndroidExecutable &&
@@ -403,9 +406,8 @@ export class AndroidVirtualDeviceService
403406
private getAvdManagerDeviceInfo(
404407
output: string
405408
): Mobile.IAvdManagerDeviceInfo {
406-
const avdManagerDeviceInfo: Mobile.IAvdManagerDeviceInfo = Object.create(
407-
null
408-
);
409+
const avdManagerDeviceInfo: Mobile.IAvdManagerDeviceInfo =
410+
Object.create(null);
409411

410412
// Split by `\n`, not EOL as the avdmanager and android executables print results with `\n` only even on Windows
411413
_.reduce(
@@ -437,9 +439,8 @@ export class AndroidVirtualDeviceService
437439
avdFilePath,
438440
AndroidVirtualDevice.CONFIG_INI_FILE_NAME
439441
);
440-
const configIniFileInfo = this.$androidIniFileParser.parseIniFile(
441-
configIniFilePath
442-
);
442+
const configIniFileInfo =
443+
this.$androidIniFileParser.parseIniFile(configIniFilePath);
443444

444445
const iniFilePath = this.getIniFilePath(configIniFileInfo, avdFilePath);
445446
const iniFileInfo = this.$androidIniFileParser.parseIniFile(iniFilePath);

lib/common/mobile/application-manager-base.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import * as _ from "lodash";
66

77
export abstract class ApplicationManagerBase
88
extends EventEmitter
9-
implements Mobile.IDeviceApplicationManager {
9+
implements Mobile.IDeviceApplicationManager
10+
{
1011
private lastInstalledAppIdentifiers: string[];
1112
private lastAvailableDebuggableApps: Mobile.IDeviceApplicationInformation[];
1213
private lastAvailableDebuggableAppViews: IDictionary<
@@ -36,7 +37,7 @@ export abstract class ApplicationManagerBase
3637
appIdentifier
3738
);
3839

39-
if (isApplicationInstalled) {
40+
if (isApplicationInstalled && buildData?.clean) {
4041
await this.uninstallApplication(appIdentifier);
4142
}
4243

@@ -65,7 +66,8 @@ export abstract class ApplicationManagerBase
6566
// use locking, so the next executions will not get into the body, while the first one is still working.
6667
// In case we do not break the next executions, we'll report each app as newly installed several times.
6768
try {
68-
const currentlyInstalledAppIdentifiers = await this.getInstalledApplications();
69+
const currentlyInstalledAppIdentifiers =
70+
await this.getInstalledApplications();
6971
const previouslyInstalledAppIdentifiers =
7072
this.lastInstalledAppIdentifiers || [];
7173

@@ -122,9 +124,7 @@ export abstract class ApplicationManagerBase
122124
appIdentifier?: string,
123125
buildData?: IBuildData
124126
): Promise<void>;
125-
public abstract uninstallApplication(
126-
appIdentifier: string
127-
): Promise<void>;
127+
public abstract uninstallApplication(appIdentifier: string): Promise<void>;
128128
public abstract startApplication(
129129
appData: Mobile.IApplicationData
130130
): Promise<void>;
@@ -190,9 +190,8 @@ export abstract class ApplicationManagerBase
190190
_.each(
191191
currentlyAvailableAppViews,
192192
(currentlyAvailableViews, appIdentifier) => {
193-
const previouslyAvailableViews = this.lastAvailableDebuggableAppViews[
194-
appIdentifier
195-
];
193+
const previouslyAvailableViews =
194+
this.lastAvailableDebuggableAppViews[appIdentifier];
196195

197196
const newAvailableViews = _.differenceBy(
198197
currentlyAvailableViews,
@@ -229,9 +228,8 @@ export abstract class ApplicationManagerBase
229228
}
230229
});
231230

232-
this.lastAvailableDebuggableAppViews[
233-
appIdentifier
234-
] = currentlyAvailableViews;
231+
this.lastAvailableDebuggableAppViews[appIdentifier] =
232+
currentlyAvailableViews;
235233
}
236234
);
237235
}

0 commit comments

Comments
 (0)