@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
package/models/parser.js DELETED
@@ -1,349 +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
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.parseArguments = exports.parseFreeFormArguments = exports.ParseArgumentException = void 0;
11
- const core_1 = require("@angular-devkit/core");
12
- const interface_1 = require("./interface");
13
- class ParseArgumentException extends core_1.BaseException {
14
- constructor(comments, parsed, ignored) {
15
- super(`One or more errors occurred while parsing arguments:\n ${comments.join('\n ')}`);
16
- this.comments = comments;
17
- this.parsed = parsed;
18
- this.ignored = ignored;
19
- }
20
- }
21
- exports.ParseArgumentException = ParseArgumentException;
22
- function _coerceType(str, type, v) {
23
- switch (type) {
24
- case interface_1.OptionType.Any:
25
- if (Array.isArray(v)) {
26
- return v.concat(str || '');
27
- }
28
- return _coerceType(str, interface_1.OptionType.Boolean, v) !== undefined
29
- ? _coerceType(str, interface_1.OptionType.Boolean, v)
30
- : _coerceType(str, interface_1.OptionType.Number, v) !== undefined
31
- ? _coerceType(str, interface_1.OptionType.Number, v)
32
- : _coerceType(str, interface_1.OptionType.String, v);
33
- case interface_1.OptionType.String:
34
- return str || '';
35
- case interface_1.OptionType.Boolean:
36
- switch (str) {
37
- case 'false':
38
- return false;
39
- case undefined:
40
- case '':
41
- case 'true':
42
- return true;
43
- default:
44
- return undefined;
45
- }
46
- case interface_1.OptionType.Number:
47
- if (str === undefined) {
48
- return 0;
49
- }
50
- else if (str === '') {
51
- return undefined;
52
- }
53
- else if (Number.isFinite(+str)) {
54
- return +str;
55
- }
56
- else {
57
- return undefined;
58
- }
59
- case interface_1.OptionType.Array:
60
- return Array.isArray(v)
61
- ? v.concat(str || '')
62
- : v === undefined
63
- ? [str || '']
64
- : [v + '', str || ''];
65
- default:
66
- return undefined;
67
- }
68
- }
69
- function _coerce(str, o, v) {
70
- if (!o) {
71
- return _coerceType(str, interface_1.OptionType.Any, v);
72
- }
73
- else {
74
- const types = o.types || [o.type];
75
- // Try all the types one by one and pick the first one that returns a value contained in the
76
- // enum. If there's no enum, just return the first one that matches.
77
- for (const type of types) {
78
- const maybeResult = _coerceType(str, type, v);
79
- if (maybeResult !== undefined && (!o.enum || o.enum.includes(maybeResult))) {
80
- return maybeResult;
81
- }
82
- }
83
- return undefined;
84
- }
85
- }
86
- function _getOptionFromName(name, options) {
87
- const camelName = /(-|_)/.test(name) ? core_1.strings.camelize(name) : name;
88
- for (const option of options) {
89
- if (option.name === name || option.name === camelName) {
90
- return option;
91
- }
92
- if (option.aliases.some((x) => x === name || x === camelName)) {
93
- return option;
94
- }
95
- }
96
- return undefined;
97
- }
98
- function _removeLeadingDashes(key) {
99
- const from = key.startsWith('--') ? 2 : key.startsWith('-') ? 1 : 0;
100
- return key.substr(from);
101
- }
102
- function _assignOption(arg, nextArg, { options, parsedOptions, leftovers, ignored, errors, warnings, }) {
103
- const from = arg.startsWith('--') ? 2 : 1;
104
- let consumedNextArg = false;
105
- let key = arg.substr(from);
106
- let option = null;
107
- let value = '';
108
- const i = arg.indexOf('=');
109
- // If flag is --no-abc AND there's no equal sign.
110
- if (i == -1) {
111
- if (key.startsWith('no')) {
112
- // Only use this key if the option matching the rest is a boolean.
113
- const from = key.startsWith('no-') ? 3 : 2;
114
- const maybeOption = _getOptionFromName(core_1.strings.camelize(key.substr(from)), options);
115
- if (maybeOption && maybeOption.type == 'boolean') {
116
- value = 'false';
117
- option = maybeOption;
118
- }
119
- }
120
- if (option === null) {
121
- // Set it to true if it's a boolean and the next argument doesn't match true/false.
122
- const maybeOption = _getOptionFromName(key, options);
123
- if (maybeOption) {
124
- value = nextArg;
125
- let shouldShift = true;
126
- if (value && value.startsWith('-') && _coerce(undefined, maybeOption) !== undefined) {
127
- // Verify if not having a value results in a correct parse, if so don't shift.
128
- shouldShift = false;
129
- }
130
- // Only absorb it if it leads to a better value.
131
- if (shouldShift && _coerce(value, maybeOption) !== undefined) {
132
- consumedNextArg = true;
133
- }
134
- else {
135
- value = '';
136
- }
137
- option = maybeOption;
138
- }
139
- }
140
- }
141
- else {
142
- key = arg.substring(0, i);
143
- option = _getOptionFromName(_removeLeadingDashes(key), options) || null;
144
- if (option) {
145
- value = arg.substring(i + 1);
146
- }
147
- }
148
- if (option === null) {
149
- if (nextArg && !nextArg.startsWith('-')) {
150
- leftovers.push(arg, nextArg);
151
- consumedNextArg = true;
152
- }
153
- else {
154
- leftovers.push(arg);
155
- }
156
- }
157
- else {
158
- const v = _coerce(value, option, parsedOptions[option.name]);
159
- if (v !== undefined) {
160
- if (parsedOptions[option.name] !== v) {
161
- if (parsedOptions[option.name] !== undefined && option.type !== interface_1.OptionType.Array) {
162
- warnings.push(`Option ${JSON.stringify(option.name)} was already specified with value ` +
163
- `${JSON.stringify(parsedOptions[option.name])}. The new value ${JSON.stringify(v)} ` +
164
- `will override it.`);
165
- }
166
- parsedOptions[option.name] = v;
167
- }
168
- }
169
- else {
170
- let error = `Argument ${key} could not be parsed using value ${JSON.stringify(value)}.`;
171
- if (option.enum) {
172
- error += ` Valid values are: ${option.enum.map((x) => JSON.stringify(x)).join(', ')}.`;
173
- }
174
- else {
175
- error += `Valid type(s) is: ${(option.types || [option.type]).join(', ')}`;
176
- }
177
- errors.push(error);
178
- ignored.push(arg);
179
- }
180
- if (/^[a-z]+[A-Z]/.test(key)) {
181
- warnings.push('Support for camel case arguments has been deprecated and will be removed in a future major version.\n' +
182
- `Use '--${core_1.strings.dasherize(key)}' instead of '--${key}'.`);
183
- }
184
- }
185
- return consumedNextArg;
186
- }
187
- /**
188
- * Parse the arguments in a consistent way, but without having any option definition. This tries
189
- * to assess what the user wants in a free form. For example, using `--name=false` will set the
190
- * name properties to a boolean type.
191
- * This should only be used when there's no schema available or if a schema is "true" (anything is
192
- * valid).
193
- *
194
- * @param args Argument list to parse.
195
- * @returns An object that contains a property per flags from the args.
196
- */
197
- function parseFreeFormArguments(args) {
198
- const parsedOptions = {};
199
- const leftovers = [];
200
- for (let arg = args.shift(); arg !== undefined; arg = args.shift()) {
201
- if (arg == '--') {
202
- leftovers.push(...args);
203
- break;
204
- }
205
- if (arg.startsWith('--')) {
206
- const eqSign = arg.indexOf('=');
207
- let name;
208
- let value;
209
- if (eqSign !== -1) {
210
- name = arg.substring(2, eqSign);
211
- value = arg.substring(eqSign + 1);
212
- }
213
- else {
214
- name = arg.substr(2);
215
- value = args.shift();
216
- }
217
- const v = _coerce(value, null, parsedOptions[name]);
218
- if (v !== undefined) {
219
- parsedOptions[name] = v;
220
- }
221
- }
222
- else if (arg.startsWith('-')) {
223
- arg.split('').forEach((x) => (parsedOptions[x] = true));
224
- }
225
- else {
226
- leftovers.push(arg);
227
- }
228
- }
229
- if (leftovers.length) {
230
- parsedOptions['--'] = leftovers;
231
- }
232
- return parsedOptions;
233
- }
234
- exports.parseFreeFormArguments = parseFreeFormArguments;
235
- /**
236
- * Parse the arguments in a consistent way, from a list of standardized options.
237
- * The result object will have a key per option name, with the `_` key reserved for positional
238
- * arguments, and `--` will contain everything that did not match. Any key that don't have an
239
- * option will be pushed back in `--` and removed from the object. If you need to validate that
240
- * there's no additionalProperties, you need to check the `--` key.
241
- *
242
- * @param args The argument array to parse.
243
- * @param options List of supported options. {@see Option}.
244
- * @param logger Logger to use to warn users.
245
- * @returns An object that contains a property per option.
246
- */
247
- function parseArguments(args, options, logger) {
248
- if (options === null) {
249
- options = [];
250
- }
251
- const leftovers = [];
252
- const positionals = [];
253
- const parsedOptions = {};
254
- const ignored = [];
255
- const errors = [];
256
- const warnings = [];
257
- const state = { options, parsedOptions, positionals, leftovers, ignored, errors, warnings };
258
- for (let argIndex = 0; argIndex < args.length; argIndex++) {
259
- const arg = args[argIndex];
260
- let consumedNextArg = false;
261
- if (arg == '--') {
262
- // If we find a --, we're done.
263
- leftovers.push(...args.slice(argIndex + 1));
264
- break;
265
- }
266
- if (arg.startsWith('--')) {
267
- consumedNextArg = _assignOption(arg, args[argIndex + 1], state);
268
- }
269
- else if (arg.startsWith('-')) {
270
- // Argument is of form -abcdef. Starts at 1 because we skip the `-`.
271
- for (let i = 1; i < arg.length; i++) {
272
- const flag = arg[i];
273
- // If the next character is an '=', treat it as a long flag.
274
- if (arg[i + 1] == '=') {
275
- const f = '-' + flag + arg.slice(i + 1);
276
- consumedNextArg = _assignOption(f, args[argIndex + 1], state);
277
- break;
278
- }
279
- // Treat the last flag as `--a` (as if full flag but just one letter). We do this in
280
- // the loop because it saves us a check to see if the arg is just `-`.
281
- if (i == arg.length - 1) {
282
- const arg = '-' + flag;
283
- consumedNextArg = _assignOption(arg, args[argIndex + 1], state);
284
- }
285
- else {
286
- const maybeOption = _getOptionFromName(flag, options);
287
- if (maybeOption) {
288
- const v = _coerce(undefined, maybeOption, parsedOptions[maybeOption.name]);
289
- if (v !== undefined) {
290
- parsedOptions[maybeOption.name] = v;
291
- }
292
- }
293
- }
294
- }
295
- }
296
- else {
297
- positionals.push(arg);
298
- }
299
- if (consumedNextArg) {
300
- argIndex++;
301
- }
302
- }
303
- // Deal with positionals.
304
- // TODO(hansl): this is by far the most complex piece of code in this file. Try to refactor it
305
- // simpler.
306
- if (positionals.length > 0) {
307
- let pos = 0;
308
- for (let i = 0; i < positionals.length;) {
309
- let found = false;
310
- let incrementPos = false;
311
- let incrementI = true;
312
- // We do this with a found flag because more than 1 option could have the same positional.
313
- for (const option of options) {
314
- // If any option has this positional and no value, AND fit the type, we need to remove it.
315
- if (option.positional === pos) {
316
- const coercedValue = _coerce(positionals[i], option, parsedOptions[option.name]);
317
- if (parsedOptions[option.name] === undefined && coercedValue !== undefined) {
318
- parsedOptions[option.name] = coercedValue;
319
- found = true;
320
- }
321
- else {
322
- incrementI = false;
323
- }
324
- incrementPos = true;
325
- }
326
- }
327
- if (found) {
328
- positionals.splice(i--, 1);
329
- }
330
- if (incrementPos) {
331
- pos++;
332
- }
333
- if (incrementI) {
334
- i++;
335
- }
336
- }
337
- }
338
- if (positionals.length > 0 || leftovers.length > 0) {
339
- parsedOptions['--'] = [...positionals, ...leftovers];
340
- }
341
- if (warnings.length > 0 && logger) {
342
- warnings.forEach((message) => logger.warn(message));
343
- }
344
- if (errors.length > 0) {
345
- throw new ParseArgumentException(errors, parsedOptions, ignored);
346
- }
347
- return parsedOptions;
348
- }
349
- exports.parseArguments = parseArguments;
@@ -1,55 +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 { logging } from '@angular-devkit/core';
9
- import { workflow } from '@angular-devkit/schematics';
10
- import { FileSystemCollection, FileSystemEngine, FileSystemSchematic, NodeWorkflow } from '@angular-devkit/schematics/tools';
11
- import { BaseCommandOptions, Command } from './command';
12
- import { Arguments, CommandContext, CommandDescription, Option } from './interface';
13
- export interface BaseSchematicSchema {
14
- debug?: boolean;
15
- dryRun?: boolean;
16
- force?: boolean;
17
- interactive?: boolean;
18
- defaults?: boolean;
19
- packageRegistry?: string;
20
- }
21
- export interface RunSchematicOptions extends BaseSchematicSchema {
22
- collectionName: string;
23
- schematicName: string;
24
- additionalOptions?: {
25
- [key: string]: {};
26
- };
27
- schematicOptions?: string[];
28
- showNothingDone?: boolean;
29
- }
30
- export declare class UnknownCollectionError extends Error {
31
- constructor(collectionName: string);
32
- }
33
- export declare abstract class SchematicCommand<T extends BaseSchematicSchema & BaseCommandOptions> extends Command<T> {
34
- protected readonly allowPrivateSchematics: boolean;
35
- protected readonly useReportAnalytics = false;
36
- protected _workflow: NodeWorkflow;
37
- protected defaultCollectionName: string;
38
- protected collectionName: string;
39
- protected schematicName?: string;
40
- constructor(context: CommandContext, description: CommandDescription, logger: logging.Logger);
41
- initialize(options: T & Arguments): Promise<void>;
42
- printHelp(): Promise<number>;
43
- printHelpUsage(): Promise<void>;
44
- protected getEngine(): FileSystemEngine;
45
- protected getCollection(collectionName: string): FileSystemCollection;
46
- protected getSchematic(collection: FileSystemCollection, schematicName: string, allowPrivate?: boolean): FileSystemSchematic;
47
- protected setPathOptions(options: Option[], workingDir: string): {
48
- [name: string]: string;
49
- };
50
- protected createWorkflow(options: BaseSchematicSchema): Promise<workflow.BaseWorkflow>;
51
- protected getDefaultSchematicCollection(): Promise<string>;
52
- protected runSchematic(options: RunSchematicOptions): Promise<number | void>;
53
- protected parseFreeFormArguments(schematicOptions: string[]): Promise<Arguments>;
54
- protected parseArguments(schematicOptions: string[], options: Option[] | null): Promise<Arguments>;
55
- }