Skip to content

Commit e2492d8

Browse files
committed
fix: recommend the new workflow before executing run/test/debug/prepare/build/preview
1 parent d255b97 commit e2492d8

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

lib/commands/build.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
99
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
1010
$platformService: IPlatformService,
1111
private $bundleValidatorHelper: IBundleValidatorHelper,
12-
protected $logger: ILogger) {
13-
super($options, $platformsData, $platformService, $projectData);
14-
this.$projectData.initializeProjectData();
12+
protected $logger: ILogger,
13+
protected $workflowService: IWorkflowService) {
14+
super($options, $platformsData, $platformService, $projectData);
15+
this.$projectData.initializeProjectData();
1516
}
1617

1718
public async executeCore(args: string[]): Promise<string> {
19+
await this.$workflowService.handleLegacyWorkflow(this.$projectData.projectDir, this.$options);
1820
const platform = args[0].toLowerCase();
1921
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = {
2022
bundle: !!this.$options.bundle,
@@ -94,8 +96,9 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
9496
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
9597
$platformService: IPlatformService,
9698
$bundleValidatorHelper: IBundleValidatorHelper,
97-
$logger: ILogger) {
98-
super($options, $errors, $projectData, $platformsData, $devicePlatformsConstants, $platformService, $bundleValidatorHelper, $logger);
99+
$logger: ILogger,
100+
$workflowService: IWorkflowService) {
101+
super($options, $errors, $projectData, $platformsData, $devicePlatformsConstants, $platformService, $bundleValidatorHelper, $logger, $workflowService);
99102
}
100103

101104
public async execute(args: string[]): Promise<void> {
@@ -107,7 +110,7 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
107110

108111
super.validatePlatform(platform);
109112

110-
let result = await super.canExecuteCommandBase(platform, { notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true }});
113+
let result = await super.canExecuteCommandBase(platform, { notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true } });
111114
if (result.canExecute) {
112115
result = await super.validateArgs(args, platform);
113116
}
@@ -129,8 +132,9 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
129132
$platformService: IPlatformService,
130133
$bundleValidatorHelper: IBundleValidatorHelper,
131134
protected $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
132-
protected $logger: ILogger) {
133-
super($options, $errors, $projectData, $platformsData, $devicePlatformsConstants, $platformService, $bundleValidatorHelper, $logger);
135+
protected $logger: ILogger,
136+
$workflowService: IWorkflowService) {
137+
super($options, $errors, $projectData, $platformsData, $devicePlatformsConstants, $platformService, $bundleValidatorHelper, $logger, $workflowService);
134138
}
135139

136140
public async execute(args: string[]): Promise<void> {
@@ -149,7 +153,7 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
149153
const platform = this.$devicePlatformsConstants.Android;
150154
super.validatePlatform(platform);
151155
this.$androidBundleValidatorHelper.validateRuntimeVersion(this.$projectData);
152-
let result = await super.canExecuteCommandBase(platform, { notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true }});
156+
let result = await super.canExecuteCommandBase(platform, { notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true } });
153157
if (result.canExecute) {
154158
if (this.$options.release && (!this.$options.keyStorePath || !this.$options.keyStorePassword || !this.$options.keyStoreAlias || !this.$options.keyStoreAliasPassword)) {
155159
this.$errors.fail(ANDROID_RELEASE_BUILD_ERROR_MESSAGE);

lib/commands/debug.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
1818
private $debugDataService: IDebugDataService,
1919
private $liveSyncService: IDebugLiveSyncService,
2020
private $liveSyncCommandHelper: ILiveSyncCommandHelper,
21-
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) {
21+
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
22+
private $workflowService: IWorkflowService) {
2223
super($options, $platformsData, $platformService, $projectData);
2324
}
2425

2526
public async execute(args: string[]): Promise<void> {
27+
await this.$workflowService.handleLegacyWorkflow(this.$projectData.projectDir, this.$options);
2628
await this.$devicesService.initialize({
2729
platform: this.platform,
2830
deviceId: this.$options.device,

lib/commands/prepare.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ export class PrepareCommand extends ValidatePlatformCommandBase implements IComm
77
$platformService: IPlatformService,
88
$projectData: IProjectData,
99
private $platformCommandParameter: ICommandParameter,
10-
$platformsData: IPlatformsData) {
11-
super($options, $platformsData, $platformService, $projectData);
12-
this.$projectData.initializeProjectData();
10+
$platformsData: IPlatformsData,
11+
private $workflowService: IWorkflowService) {
12+
super($options, $platformsData, $platformService, $projectData);
13+
this.$projectData.initializeProjectData();
1314
}
1415

1516
public async execute(args: string[]): Promise<void> {
17+
await this.$workflowService.handleLegacyWorkflow(this.$projectData.projectDir, this.$options);
1618
const appFilesUpdaterOptions: IAppFilesUpdaterOptions = {
1719
bundle: !!this.$options.bundle,
1820
release: this.$options.release,

lib/commands/run.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ export class RunCommandBase implements ICommand {
1313
private $errors: IErrors,
1414
private $hostInfo: IHostInfo,
1515
private $liveSyncCommandHelper: ILiveSyncCommandHelper,
16-
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) { }
16+
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
17+
private $options: IOptions,
18+
private $workflowService: IWorkflowService) { }
1719

1820
public allowedParameters: ICommandParameter[] = [];
1921
public async execute(args: string[]): Promise<void> {
22+
await this.$workflowService.handleLegacyWorkflow(this.$projectData.projectDir, this.$options);
2023
await this.$analyticsService.trackPreviewAppData(this.platform, this.$projectData.projectDir);
2124
return this.$liveSyncCommandHelper.executeCommandLiveSync(this.platform, this.liveSyncCommandHelperAdditionalOptions);
2225
}

lib/services/workflow-service.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export class WorkflowService implements IWorkflowService {
4545
await this.ensureWebpackPluginInstalled(projectData);
4646
} else {
4747
this.$projectDataService.setUseLegacyWorkflow(projectData.projectDir, true);
48-
await this.showLegacyWorkflowWarning();
4948
}
5049
} else {
5150
await this.showLegacyWorkflowWarning();
@@ -54,7 +53,7 @@ export class WorkflowService implements IWorkflowService {
5453
return hasSwitched;
5554
}
5655

57-
private async showLegacyWorkflowWarning() {
56+
private showLegacyWorkflowWarning() {
5857
this.$logger.warn("WARNINGGGGG LEGACY TRUE!!!");
5958
}
6059

0 commit comments

Comments
 (0)