From 17e98e16785450d6dfc94f85868a635415f95b92 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 16 Jan 2020 12:15:06 +0100 Subject: [PATCH] build: disable link to PUBLIC_API docs when running ts-api-guardian in angular repo (#34786) Currently we are showing the following link https://github.com/angular/angular/blob/master/docs/PUBLIC_API.md#golden-files whenever there are updates to the golden files. However this is not correct as this document only applies to the Angular repo as other consumers of ts-api-guardian have different commands, and they store they golden files in different locations. PR Close #34786 --- tools/ts-api-guardian/lib/cli.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/ts-api-guardian/lib/cli.ts b/tools/ts-api-guardian/lib/cli.ts index 1c2db1491e..745e224a2e 100644 --- a/tools/ts-api-guardian/lib/cli.ts +++ b/tools/ts-api-guardian/lib/cli.ts @@ -80,16 +80,19 @@ export function startCli() { } if (hasDiff) { + const bazelTarget = process.env['BAZEL_TARGET']; // Under bazel, give instructions how to use bazel run to accept the golden file. - if (!!process.env['BAZEL_TARGET']) { + if (bazelTarget) { console.error('\n\nIf you modify a public API, you must accept the new golden file.'); console.error('\n\nTo do so, execute the following Bazel target:'); - console.error( - ` yarn bazel run ${process.env['BAZEL_TARGET'].replace(/_bin$/, "")}.accept`); - console.error('\n\nFor more information, see'); - console.error( - '\n https://github.com/angular/angular/blob/master/docs/PUBLIC_API.md#golden-files'); + console.error(` yarn bazel run ${bazelTarget.replace(/_bin$/, "")}.accept`); + if (process.env['TEST_WORKSPACE'] === 'angular') { + console.error('\n\nFor more information, see'); + console.error( + '\n https://github.com/angular/angular/blob/master/docs/PUBLIC_API.md#golden-files'); + } } + process.exit(1); } }