Skip to content

Commit e62cfc5

Browse files
author
Fatme
authored
Merge pull request #4059 from NativeScript/fatme/validate-preview-params
fix: validate params passed to preview command
2 parents f606374 + 2033130 commit e62cfc5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/commands/preview.ts

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export class PreviewCommand implements ICommand {
33
private static MIN_SUPPORTED_WEBPACK_VERSION = "0.17.0";
44

55
constructor(private $bundleValidatorHelper: IBundleValidatorHelper,
6+
private $errors: IErrors,
67
private $liveSyncService: ILiveSyncService,
78
private $networkConnectivityValidator: INetworkConnectivityValidator,
89
private $projectData: IProjectData,
@@ -27,6 +28,10 @@ export class PreviewCommand implements ICommand {
2728
}
2829

2930
public async canExecute(args: string[]): Promise<boolean> {
31+
if (args && args.length) {
32+
this.$errors.fail(`The arguments '${args.join(" ")}' are not valid for the preview command.`);
33+
}
34+
3035
await this.$networkConnectivityValidator.validate();
3136
this.$bundleValidatorHelper.validate(PreviewCommand.MIN_SUPPORTED_WEBPACK_VERSION);
3237
return true;

0 commit comments

Comments
 (0)