From 2993cde88267eb51e1ae836341f6c6f63f27d3f7 Mon Sep 17 00:00:00 2001 From: Zach Arend Date: Tue, 4 May 2021 16:25:39 -0700 Subject: [PATCH] build: fix crash when validating commit messages (#41949) Fixes a crash when running the `ValidateFileModule`. PR Close #41949 --- dev-infra/commit-message/validate-file/cli.ts | 5 ++++- dev-infra/ng-dev.js | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dev-infra/commit-message/validate-file/cli.ts b/dev-infra/commit-message/validate-file/cli.ts index 82f9800c3e93e..8ba2d5b2856b3 100644 --- a/dev-infra/commit-message/validate-file/cli.ts +++ b/dev-infra/commit-message/validate-file/cli.ts @@ -31,7 +31,10 @@ function builder(yargs: Argv) { type: 'string', conflicts: ['file'], description: 'The key of the environment variable for the path of the commit message file.', - coerce: (arg: string) => { + coerce: (arg: string|undefined) => { + if (arg === undefined) { + return arg; + } const file = process.env[arg]; if (!file) { throw new Error(`Provided environment variable "${arg}" was not found.`); diff --git a/dev-infra/ng-dev.js b/dev-infra/ng-dev.js index 4b32b869bd67f..092428181995d 100755 --- a/dev-infra/ng-dev.js +++ b/dev-infra/ng-dev.js @@ -2101,6 +2101,9 @@ function builder$2(yargs) { conflicts: ['file'], description: 'The key of the environment variable for the path of the commit message file.', coerce: (arg) => { + if (arg === undefined) { + return arg; + } const file = process.env[arg]; if (!file) { throw new Error(`Provided environment variable "${arg}" was not found.`);