@angular/cli 14.0.0-next.3 → 14.0.0-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/bin/ng.js +3 -5
  2. package/bin/postinstall/analytics-prompt.js +3 -3
  3. package/lib/cli/index.d.ts +1 -1
  4. package/lib/cli/index.js +16 -18
  5. package/lib/config/schema.json +8 -12
  6. package/lib/config/workspace-schema.d.ts +1 -1
  7. package/lib/init.js +8 -4
  8. package/package.json +17 -16
  9. package/{models → src/analytics}/analytics-collector.d.ts +0 -0
  10. package/{models → src/analytics}/analytics-collector.js +6 -2
  11. package/src/analytics/analytics-environment-options.d.ts +9 -0
  12. package/src/analytics/analytics-environment-options.js +20 -0
  13. package/src/analytics/analytics.d.ts +47 -0
  14. package/src/analytics/analytics.js +303 -0
  15. package/src/command-builder/architect-base-command-module.d.ts +23 -0
  16. package/src/command-builder/architect-base-command-module.js +103 -0
  17. package/src/command-builder/architect-command-module.d.ts +22 -0
  18. package/src/command-builder/architect-command-module.js +108 -0
  19. package/src/command-builder/command-module.d.ts +88 -0
  20. package/src/command-builder/command-module.js +191 -0
  21. package/src/command-builder/command-runner.d.ts +10 -0
  22. package/src/command-builder/command-runner.js +135 -0
  23. package/src/command-builder/schematics-command-module.d.ts +44 -0
  24. package/src/command-builder/schematics-command-module.js +295 -0
  25. package/src/command-builder/utilities/command.d.ts +13 -0
  26. package/src/command-builder/utilities/command.js +27 -0
  27. package/src/command-builder/utilities/json-help.d.ts +36 -0
  28. package/src/command-builder/utilities/json-help.js +94 -0
  29. package/src/command-builder/utilities/json-schema.d.ts +40 -0
  30. package/{utilities → src/command-builder/utilities}/json-schema.js +20 -121
  31. package/{models → src/command-builder/utilities}/schematic-engine-host.d.ts +0 -0
  32. package/{models → src/command-builder/utilities}/schematic-engine-host.js +0 -0
  33. package/src/command-builder/utilities/schematic-workflow.d.ts +14 -0
  34. package/src/command-builder/utilities/schematic-workflow.js +68 -0
  35. package/src/commands/add/cli.d.ts +33 -0
  36. package/{commands/add-impl.js → src/commands/add/cli.js} +100 -72
  37. package/{commands/add.md → src/commands/add/long-description.md} +0 -0
  38. package/src/commands/analytics/cli.d.ts +16 -0
  39. package/src/commands/analytics/cli.js +35 -0
  40. package/src/commands/analytics/info/cli.d.ts +16 -0
  41. package/src/commands/analytics/info/cli.js +26 -0
  42. package/src/commands/analytics/settings/cli.d.ts +35 -0
  43. package/src/commands/analytics/settings/cli.js +61 -0
  44. package/src/commands/build/cli.d.ts +16 -0
  45. package/src/commands/build/cli.js +23 -0
  46. package/{commands/build-long.md → src/commands/build/long-description.md} +0 -0
  47. package/src/commands/config/cli.d.ts +24 -0
  48. package/{commands/config-impl.js → src/commands/config/cli.js} +102 -89
  49. package/{commands/config-long.md → src/commands/config/long-description.md} +2 -2
  50. package/src/commands/deploy/cli.d.ts +16 -0
  51. package/src/commands/deploy/cli.js +35 -0
  52. package/{commands/deploy-long.md → src/commands/deploy/long-description.md} +0 -0
  53. package/src/commands/doc/cli.d.ts +23 -0
  54. package/{commands/doc-impl.js → src/commands/doc/cli.js} +41 -12
  55. package/src/commands/e2e/cli.d.ts +17 -0
  56. package/src/commands/e2e/cli.js +34 -0
  57. package/src/commands/extract-i18n/cli.d.ts +15 -0
  58. package/src/commands/extract-i18n/cli.js +20 -0
  59. package/src/commands/generate/cli.d.ts +29 -0
  60. package/src/commands/generate/cli.js +114 -0
  61. package/src/commands/lint/cli.d.ts +16 -0
  62. package/src/commands/lint/cli.js +31 -0
  63. package/{commands/lint-long.md → src/commands/lint/long-description.md} +0 -0
  64. package/src/commands/make-this-awesome/cli.d.ts +17 -0
  65. package/{commands/easter-egg-impl.js → src/commands/make-this-awesome/cli.js} +17 -10
  66. package/src/commands/new/cli.d.ts +25 -0
  67. package/src/commands/new/cli.js +66 -0
  68. package/src/commands/run/cli.d.ts +23 -0
  69. package/src/commands/run/cli.js +59 -0
  70. package/{commands/run-long.md → src/commands/run/long-description.md} +0 -0
  71. package/src/commands/serve/cli.d.ts +16 -0
  72. package/src/commands/serve/cli.js +21 -0
  73. package/src/commands/test/cli.d.ts +16 -0
  74. package/src/commands/test/cli.js +23 -0
  75. package/{commands/test-long.md → src/commands/test/long-description.md} +0 -0
  76. package/{commands/update-impl.d.ts → src/commands/update/cli.d.ts} +25 -9
  77. package/{commands/update-impl.js → src/commands/update/cli.js} +323 -306
  78. package/{commands/update-long.md → src/commands/update/long-description.md} +0 -0
  79. package/src/commands/update/schematic/index.js +6 -2
  80. package/src/commands/version/cli.d.ts +19 -0
  81. package/{commands/version-impl.js → src/commands/version/cli.js} +57 -56
  82. package/src/typings.d.ts +2 -2
  83. package/{utilities → src/utilities}/color.d.ts +0 -0
  84. package/{utilities → src/utilities}/color.js +5 -1
  85. package/{utilities → src/utilities}/config.d.ts +2 -1
  86. package/{utilities → src/utilities}/config.js +38 -7
  87. package/{utilities → src/utilities}/find-up.d.ts +0 -0
  88. package/{utilities → src/utilities}/find-up.js +5 -1
  89. package/{utilities → src/utilities}/install-package.d.ts +2 -2
  90. package/{utilities → src/utilities}/install-package.js +1 -1
  91. package/{utilities → src/utilities}/json-file.d.ts +0 -0
  92. package/{utilities → src/utilities}/json-file.js +0 -0
  93. package/{utilities → src/utilities}/log-file.d.ts +0 -0
  94. package/{utilities → src/utilities}/log-file.js +0 -0
  95. package/{utilities → src/utilities}/package-json.d.ts +0 -0
  96. package/{utilities → src/utilities}/package-json.js +0 -0
  97. package/{utilities → src/utilities}/package-manager.d.ts +1 -1
  98. package/{utilities → src/utilities}/package-manager.js +1 -1
  99. package/{utilities → src/utilities}/package-metadata.d.ts +0 -0
  100. package/{utilities → src/utilities}/package-metadata.js +5 -1
  101. package/{utilities → src/utilities}/package-tree.d.ts +0 -0
  102. package/{utilities → src/utilities}/package-tree.js +5 -1
  103. package/{utilities → src/utilities}/project.d.ts +0 -0
  104. package/{utilities → src/utilities}/project.js +5 -1
  105. package/{utilities → src/utilities}/prompt.d.ts +0 -0
  106. package/{utilities → src/utilities}/prompt.js +5 -1
  107. package/{utilities → src/utilities}/spinner.d.ts +0 -0
  108. package/{utilities → src/utilities}/spinner.js +0 -0
  109. package/{utilities → src/utilities}/tty.d.ts +0 -0
  110. package/{utilities → src/utilities}/tty.js +0 -0
  111. package/{models → src/utilities}/version.d.ts +2 -1
  112. package/{models → src/utilities}/version.js +6 -6
  113. package/commands/add-impl.d.ts +0 -21
  114. package/commands/add.d.ts +0 -42
  115. package/commands/add.js +0 -10
  116. package/commands/add.json +0 -54
  117. package/commands/analytics-impl.d.ts +0 -13
  118. package/commands/analytics-impl.js +0 -80
  119. package/commands/analytics-long.md +0 -8
  120. package/commands/analytics.d.ts +0 -46
  121. package/commands/analytics.js +0 -31
  122. package/commands/analytics.json +0 -37
  123. package/commands/build-impl.d.ts +0 -14
  124. package/commands/build-impl.js +0 -21
  125. package/commands/build.d.ts +0 -30
  126. package/commands/build.js +0 -10
  127. package/commands/build.json +0 -16
  128. package/commands/config-impl.d.ts +0 -15
  129. package/commands/config.d.ts +0 -34
  130. package/commands/config.js +0 -10
  131. package/commands/config.json +0 -43
  132. package/commands/definitions.json +0 -66
  133. package/commands/deploy-impl.d.ts +0 -15
  134. package/commands/deploy-impl.js +0 -36
  135. package/commands/deploy.d.ts +0 -30
  136. package/commands/deploy.js +0 -10
  137. package/commands/deploy.json +0 -34
  138. package/commands/doc-impl.d.ts +0 -13
  139. package/commands/doc.d.ts +0 -39
  140. package/commands/doc.js +0 -14
  141. package/commands/doc.json +0 -46
  142. package/commands/e2e-impl.d.ts +0 -16
  143. package/commands/e2e-impl.js +0 -36
  144. package/commands/e2e-long.md +0 -4
  145. package/commands/e2e.d.ts +0 -29
  146. package/commands/e2e.js +0 -10
  147. package/commands/e2e.json +0 -17
  148. package/commands/easter-egg-impl.d.ts +0 -12
  149. package/commands/easter-egg.d.ts +0 -14
  150. package/commands/easter-egg.js +0 -10
  151. package/commands/easter-egg.json +0 -12
  152. package/commands/extract-i18n-impl.d.ts +0 -14
  153. package/commands/extract-i18n-impl.js +0 -21
  154. package/commands/extract-i18n.d.ts +0 -29
  155. package/commands/extract-i18n.js +0 -10
  156. package/commands/extract-i18n.json +0 -15
  157. package/commands/generate-impl.d.ts +0 -18
  158. package/commands/generate-impl.js +0 -89
  159. package/commands/generate.d.ts +0 -37
  160. package/commands/generate.js +0 -10
  161. package/commands/generate.json +0 -31
  162. package/commands/help-impl.d.ts +0 -12
  163. package/commands/help-impl.js +0 -26
  164. package/commands/help-long.md +0 -7
  165. package/commands/help.d.ts +0 -17
  166. package/commands/help.js +0 -10
  167. package/commands/help.json +0 -13
  168. package/commands/lint-impl.d.ts +0 -16
  169. package/commands/lint-impl.js +0 -69
  170. package/commands/lint.d.ts +0 -29
  171. package/commands/lint.js +0 -10
  172. package/commands/lint.json +0 -36
  173. package/commands/new-impl.d.ts +0 -16
  174. package/commands/new-impl.js +0 -37
  175. package/commands/new.d.ts +0 -41
  176. package/commands/new.js +0 -10
  177. package/commands/new.json +0 -34
  178. package/commands/new.md +0 -16
  179. package/commands/run-impl.d.ts +0 -13
  180. package/commands/run-impl.js +0 -22
  181. package/commands/run.d.ts +0 -30
  182. package/commands/run.js +0 -10
  183. package/commands/run.json +0 -36
  184. package/commands/serve-impl.d.ts +0 -15
  185. package/commands/serve-impl.js +0 -24
  186. package/commands/serve.d.ts +0 -29
  187. package/commands/serve.js +0 -10
  188. package/commands/serve.json +0 -17
  189. package/commands/test-impl.d.ts +0 -15
  190. package/commands/test-impl.js +0 -22
  191. package/commands/test.d.ts +0 -29
  192. package/commands/test.js +0 -10
  193. package/commands/test.json +0 -17
  194. package/commands/update.d.ts +0 -61
  195. package/commands/update.js +0 -10
  196. package/commands/update.json +0 -78
  197. package/commands/version-impl.d.ts +0 -17
  198. package/commands/version.d.ts +0 -17
  199. package/commands/version.js +0 -10
  200. package/commands/version.json +0 -13
  201. package/commands.json +0 -20
  202. package/models/analytics.d.ts +0 -58
  203. package/models/analytics.js +0 -358
  204. package/models/architect-command.d.ts +0 -35
  205. package/models/architect-command.js +0 -364
  206. package/models/command-runner.d.ts +0 -24
  207. package/models/command-runner.js +0 -241
  208. package/models/command.d.ts +0 -34
  209. package/models/command.js +0 -143
  210. package/models/interface.d.ts +0 -196
  211. package/models/interface.js +0 -31
  212. package/models/parser.d.ts +0 -39
  213. package/models/parser.js +0 -349
  214. package/models/schematic-command.d.ts +0 -55
  215. package/models/schematic-command.js +0 -485
  216. package/utilities/INITIAL_COMMIT_MESSAGE.txt +0 -8
  217. package/utilities/json-schema.d.ts +0 -17
@@ -1,358 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.getSharedAnalytics = exports.getWorkspaceAnalytics = exports.hasWorkspaceAnalyticsConfiguration = exports.getGlobalAnalytics = exports.hasGlobalAnalyticsConfiguration = exports.promptProjectAnalytics = exports.promptGlobalAnalytics = exports.setAnalyticsConfig = exports.isPackageNameSafeForAnalytics = exports.analyticsPackageSafelist = exports.AnalyticsProperties = void 0;
33
- const core_1 = require("@angular-devkit/core");
34
- const debug_1 = __importDefault(require("debug"));
35
- const inquirer = __importStar(require("inquirer"));
36
- const uuid_1 = require("uuid");
37
- const version_1 = require("../models/version");
38
- const color_1 = require("../utilities/color");
39
- const config_1 = require("../utilities/config");
40
- const tty_1 = require("../utilities/tty");
41
- const analytics_collector_1 = require("./analytics-collector");
42
- /* eslint-disable no-console */
43
- const analyticsDebug = (0, debug_1.default)('ng:analytics'); // Generate analytics, including settings and users.
44
- let _defaultAngularCliPropertyCache;
45
- exports.AnalyticsProperties = {
46
- AngularCliProd: 'UA-8594346-29',
47
- AngularCliStaging: 'UA-8594346-32',
48
- get AngularCliDefault() {
49
- if (_defaultAngularCliPropertyCache) {
50
- return _defaultAngularCliPropertyCache;
51
- }
52
- const v = version_1.VERSION.full;
53
- // The logic is if it's a full version then we should use the prod GA property.
54
- if (/^\d+\.\d+\.\d+$/.test(v) && v !== '0.0.0') {
55
- _defaultAngularCliPropertyCache = exports.AnalyticsProperties.AngularCliProd;
56
- }
57
- else {
58
- _defaultAngularCliPropertyCache = exports.AnalyticsProperties.AngularCliStaging;
59
- }
60
- return _defaultAngularCliPropertyCache;
61
- },
62
- };
63
- /**
64
- * This is the ultimate safelist for checking if a package name is safe to report to analytics.
65
- */
66
- exports.analyticsPackageSafelist = [
67
- /^@angular\//,
68
- /^@angular-devkit\//,
69
- /^@ngtools\//,
70
- '@schematics/angular',
71
- ];
72
- function isPackageNameSafeForAnalytics(name) {
73
- return exports.analyticsPackageSafelist.some((pattern) => {
74
- if (typeof pattern == 'string') {
75
- return pattern === name;
76
- }
77
- else {
78
- return pattern.test(name);
79
- }
80
- });
81
- }
82
- exports.isPackageNameSafeForAnalytics = isPackageNameSafeForAnalytics;
83
- /**
84
- * Set analytics settings. This does not work if the user is not inside a project.
85
- * @param level Which config to use. "global" for user-level, and "local" for project-level.
86
- * @param value Either a user ID, true to generate a new User ID, or false to disable analytics.
87
- */
88
- function setAnalyticsConfig(level, value) {
89
- analyticsDebug('setting %s level analytics to: %s', level, value);
90
- const [config, configPath] = (0, config_1.getWorkspaceRaw)(level);
91
- if (!config || !configPath) {
92
- throw new Error(`Could not find ${level} workspace.`);
93
- }
94
- const cli = config.get(['cli']);
95
- if (cli !== undefined && !core_1.json.isJsonObject(cli)) {
96
- throw new Error(`Invalid config found at ${configPath}. CLI should be an object.`);
97
- }
98
- if (value === true) {
99
- value = (0, uuid_1.v4)();
100
- }
101
- config.modify(['cli', 'analytics'], value);
102
- config.save();
103
- analyticsDebug('done');
104
- }
105
- exports.setAnalyticsConfig = setAnalyticsConfig;
106
- /**
107
- * Prompt the user for usage gathering permission.
108
- * @param force Whether to ask regardless of whether or not the user is using an interactive shell.
109
- * @return Whether or not the user was shown a prompt.
110
- */
111
- async function promptGlobalAnalytics(force = false) {
112
- analyticsDebug('prompting global analytics.');
113
- if (force || (0, tty_1.isTTY)()) {
114
- const answers = await inquirer.prompt([
115
- {
116
- type: 'confirm',
117
- name: 'analytics',
118
- message: core_1.tags.stripIndents `
119
- Would you like to share anonymous usage data with the Angular Team at Google under
120
- Google’s Privacy Policy at https://policies.google.com/privacy? For more details and
121
- how to change this setting, see https://angular.io/analytics.
122
- `,
123
- default: false,
124
- },
125
- ]);
126
- setAnalyticsConfig('global', answers.analytics);
127
- if (answers.analytics) {
128
- console.log('');
129
- console.log(core_1.tags.stripIndent `
130
- Thank you for sharing anonymous usage data. If you change your mind, the following
131
- command will disable this feature entirely:
132
-
133
- ${color_1.colors.yellow('ng analytics off')}
134
- `);
135
- console.log('');
136
- // Send back a ping with the user `optin`.
137
- const ua = new analytics_collector_1.AnalyticsCollector(exports.AnalyticsProperties.AngularCliDefault, 'optin');
138
- ua.pageview('/telemetry/optin');
139
- await ua.flush();
140
- }
141
- else {
142
- // Send back a ping with the user `optout`. This is the only thing we send.
143
- const ua = new analytics_collector_1.AnalyticsCollector(exports.AnalyticsProperties.AngularCliDefault, 'optout');
144
- ua.pageview('/telemetry/optout');
145
- await ua.flush();
146
- }
147
- return true;
148
- }
149
- else {
150
- analyticsDebug('Either STDOUT or STDIN are not TTY and we skipped the prompt.');
151
- }
152
- return false;
153
- }
154
- exports.promptGlobalAnalytics = promptGlobalAnalytics;
155
- /**
156
- * Prompt the user for usage gathering permission for the local project. Fails if there is no
157
- * local workspace.
158
- * @param force Whether to ask regardless of whether or not the user is using an interactive shell.
159
- * @return Whether or not the user was shown a prompt.
160
- */
161
- async function promptProjectAnalytics(force = false) {
162
- analyticsDebug('prompting user');
163
- const [config, configPath] = (0, config_1.getWorkspaceRaw)('local');
164
- if (!config || !configPath) {
165
- throw new Error(`Could not find a local workspace. Are you in a project?`);
166
- }
167
- if (force || (0, tty_1.isTTY)()) {
168
- const answers = await inquirer.prompt([
169
- {
170
- type: 'confirm',
171
- name: 'analytics',
172
- message: core_1.tags.stripIndents `
173
- Would you like to share anonymous usage data about this project with the Angular Team at
174
- Google under Google’s Privacy Policy at https://policies.google.com/privacy? For more
175
- details and how to change this setting, see https://angular.io/analytics.
176
-
177
- `,
178
- default: false,
179
- },
180
- ]);
181
- setAnalyticsConfig('local', answers.analytics);
182
- if (answers.analytics) {
183
- console.log('');
184
- console.log(core_1.tags.stripIndent `
185
- Thank you for sharing anonymous usage data. Should you change your mind, the following
186
- command will disable this feature entirely:
187
-
188
- ${color_1.colors.yellow('ng analytics project off')}
189
- `);
190
- console.log('');
191
- // Send back a ping with the user `optin`.
192
- const ua = new analytics_collector_1.AnalyticsCollector(exports.AnalyticsProperties.AngularCliDefault, 'optin');
193
- ua.pageview('/telemetry/project/optin');
194
- await ua.flush();
195
- }
196
- else {
197
- // Send back a ping with the user `optout`. This is the only thing we send.
198
- const ua = new analytics_collector_1.AnalyticsCollector(exports.AnalyticsProperties.AngularCliDefault, 'optout');
199
- ua.pageview('/telemetry/project/optout');
200
- await ua.flush();
201
- }
202
- return true;
203
- }
204
- return false;
205
- }
206
- exports.promptProjectAnalytics = promptProjectAnalytics;
207
- async function hasGlobalAnalyticsConfiguration() {
208
- try {
209
- const globalWorkspace = await (0, config_1.getWorkspace)('global');
210
- const analyticsConfig = globalWorkspace && globalWorkspace.getCli() && globalWorkspace.getCli()['analytics'];
211
- if (analyticsConfig !== null && analyticsConfig !== undefined) {
212
- return true;
213
- }
214
- }
215
- catch { }
216
- return false;
217
- }
218
- exports.hasGlobalAnalyticsConfiguration = hasGlobalAnalyticsConfiguration;
219
- /**
220
- * Get the global analytics object for the user. This returns an instance of UniversalAnalytics,
221
- * or undefined if analytics are disabled.
222
- *
223
- * If any problem happens, it is considered the user has been opting out of analytics.
224
- */
225
- async function getGlobalAnalytics() {
226
- analyticsDebug('getGlobalAnalytics');
227
- const propertyId = exports.AnalyticsProperties.AngularCliDefault;
228
- if ('NG_CLI_ANALYTICS' in process.env) {
229
- if (process.env['NG_CLI_ANALYTICS'] == 'false' || process.env['NG_CLI_ANALYTICS'] == '') {
230
- analyticsDebug('NG_CLI_ANALYTICS is false');
231
- return undefined;
232
- }
233
- if (process.env['NG_CLI_ANALYTICS'] === 'ci') {
234
- analyticsDebug('Running in CI mode');
235
- return new analytics_collector_1.AnalyticsCollector(propertyId, 'ci');
236
- }
237
- }
238
- // If anything happens we just keep the NOOP analytics.
239
- try {
240
- const globalWorkspace = await (0, config_1.getWorkspace)('global');
241
- const analyticsConfig = globalWorkspace && globalWorkspace.getCli() && globalWorkspace.getCli()['analytics'];
242
- analyticsDebug('Client Analytics config found: %j', analyticsConfig);
243
- if (analyticsConfig === false) {
244
- analyticsDebug('Analytics disabled. Ignoring all analytics.');
245
- return undefined;
246
- }
247
- else if (analyticsConfig === undefined || analyticsConfig === null) {
248
- analyticsDebug('Analytics settings not found. Ignoring all analytics.');
249
- // globalWorkspace can be null if there is no file. analyticsConfig would be null in this
250
- // case. Since there is no file, the user hasn't answered and the expected return value is
251
- // undefined.
252
- return undefined;
253
- }
254
- else {
255
- let uid = undefined;
256
- if (typeof analyticsConfig == 'string') {
257
- uid = analyticsConfig;
258
- }
259
- else if (typeof analyticsConfig == 'object' && typeof analyticsConfig['uid'] == 'string') {
260
- uid = analyticsConfig['uid'];
261
- }
262
- analyticsDebug('client id: %j', uid);
263
- if (uid == undefined) {
264
- return undefined;
265
- }
266
- return new analytics_collector_1.AnalyticsCollector(propertyId, uid);
267
- }
268
- }
269
- catch (err) {
270
- analyticsDebug('Error happened during reading of analytics config: %s', err.message);
271
- return undefined;
272
- }
273
- }
274
- exports.getGlobalAnalytics = getGlobalAnalytics;
275
- async function hasWorkspaceAnalyticsConfiguration() {
276
- try {
277
- const globalWorkspace = await (0, config_1.getWorkspace)('local');
278
- const analyticsConfig = globalWorkspace && globalWorkspace.getCli() && globalWorkspace.getCli()['analytics'];
279
- if (analyticsConfig !== undefined) {
280
- return true;
281
- }
282
- }
283
- catch { }
284
- return false;
285
- }
286
- exports.hasWorkspaceAnalyticsConfiguration = hasWorkspaceAnalyticsConfiguration;
287
- /**
288
- * Get the workspace analytics object for the user. This returns an instance of AnalyticsCollector,
289
- * or undefined if analytics are disabled.
290
- *
291
- * If any problem happens, it is considered the user has been opting out of analytics.
292
- */
293
- async function getWorkspaceAnalytics() {
294
- analyticsDebug('getWorkspaceAnalytics');
295
- try {
296
- const globalWorkspace = await (0, config_1.getWorkspace)('local');
297
- const analyticsConfig = globalWorkspace === null || globalWorkspace === void 0 ? void 0 : globalWorkspace.getCli()['analytics'];
298
- analyticsDebug('Workspace Analytics config found: %j', analyticsConfig);
299
- if (analyticsConfig === false) {
300
- analyticsDebug('Analytics disabled. Ignoring all analytics.');
301
- return undefined;
302
- }
303
- else if (analyticsConfig === undefined || analyticsConfig === null) {
304
- analyticsDebug('Analytics settings not found. Ignoring all analytics.');
305
- return undefined;
306
- }
307
- else {
308
- let uid = undefined;
309
- if (typeof analyticsConfig == 'string') {
310
- uid = analyticsConfig;
311
- }
312
- else if (typeof analyticsConfig == 'object' && typeof analyticsConfig['uid'] == 'string') {
313
- uid = analyticsConfig['uid'];
314
- }
315
- analyticsDebug('client id: %j', uid);
316
- if (uid == undefined) {
317
- return undefined;
318
- }
319
- return new analytics_collector_1.AnalyticsCollector(exports.AnalyticsProperties.AngularCliDefault, uid);
320
- }
321
- }
322
- catch (err) {
323
- analyticsDebug('Error happened during reading of analytics config: %s', err.message);
324
- return undefined;
325
- }
326
- }
327
- exports.getWorkspaceAnalytics = getWorkspaceAnalytics;
328
- /**
329
- * Return the usage analytics sharing setting, which is either a property string (GA-XXXXXXX-XX),
330
- * or undefined if no sharing.
331
- */
332
- async function getSharedAnalytics() {
333
- analyticsDebug('getSharedAnalytics');
334
- const envVarName = 'NG_CLI_ANALYTICS_SHARE';
335
- if (envVarName in process.env) {
336
- if (process.env[envVarName] == 'false' || process.env[envVarName] == '') {
337
- analyticsDebug('NG_CLI_ANALYTICS is false');
338
- return undefined;
339
- }
340
- }
341
- // If anything happens we just keep the NOOP analytics.
342
- try {
343
- const globalWorkspace = await (0, config_1.getWorkspace)('global');
344
- const analyticsConfig = globalWorkspace === null || globalWorkspace === void 0 ? void 0 : globalWorkspace.getCli()['analyticsSharing'];
345
- if (!analyticsConfig || !analyticsConfig.tracking || !analyticsConfig.uuid) {
346
- return undefined;
347
- }
348
- else {
349
- analyticsDebug('Analytics sharing info: %j', analyticsConfig);
350
- return new analytics_collector_1.AnalyticsCollector(analyticsConfig.tracking, analyticsConfig.uuid);
351
- }
352
- }
353
- catch (err) {
354
- analyticsDebug('Error happened during reading of analytics sharing config: %s', err.message);
355
- return undefined;
356
- }
357
- }
358
- exports.getSharedAnalytics = getSharedAnalytics;
@@ -1,35 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Architect, Target } from '@angular-devkit/architect';
9
- import { WorkspaceNodeModulesArchitectHost } from '@angular-devkit/architect/node';
10
- import { json } from '@angular-devkit/core';
11
- import { BaseCommandOptions, Command } from './command';
12
- import { Arguments } from './interface';
13
- export interface ArchitectCommandOptions extends BaseCommandOptions {
14
- project?: string;
15
- configuration?: string;
16
- prod?: boolean;
17
- target?: string;
18
- }
19
- export declare abstract class ArchitectCommand<T extends ArchitectCommandOptions = ArchitectCommandOptions> extends Command<T> {
20
- protected _architect: Architect;
21
- protected _architectHost: WorkspaceNodeModulesArchitectHost;
22
- protected _registry: json.schema.SchemaRegistry;
23
- protected readonly useReportAnalytics = false;
24
- protected multiTarget: boolean;
25
- target: string | undefined;
26
- missingTargetError: string | undefined;
27
- protected onMissingTarget(projectName?: string): Promise<void | number>;
28
- initialize(options: T & Arguments): Promise<number | void>;
29
- private warnOnMissingNodeModules;
30
- run(options: ArchitectCommandOptions & Arguments): Promise<number>;
31
- protected runSingleTarget(target: Target, targetOptions: string[]): Promise<0 | 1>;
32
- protected runArchitectTarget(options: ArchitectCommandOptions & Arguments): Promise<number>;
33
- private getProjectNamesByTarget;
34
- private _makeTargetSpecifier;
35
- }