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
This commit is contained in:
Alan Agius 2020-01-16 12:15:06 +01:00 committed by Matias Niemelä
parent 47f233a4a7
commit 17e98e1678
1 changed files with 9 additions and 6 deletions

View File

@ -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);
}
}