Skip to content

Commit ac63ef6

Browse files
committed
fix: remove bundle plugin validation from commands
As we've already moved the logic for validation the version of nativescript-dev-webpack plugin to commandsService, there is no need to validate it again from commands.
1 parent 1c73c8f commit ac63ef6

File tree

5 files changed

+2
-24
lines changed

5 files changed

+2
-24
lines changed

lib/commands/build.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
99
protected $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
1010
protected $buildController: IBuildController,
1111
$platformValidationService: IPlatformValidationService,
12-
private $bundleValidatorHelper: IBundleValidatorHelper,
1312
private $buildDataService: IBuildDataService,
1413
protected $logger: ILogger) {
1514
super($options, $platformsDataService, $platformValidationService, $projectData);
@@ -33,8 +32,6 @@ export abstract class BuildCommandBase extends ValidatePlatformCommandBase {
3332
if (!this.$platformValidationService.isPlatformSupportedForOS(platform, this.$projectData)) {
3433
this.$errors.fail(`Applications for platform ${platform} can not be built on this OS`);
3534
}
36-
37-
this.$bundleValidatorHelper.validate(this.$projectData);
3835
}
3936

4037
protected async validateArgs(args: string[], platform: string): Promise<ICanExecuteCommandOutput> {
@@ -65,10 +62,9 @@ export class BuildIosCommand extends BuildCommandBase implements ICommand {
6562
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
6663
$buildController: IBuildController,
6764
$platformValidationService: IPlatformValidationService,
68-
$bundleValidatorHelper: IBundleValidatorHelper,
6965
$logger: ILogger,
7066
$buildDataService: IBuildDataService) {
71-
super($options, $errors, $projectData, $platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $bundleValidatorHelper, $buildDataService, $logger);
67+
super($options, $errors, $projectData, $platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $buildDataService, $logger);
7268
}
7369

7470
public async execute(args: string[]): Promise<void> {
@@ -101,11 +97,10 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
10197
$devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
10298
$buildController: IBuildController,
10399
$platformValidationService: IPlatformValidationService,
104-
$bundleValidatorHelper: IBundleValidatorHelper,
105100
protected $androidBundleValidatorHelper: IAndroidBundleValidatorHelper,
106101
$buildDataService: IBuildDataService,
107102
protected $logger: ILogger) {
108-
super($options, $errors, $projectData, platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $bundleValidatorHelper, $buildDataService, $logger);
103+
super($options, $errors, $projectData, platformsDataService, $devicePlatformsConstants, $buildController, $platformValidationService, $buildDataService, $logger);
109104
}
110105

111106
public async execute(args: string[]): Promise<void> {
@@ -122,7 +117,6 @@ export class BuildAndroidCommand extends BuildCommandBase implements ICommand {
122117

123118
public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
124119
const platform = this.$devicePlatformsConstants.Android;
125-
super.validatePlatform(platform);
126120
this.$androidBundleValidatorHelper.validateRuntimeVersion(this.$projectData);
127121
let result = await super.canExecuteCommandBase(platform, { notConfiguredEnvOptions: { hideSyncToPreviewAppOption: true } });
128122
if (result.canExecute) {

lib/commands/debug.ts

-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import { cache } from "../common/decorators";
22
import { ValidatePlatformCommandBase } from "./command-base";
3-
import { LiveSyncCommandHelper } from "../helpers/livesync-command-helper";
43

54
export class DebugPlatformCommand extends ValidatePlatformCommandBase implements ICommand {
65
public allowedParameters: ICommandParameter[] = [];
76

87
constructor(private platform: string,
9-
private $bundleValidatorHelper: IBundleValidatorHelper,
108
protected $devicesService: Mobile.IDevicesService,
119
$platformValidationService: IPlatformValidationService,
1210
$projectData: IProjectData,
@@ -64,9 +62,6 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements
6462
this.$errors.fail("--release flag is not applicable to this command");
6563
}
6664

67-
const minSupportedWebpackVersion = this.$options.hmr ? LiveSyncCommandHelper.MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR : null;
68-
this.$bundleValidatorHelper.validate(this.$projectData, minSupportedWebpackVersion);
69-
7065
const result = await super.canExecuteCommandBase(this.platform, { validateOptions: true, notConfiguredEnvOptions: { hideCloudBuildOption: true, hideSyncToPreviewAppOption: true } });
7166
return result;
7267
}

lib/commands/deploy.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export class DeployOnDeviceCommand extends ValidatePlatformCommandBase implement
1717
private $errors: IErrors,
1818
private $mobileHelper: Mobile.IMobileHelper,
1919
$platformsDataService: IPlatformsDataService,
20-
private $bundleValidatorHelper: IBundleValidatorHelper,
2120
private $deployCommandHelper: DeployCommandHelper,
2221
private $androidBundleValidatorHelper: IAndroidBundleValidatorHelper) {
2322
super($options, $platformsDataService, $platformValidationService, $projectData);
@@ -31,7 +30,6 @@ export class DeployOnDeviceCommand extends ValidatePlatformCommandBase implement
3130

3231
public async canExecute(args: string[]): Promise<boolean | ICanExecuteCommandOutput> {
3332
this.$androidBundleValidatorHelper.validateNoAab();
34-
this.$bundleValidatorHelper.validate(this.$projectData);
3533
if (!args || !args.length || args.length > 1) {
3634
return false;
3735
}

lib/commands/preview.ts

-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import { DEVICE_LOG_EVENT_NAME } from "../common/constants";
22

33
export class PreviewCommand implements ICommand {
44
public allowedParameters: ICommandParameter[] = [];
5-
private static MIN_SUPPORTED_WEBPACK_VERSION = "0.17.0";
65

76
constructor(private $analyticsService: IAnalyticsService,
8-
private $bundleValidatorHelper: IBundleValidatorHelper,
97
private $errors: IErrors,
108
private $logger: ILogger,
119
private $previewAppController: IPreviewAppController,
@@ -43,7 +41,6 @@ export class PreviewCommand implements ICommand {
4341
}
4442

4543
await this.$networkConnectivityValidator.validate();
46-
this.$bundleValidatorHelper.validate(this.$projectData, PreviewCommand.MIN_SUPPORTED_WEBPACK_VERSION);
4744
return true;
4845
}
4946
}

lib/helpers/livesync-command-helper.ts

-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { RunOnDeviceEvents } from "../constants";
22
import { DeployController } from "../controllers/deploy-controller";
33

44
export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
5-
public static MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR = "0.17.0";
6-
75
constructor(
86
private $buildDataService: IBuildDataService,
97
private $projectData: IProjectData,
@@ -15,7 +13,6 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
1513
private $injector: IInjector,
1614
private $buildController: IBuildController,
1715
private $analyticsService: IAnalyticsService,
18-
private $bundleValidatorHelper: IBundleValidatorHelper,
1916
private $errors: IErrors,
2017
private $iOSSimulatorLogProvider: Mobile.IiOSSimulatorLogProvider,
2118
private $cleanupService: ICleanupService,
@@ -133,9 +130,6 @@ export class LiveSyncCommandHelper implements ILiveSyncCommandHelper {
133130
result[availablePlatform.toLowerCase()] = validateOutput;
134131
}
135132

136-
const minSupportedWebpackVersion = this.$options.hmr ? LiveSyncCommandHelper.MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR : null;
137-
this.$bundleValidatorHelper.validate(this.$projectData, minSupportedWebpackVersion);
138-
139133
return result;
140134
}
141135

0 commit comments

Comments
 (0)