Skip to content

Commit

Permalink
fix(@angular/cli): ensure analytics postinstall script is ES5 (#15620)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
clydin authored and mgechev committed Sep 18, 2019
1 parent b90a24b commit 2fc0f9f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/angular/cli/bin/postinstall/analytics-prompt.js
@@ -1,16 +1,14 @@
'use strict';
// This file is ES6 because it needs to be executed as is.
// This file is ES5 because it needs to be executed as is.

if ('NG_CLI_ANALYTICS' in process.env) {
if (process.env['NG_CLI_ANALYTICS'] !== undefined) {
return;
}

(async () => {
try {
const analytics = require('../../models/analytics');
try {
var analytics = require('../../models/analytics');

if (!analytics.hasGlobalAnalyticsConfiguration()) {
await analytics.promptGlobalAnalytics();
}
} catch (_) {}
})();
if (!analytics.hasGlobalAnalyticsConfiguration()) {
analytics.promptGlobalAnalytics().catch(function() { });
}
} catch (_) {}

0 comments on commit 2fc0f9f

Please sign in to comment.