Skip to content

Commit da3c1c3

Browse files
committed
fix(@angular/cli): throw an error when executed in a google3-context
There is a separate, internal version of the Angular CLI which should be used instead. Running this version can lead to unintuitive and unexpected behavior. This commit intentionally does not include an opt-out because there is no supported use case for running the external CLI inside google3. If someone is broken by this and presents a compelling use case, we can reconsider and add an opt-out for this check.
1 parent cb165a7 commit da3c1c3

File tree

1 file changed

+10
-0
lines changed
  • packages/angular/cli/bin

1 file changed

+10
-0
lines changed

packages/angular/cli/bin/ng.js

+10
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
/* eslint-disable import/no-unassigned-import */
1212
'use strict';
1313

14+
const path = require('path');
15+
16+
// Error if the external CLI appears to be used inside a google3 context.
17+
if (process.cwd().split(path.sep).includes('google3')) {
18+
console.error(
19+
'This is the external Angular CLI, but you appear to be running in google3. There is a separate, internal version of the CLI which should be used instead. See http://go/angular/cli.',
20+
);
21+
process.exit();
22+
}
23+
1424
// Provide a title to the process in `ps`.
1525
// Due to an obscure Mac bug, do not start this title with any symbol.
1626
try {

0 commit comments

Comments
 (0)