Skip to content

Commit 2fc0f9f

Browse files
clydinmgechev
authored andcommitted
fix(@angular/cli): ensure analytics postinstall script is ES5 (#15620)
This can potentially execute on very old versions of Node.js. The `ng` command itself has an initial Node.js version check that will then inform the user of the required minimum.
1 parent b90a24b commit 2fc0f9f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
'use strict';
2-
// This file is ES6 because it needs to be executed as is.
2+
// This file is ES5 because it needs to be executed as is.
33

4-
if ('NG_CLI_ANALYTICS' in process.env) {
4+
if (process.env['NG_CLI_ANALYTICS'] !== undefined) {
55
return;
66
}
77

8-
(async () => {
9-
try {
10-
const analytics = require('../../models/analytics');
8+
try {
9+
var analytics = require('../../models/analytics');
1110

12-
if (!analytics.hasGlobalAnalyticsConfiguration()) {
13-
await analytics.promptGlobalAnalytics();
14-
}
15-
} catch (_) {}
16-
})();
11+
if (!analytics.hasGlobalAnalyticsConfiguration()) {
12+
analytics.promptGlobalAnalytics().catch(function() { });
13+
}
14+
} catch (_) {}

0 commit comments

Comments
 (0)