Skip to content

Commit 08bb4a8

Browse files
committed
refactor: remove modulesChange property
modulesChange property was used to indicate .js change in node_modules but webpack watches for changes in `.js` files from node_modules if they are required in application, so no more need from this property.
1 parent 2ea0e8f commit 08bb4a8

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

lib/definitions/project-changes.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ interface IPrepareInfo extends IAddedNativePlatform, IAppFilesHashes {
1414

1515
interface IProjectChangesInfo extends IAddedNativePlatform {
1616
appResourcesChanged: boolean;
17-
modulesChanged: boolean;
1817
configChanged: boolean;
1918
packageChanged: boolean;
2019
nativeChanged: boolean;

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ export class PrepareNativePlatformService implements IPrepareNativePlatformServi
2121

2222
const changesInfo = await this.$projectChangesService.checkForChanges(platformData, projectData, prepareData);
2323

24-
const hasModulesChange = !changesInfo || changesInfo.modulesChanged;
24+
const hasNativeModulesChange = !changesInfo || changesInfo.nativeChanged;
25+
const hasPackageChange = !changesInfo || changesInfo.packageChanged;
2526
const hasConfigChange = !changesInfo || changesInfo.configChanged;
2627
const hasChangesRequirePrepare = !changesInfo || changesInfo.changesRequirePrepare;
2728

28-
const hasChanges = hasModulesChange || hasConfigChange || hasChangesRequirePrepare;
29+
const hasChanges = hasNativeModulesChange || hasPackageChange || hasConfigChange || hasChangesRequirePrepare;
2930

3031
if (changesInfo.hasChanges) {
3132
await this.cleanProject(platformData, projectData, { release });
@@ -37,11 +38,11 @@ export class PrepareNativePlatformService implements IPrepareNativePlatformServi
3738
await platformData.platformProjectService.prepareProject(projectData, prepareData);
3839
}
3940

40-
if (hasModulesChange) {
41+
if (hasNativeModulesChange || hasPackageChange) {
4142
await this.$nodeModulesBuilder.prepareNodeModules(platformData, projectData);
4243
}
4344

44-
if (hasModulesChange || hasConfigChange) {
45+
if (hasNativeModulesChange || hasPackageChange || hasConfigChange) {
4546
await platformData.platformProjectService.processConfigurationFilesFromAppResources(projectData, { release });
4647
await platformData.platformProjectService.handleNativeDependenciesChange(projectData, { release });
4748
}

lib/services/project-changes-service.ts

+2-15
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const prepareInfoFileName = ".nsprepareinfo";
88
class ProjectChangesInfo implements IProjectChangesInfo {
99

1010
public appResourcesChanged: boolean;
11-
public modulesChanged: boolean;
1211
public configChanged: boolean;
1312
public packageChanged: boolean;
1413
public nativeChanged: boolean;
@@ -18,7 +17,6 @@ class ProjectChangesInfo implements IProjectChangesInfo {
1817
public get hasChanges(): boolean {
1918
return this.packageChanged ||
2019
this.appResourcesChanged ||
21-
this.modulesChanged ||
2220
this.configChanged ||
2321
this.signingChanged;
2422
}
@@ -78,11 +76,6 @@ export class ProjectChangesService implements IProjectChangesService {
7876

7977
this.$logger.trace(`Set nativeChanged to ${this._changesInfo.nativeChanged}.`);
8078

81-
if (this._newFiles > 0 || this._changesInfo.nativeChanged) {
82-
this.$logger.trace(`Setting modulesChanged to true, newFiles: ${this._newFiles}, nativeChanged: ${this._changesInfo.nativeChanged}`);
83-
this._changesInfo.modulesChanged = true;
84-
}
85-
8679
if (platformData.platformNameLowerCase === this.$devicePlatformsConstants.iOS.toLowerCase()) {
8780
this._changesInfo.configChanged = this.filesChanged([path.join(platformResourcesDir, platformData.configurationFileName),
8881
path.join(platformResourcesDir, "LaunchScreen.storyboard"),
@@ -105,16 +98,11 @@ export class ProjectChangesService implements IProjectChangesService {
10598
if (prepareData.release !== this._prepareInfo.release) {
10699
this.$logger.trace(`Setting all setting to true. Current options are: `, prepareData, " old prepare info is: ", this._prepareInfo);
107100
this._changesInfo.appResourcesChanged = true;
108-
this._changesInfo.modulesChanged = true;
109101
this._changesInfo.configChanged = true;
110102
this._prepareInfo.release = prepareData.release;
111103
}
112-
if (this._changesInfo.packageChanged) {
113-
this.$logger.trace("Set modulesChanged to true as packageChanged is true");
114-
this._changesInfo.modulesChanged = true;
115-
}
116-
if (this._changesInfo.modulesChanged || this._changesInfo.appResourcesChanged) {
117-
this.$logger.trace(`Set configChanged to true, current value of moduleChanged is: ${this._changesInfo.modulesChanged}, appResourcesChanged is: ${this._changesInfo.appResourcesChanged}`);
104+
if (this._changesInfo.appResourcesChanged) {
105+
this.$logger.trace(`Set configChanged to true, appResourcesChanged is: ${this._changesInfo.appResourcesChanged}`);
118106
this._changesInfo.configChanged = true;
119107
}
120108
if (this._changesInfo.hasChanges) {
@@ -195,7 +183,6 @@ export class ProjectChangesService implements IProjectChangesService {
195183
this._outputProjectCTime = 0;
196184
this._changesInfo = this._changesInfo || new ProjectChangesInfo();
197185
this._changesInfo.appResourcesChanged = true;
198-
this._changesInfo.modulesChanged = true;
199186
this._changesInfo.configChanged = true;
200187
return true;
201188
}

0 commit comments

Comments
 (0)