Skip to content

Commit f925e24

Browse files
committed
fix: save correct .nsprepareinfo file from cloud commands
1 parent f7f47a3 commit f925e24

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

lib/controllers/prepare-controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class PrepareController extends EventEmitter {
4747
result = { hasNativeChanges, platform: prepareData.platform.toLowerCase() };
4848
}
4949

50-
this.$projectChangesService.savePrepareInfo(platformData);
50+
await this.$projectChangesService.savePrepareInfo(platformData, projectData, prepareData);
5151

5252
this.$logger.info(`Project successfully prepared (${prepareData.platform.toLowerCase()})`);
5353

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class AddPlatformService implements IAddPlatformService {
6161
platformData.platformProjectService.ensureConfigurationFileInAppResources(projectData);
6262
await platformData.platformProjectService.interpolateData(projectData);
6363
platformData.platformProjectService.afterCreateProject(platformData.projectRoot, projectData);
64-
this.$projectChangesService.setNativePlatformStatus(platformData, { nativePlatformStatus: NativePlatformStatus.requiresPrepare });
64+
await this.$projectChangesService.setNativePlatformStatus(platformData, projectData, { nativePlatformStatus: NativePlatformStatus.requiresPrepare });
6565
}
6666
}
6767
$injector.register("addPlatformService", AddPlatformService);

lib/services/platform/prepare-native-platform-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class PrepareNativePlatformService implements IPrepareNativePlatformServi
4747
}
4848

4949
platformData.platformProjectService.interpolateConfigurationFile(projectData);
50-
this.$projectChangesService.setNativePlatformStatus(platformData, { nativePlatformStatus: NativePlatformStatus.alreadyPrepared });
50+
await this.$projectChangesService.setNativePlatformStatus(platformData, projectData, { nativePlatformStatus: NativePlatformStatus.alreadyPrepared });
5151

5252
return hasChanges;
5353
}

lib/services/project-changes-service.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@ export class ProjectChangesService implements IProjectChangesService {
136136
return prepareInfo;
137137
}
138138

139-
public savePrepareInfo(platformData: IPlatformData): void {
139+
public async savePrepareInfo(platformData: IPlatformData, projectData: IProjectData, prepareData: IPrepareData): Promise<void> {
140+
if (!this._prepareInfo) {
141+
await this.ensurePrepareInfo(platformData, projectData, prepareData);
142+
}
143+
140144
const prepareInfoFilePath = this.getPrepareInfoFilePath(platformData);
141145
this.$fs.writeJson(prepareInfoFilePath, this._prepareInfo);
142146
}
143147

144-
public setNativePlatformStatus(platformData: IPlatformData, addedPlatform: IAddedNativePlatform): void {
148+
public async setNativePlatformStatus(platformData: IPlatformData, projectData: IProjectData, addedPlatform: IAddedNativePlatform): Promise<void> {
145149
this._prepareInfo = this._prepareInfo || this.getPrepareInfo(platformData);
146150
if (this._prepareInfo && addedPlatform.nativePlatformStatus === NativePlatformStatus.alreadyPrepared) {
147151
this._prepareInfo.nativePlatformStatus = addedPlatform.nativePlatformStatus;
@@ -151,7 +155,7 @@ export class ProjectChangesService implements IProjectChangesService {
151155
};
152156
}
153157

154-
this.savePrepareInfo(platformData);
158+
await this.savePrepareInfo(platformData, projectData, null);
155159
}
156160

157161
private async ensurePrepareInfo(platformData: IPlatformData, projectData: IProjectData, prepareData: PrepareData): Promise<boolean> {

lib/services/webpack/webpack.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ declare global {
1919
checkForChanges(platformData: IPlatformData, projectData: IProjectData, prepareData: IPrepareData): Promise<IProjectChangesInfo>;
2020
getPrepareInfoFilePath(platformData: IPlatformData): string;
2121
getPrepareInfo(platformData: IPlatformData): IPrepareInfo;
22-
savePrepareInfo(platformData: IPlatformData): void;
23-
setNativePlatformStatus(platformData: IPlatformData, addedPlatform: IAddedNativePlatform): void;
22+
savePrepareInfo(platformData: IPlatformData, projectData: IProjectData, prepareData: IPrepareData): Promise<void>;
23+
setNativePlatformStatus(platformData: IPlatformData, projectData: IProjectData, addedPlatform: IAddedNativePlatform): void;
2424
currentChanges: IProjectChangesInfo;
2525
}
2626

0 commit comments

Comments
 (0)