Skip to content

Commit fd1ed04

Browse files
committed
fix: skip migration check based on the --force flag
1 parent 4887915 commit fd1ed04

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

lib/commands/build.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
7474

7575
public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
7676
const platform = this.$devicePlatformsConstants.iOS;
77-
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
77+
if (!this.$options.force) {
78+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
79+
}
7880

7981
super.validatePlatform(platform);
8082

@@ -120,7 +122,9 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
120122

121123
public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
122124
const platform = this.$devicePlatformsConstants.Android;
123-
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
125+
if (!this.$options.force) {
126+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
127+
}
124128
this.$androidBundleValidatorHelper.validateRuntimeVersion(this.$projectData);
125129
let result = await super.canExecuteCommandBase(platform, { notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true } });
126130
if (result.canExecute) {

lib/commands/debug.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
5353
}
5454

5555
public async canExecute(args: string[]): Promise<ICanExecuteCommandOutput> {
56-
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [this.platform] });
56+
if (!this.$options.force) {
57+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [this.platform] });
58+
}
5759

5860
this.$androidBundleValidatorHelper.validateNoAab();
5961

lib/commands/prepare.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ export class PrepareCommand extends ValidatePlatformCommandBase implements IComm
3333
const platform = args[0];
3434
const result = await this.$platformCommandParameter.validate(platform) &&
3535
await this.$platformValidationService.validateOptions(this.$options.provision, this.$options.teamId, this.$projectData, platform);
36-
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
36+
37+
if (!this.$options.force) {
38+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [platform] });
39+
}
40+
3741
if (!result) {
3842
return false;
3943
}

lib/commands/preview.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export class PreviewCommand implements ICommand {
4141
this.$errors.fail(`The arguments '${args.join(" ")}' are not valid for the preview command.`);
4242
}
4343

44-
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [] });
44+
if (!this.$options.force) {
45+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [] });
46+
}
4547

4648
await this.$networkConnectivityValidator.validate();
4749
return true;

lib/commands/run.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export class RunCommandBase implements ICommand {
1414
private $hostInfo: IHostInfo,
1515
private $liveSyncCommandHelper: ILiveSyncCommandHelper,
1616
private $migrateController: IMigrateController,
17+
private $options: IOptions,
1718
private $projectData: IProjectData
1819
) { }
1920

@@ -36,7 +37,11 @@ export class RunCommandBase implements ICommand {
3637
this.$androidBundleValidatorHelper.validateNoAab();
3738
this.$projectData.initializeProjectData();
3839
const platforms = this.platform ? [this.platform] : [this.$devicePlatformsConstants.Android, this.$devicePlatformsConstants.iOS];
39-
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms });
40+
41+
if (!this.$options.force) {
42+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms });
43+
}
44+
4045
await this.$liveSyncCommandHelper.validatePlatform(this.platform);
4146

4247
return true;

lib/commands/test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ abstract class TestCommandBase {
4949
}
5050

5151
async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
52-
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [this.platform] });
52+
if (!this.$options.force) {
53+
await this.$migrateController.validate({ projectDir: this.$projectData.projectDir, platforms: [this.platform] });
54+
}
5355

5456
this.$projectData.initializeProjectData();
5557
this.$analyticsService.setShouldDispose(this.$options.justlaunch || !this.$options.watch);

0 commit comments

Comments
 (0)