Skip to content

Commit be043b4

Browse files
author
Dimitar Kerezov
committed
PR fixes vol 2
1 parent cae2d19 commit be043b4

File tree

8 files changed

+36
-20
lines changed

8 files changed

+36
-20
lines changed

lib/commands/plugin/update-plugin.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export class UpdatePluginCommand implements ICommand {
1313
pluginNames = installedPlugins.map(p => p.name);
1414
}
1515

16-
for (let p of pluginNames) {
17-
await this.$pluginsService.remove(p, this.$projectData);
18-
await this.$pluginsService.add(p, this.$projectData);
16+
for (let pluginName of pluginNames) {
17+
await this.$pluginsService.remove(pluginName, this.$projectData);
18+
await this.$pluginsService.add(pluginName, this.$projectData);
1919
}
2020
}
2121

lib/declarations.ts

+9
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,19 @@ interface ILiveSyncService {
5757
interface INativeScriptDeviceLiveSyncService extends IDeviceLiveSyncServiceBase {
5858
/**
5959
* Refreshes the application's content on a device
60+
* @param {Mobile.IDeviceAppData} deviceAppData Information about the application and the device.
61+
* @param {Mobile.ILocalToDevicePathData[]} localToDevicePaths Object containing a mapping of file paths from the system to the device.
62+
* @param {boolean} forceExecuteFullSync If this is passed a full LiveSync is performed instead of an incremental one.
63+
* @param {string} projectId Project identifier - for example org.nativescript.livesync.
64+
* @return {Promise<void>}
6065
*/
6166
refreshApplication(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], forceExecuteFullSync: boolean, projectId: string): Promise<void>;
6267
/**
6368
* Removes specified files from a connected device
69+
* @param {string} appIdentifier Application identifier.
70+
* @param {Mobile.ILocalToDevicePathData[]} localToDevicePaths Object containing a mapping of file paths from the system to the device.
71+
* @param {string} projectId Project identifier - for example org.nativescript.livesync.
72+
* @return {Promise<void>}
6473
*/
6574
removeFiles(appIdentifier: string, localToDevicePaths: Mobile.ILocalToDevicePathData[], projectId: string): Promise<void>;
6675
afterInstallApplicationAction?(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], projectId: string): Promise<boolean>;

lib/definitions/platform.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ interface IPlatformService extends NodeJS.EventEmitter {
8383
* When finishes, saves .nsbuildinfo in application root folder to indicate the prepare that was used to build the app.
8484
* * .nsbuildinfo is not persisted when building for release.
8585
* @param {Mobile.IDevice} device The device where the application should be installed.
86-
* @param {boolean} release Whether the application was built in release configuration.
86+
* @param {IRelease} options Whether the application was built in release configuration.
8787
* @param {IProjectData} projectData DTO with information about the project.
8888
* @returns {void}
8989
*/
90-
installApplication(device: Mobile.IDevice, release: boolean, projectData: IProjectData): Promise<void>;
90+
installApplication(device: Mobile.IDevice, options: IRelease, projectData: IProjectData): Promise<void>;
9191

9292
/**
9393
* Gets first chance to validate the options provided as command line arguments.

lib/definitions/project.d.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,19 @@ interface IProjectTemplatesService {
113113
prepareTemplate(templateName: string, projectDir: string): Promise<string>;
114114
}
115115

116+
interface Ceco extends NodeJS.EventEmitter {
117+
118+
}
119+
116120
interface IPlatformProjectServiceBase {
117121
getPluginPlatformsFolderPath(pluginData: IPluginData, platform: string): string;
118122
}
119123

120-
interface IBuildConfig extends IAndroidBuildOptionsSettings {
124+
interface IBuildForDevice {
121125
buildForDevice: boolean;
126+
}
127+
128+
interface IBuildConfig extends IAndroidBuildOptionsSettings, IBuildForDevice {
122129
projectDir: string;
123130
clean?: boolean;
124131
architectures?: string[];

lib/options.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class Options extends commonOptionsLibPath.OptionsBase {
4040
chrome: { type: OptionType.Boolean },
4141
clean: { type: OptionType.Boolean },
4242
watch: { type: OptionType.Boolean, default: true }
43-
},
43+
},
4444
path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
4545
$errors, $staticConfig);
4646

lib/services/livesync/platform-livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export abstract class PlatformLiveSyncServiceBase implements IPlatformLiveSyncSe
175175
await this.$platformService.buildPlatform(platform, buildConfig, projectData);
176176
}
177177

178-
await this.$platformService.installApplication(device, this.$options.release, projectData);
178+
await this.$platformService.installApplication(device, buildConfig, projectData);
179179
deviceAppData = this.$deviceAppDataFactory.create(this.liveSyncData.appIdentifier, this.$mobileHelper.normalizePlatformName(this.liveSyncData.platform), device);
180180
isFullSync = true;
181181
} else {

lib/services/platform-service.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
336336
return true;
337337
}
338338
let prepareInfo = this.$projectChangesService.getPrepareInfo(platform, projectData);
339-
let buildInfo = this.getBuildInfo(platform, platformData, buildConfig.buildForDevice);
339+
let buildInfo = this.getBuildInfo(platform, platformData, buildConfig);
340340
if (!prepareInfo || !buildInfo) {
341341
return true;
342342
}
@@ -370,7 +370,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
370370
});
371371
await platformData.platformProjectService.buildProject(platformData.projectRoot, projectData, buildConfig);
372372
let prepareInfo = this.$projectChangesService.getPrepareInfo(platform, projectData);
373-
let buildInfoFilePath = this.getBuildOutputPath(platform, platformData, buildConfig.buildForDevice);
373+
let buildInfoFilePath = this.getBuildOutputPath(platform, platformData, buildConfig);
374374
let buildInfoFile = path.join(buildInfoFilePath, buildInfoFileName);
375375
let buildInfo: IBuildInfo = {
376376
prepareTime: prepareInfo.changesRequireBuildTime,
@@ -387,11 +387,11 @@ export class PlatformService extends EventEmitter implements IPlatformService {
387387
return true;
388388
}
389389
let deviceBuildInfo: IBuildInfo = await this.getDeviceBuildInfo(device, projectData);
390-
let localBuildInfo = this.getBuildInfo(platform, platformData, !device.isEmulator);
390+
let localBuildInfo = this.getBuildInfo(platform, platformData, { buildForDevice: !device.isEmulator });
391391
return !localBuildInfo || !deviceBuildInfo || deviceBuildInfo.buildTime !== localBuildInfo.buildTime;
392392
}
393393

394-
public async installApplication(device: Mobile.IDevice, release: boolean, projectData: IProjectData): Promise<void> {
394+
public async installApplication(device: Mobile.IDevice, options: IRelease, projectData: IProjectData): Promise<void> {
395395
this.$logger.out("Installing...");
396396
let platformData = this.$platformsData.getPlatformData(device.deviceInfo.platform, projectData);
397397
let packageFile = "";
@@ -405,9 +405,9 @@ export class PlatformService extends EventEmitter implements IPlatformService {
405405

406406
await device.applicationManager.reinstallApplication(projectData.projectId, packageFile);
407407

408-
if (!release) {
408+
if (!options.release) {
409409
let deviceFilePath = await this.getDeviceBuildInfoFilePath(device, projectData);
410-
let buildInfoFilePath = this.getBuildOutputPath(device.deviceInfo.platform, platformData, !device.isEmulator);
410+
let buildInfoFilePath = this.getBuildOutputPath(device.deviceInfo.platform, platformData, { buildForDevice: !device.isEmulator });
411411
let appIdentifier = projectData.projectId;
412412

413413
await device.fileSystem.putFile(path.join(buildInfoFilePath, buildInfoFileName), deviceFilePath, appIdentifier);
@@ -434,7 +434,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
434434
}
435435

436436
if (deployOptions.forceInstall || shouldBuild || (await this.shouldInstall(device, projectData))) {
437-
await this.installApplication(device, deployOptions.release, projectData);
437+
await this.installApplication(device, deployOptions, projectData);
438438
} else {
439439
this.$logger.out("Skipping install.");
440440
}
@@ -492,9 +492,9 @@ export class PlatformService extends EventEmitter implements IPlatformService {
492492
return this.runPlatform(platform, emulateOptions, projectData);
493493
}
494494

495-
private getBuildOutputPath(platform: string, platformData: IPlatformData, buildForDevice: boolean): string {
495+
private getBuildOutputPath(platform: string, platformData: IPlatformData, options: IBuildForDevice): string {
496496
if (platform.toLowerCase() === this.$devicePlatformsConstants.iOS.toLowerCase()) {
497-
return buildForDevice ? platformData.deviceBuildOutputPath : platformData.emulatorBuildOutputPath;
497+
return options.buildForDevice ? platformData.deviceBuildOutputPath : platformData.emulatorBuildOutputPath;
498498
}
499499

500500
return platformData.deviceBuildOutputPath;
@@ -515,8 +515,8 @@ export class PlatformService extends EventEmitter implements IPlatformService {
515515
}
516516
}
517517

518-
private getBuildInfo(platform: string, platformData: IPlatformData, buildForDevice: boolean): IBuildInfo {
519-
let buildInfoFilePath = this.getBuildOutputPath(platform, platformData, buildForDevice);
518+
private getBuildInfo(platform: string, platformData: IPlatformData, options: IBuildForDevice): IBuildInfo {
519+
let buildInfoFilePath = this.getBuildOutputPath(platform, platformData, options);
520520
let buildInfoFile = path.join(buildInfoFilePath, buildInfoFileName);
521521
if (this.$fs.exists(buildInfoFile)) {
522522
try {

test/stubs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ export class PlatformServiceStub extends EventEmitter implements IPlatformServic
617617
return true;
618618
}
619619

620-
public installApplication(device: Mobile.IDevice, release: boolean): Promise<void> {
620+
public installApplication(device: Mobile.IDevice, options: IRelease): Promise<void> {
621621
return Promise.resolve();
622622
}
623623

0 commit comments

Comments
 (0)