mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 06:41:45 +08:00
With this change we clean up further the analytics code and re-use the `getAnalytics` to determine if the config is set or not. Also, this change inclused a refactor to the `createAnalytics` method to make it more readable.
28 lines
615 B
JavaScript
28 lines
615 B
JavaScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
'use strict';
|
|
// This file is ES5 because it needs to be executed as is.
|
|
|
|
if ('NG_CLI_ANALYTICS' in process.env) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
var analytics = require('../../src/analytics/analytics');
|
|
|
|
analytics
|
|
.getAnalytics('global')
|
|
.then((hasGlobalConfig) => {
|
|
if (!hasGlobalConfig) {
|
|
return analytics.promptAnalytics(true /** global */);
|
|
}
|
|
})
|
|
.catch(() => {});
|
|
} catch (_) {}
|