forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandLineJson.ts
More file actions
294 lines (277 loc) · 7.89 KB
/
CommandLineJson.ts
File metadata and controls
294 lines (277 loc) · 7.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* "baseCommand" from command-line.schema.json
*/
export interface IBaseCommandJson {
commandKind: 'bulk' | 'global' | 'globalPlugin' | 'phased';
name: string;
summary: string;
/**
* If omitted, the summary will be used instead.
*/
description?: string;
safeForSimultaneousRushProcesses: boolean;
autoinstallerName?: string;
shellCommand?: string;
}
/**
* "bulkCommand" from command-line.schema.json
*/
export interface IBulkCommandJson extends IBaseCommandJson {
commandKind: 'bulk';
enableParallelism: boolean;
allowOversubscription?: boolean;
ignoreDependencyOrder?: boolean;
ignoreMissingScript?: boolean;
incremental?: boolean;
allowWarningsInSuccessfulBuild?: boolean;
watchForChanges?: boolean;
disableBuildCache?: boolean;
}
/**
* Base interface shared by the "phasedCommand" JSON entries and the post-processed
* "IPhase" interface in the CommandLineConfiguration
*/
export interface IPhasedCommandWithoutPhasesJson extends IBaseCommandJson {
commandKind: 'phased';
enableParallelism: boolean;
allowOversubscription?: boolean;
incremental?: boolean;
}
/**
* "phasedCommand" from command-line.schema.json
*/
export interface IPhasedCommandJson extends IPhasedCommandWithoutPhasesJson {
phases: string[];
watchOptions?: {
alwaysWatch: boolean;
debounceMs?: number;
watchPhases: string[];
};
installOptions?: {
alwaysInstall: boolean;
};
}
/**
* "globalCommand" from command-line.schema.json
*/
export interface IGlobalCommandJson extends IBaseCommandJson {
commandKind: 'global';
shellCommand: string;
}
/**
* "globalPluginCommand" from command-line.schema.json.
* A global command whose implementation is provided entirely by a Rush plugin.
* This command kind can only be used in command-line.json files provided by Rush plugins.
*/
export interface IGlobalPluginCommandJson extends IBaseCommandJson {
commandKind: 'globalPlugin';
}
export type CommandJson =
| IBulkCommandJson
| IGlobalCommandJson
| IGlobalPluginCommandJson
| IPhasedCommandJson;
/**
* The dependencies of a phase.
* @alpha
*/
export interface IPhaseDependencies {
/**
* Dependency phases within the same project.
*/
self?: string[];
/**
* Dependency phases in upstream projects.
*/
upstream?: string[];
}
/**
* A phase, used in the phased command feature.
* @alpha
*/
export interface IPhaseJson {
/**
* The name of the phase. Note that this value must start with the \"_phase:\" prefix.
*/
name: string;
/**
* The dependencies of this phase.
*/
dependencies?: IPhaseDependencies;
/**
* Normally Rush requires that each project's package.json has a \"scripts\" entry matching the phase name. To disable this check, set \"ignoreMissingScript\" to true.
*/
ignoreMissingScript?: boolean;
/**
* What should happen if the script is not defined in a project's package.json scripts field. Default is "error". Supersedes \"ignoreMissingScript\".
*/
missingScriptBehavior?: 'silent' | 'log' | 'error';
/**
* By default, Rush returns a nonzero exit code if errors or warnings occur during a command. If this option is set to \"true\", Rush will return a zero exit code if warnings occur during the execution of this phase.
*/
allowWarningsOnSuccess?: boolean;
}
/**
* "baseParameter" from command-line.schema.json
* @public
*/
export interface IBaseParameterJson {
/**
* Indicates the kind of syntax for this command-line parameter: \"flag\" or \"choice\" or \"string\" or \"stringList\" or \"integerList\" or \"choiceList\".
*/
parameterKind: 'flag' | 'choice' | 'string' | 'integer' | 'stringList' | 'integerList' | 'choiceList';
/**
* The name of the parameter (e.g. \"--verbose\"). This is a required field.
*/
longName: string;
/**
* An optional short form of the parameter (e.g. \"-v\" instead of \"--verbose\").
*/
shortName?: string;
/**
* A detailed description of the parameter, which appears when requesting help for the command (e.g. \"rush --help my-command\").
*/
description: string;
/**
* A list of custom commands and/or built-in Rush commands that this parameter may be used with, by name.
*/
associatedCommands?: string[];
/**
* A list of the names of the phases that this command-line parameter should be provided to.
*/
associatedPhases?: string[];
/**
* If true, then this parameter must be included on the command line.
*/
required?: boolean;
}
/**
* A custom command-line parameter whose presence acts as an on/off switch.
* @public
*/
export interface IFlagParameterJson extends IBaseParameterJson {
/**
* Denotes that this is a flag (boolean) parameter.
*/
parameterKind: 'flag';
}
/**
* Part of "choiceParameter" from command-line.schema.json
* @public
*/
export interface IChoiceParameterAlternativeJson {
/**
* A token that is one of the alternatives that can be used with the choice parameter, e.g. \"vanilla\" in \"--flavor vanilla\".
*/
name: string;
/**
* A detailed description for the alternative that will be shown in the command-line help.
*/
description: string;
}
/**
* A custom command-line parameter whose argument must be chosen from a list of allowable alternatives.
* @public
*/
export interface IChoiceParameterJson extends IBaseParameterJson {
/**
* Denotes that this is a choice parameter.
*/
parameterKind: 'choice';
/**
* A list of alternative argument values that can be chosen for this parameter.
*/
alternatives: IChoiceParameterAlternativeJson[];
/**
* If the parameter is omitted from the command line, this value will be inserted by default.
*/
defaultValue?: string;
}
/**
* A custom command-line parameter whose value is interpreted as a string.
* @public
*/
export interface IStringParameterJson extends IBaseParameterJson {
/**
* Denotes that this is a string parameter.
*/
parameterKind: 'string';
/**
* The name of the argument for this parameter.
*/
argumentName: string;
}
/**
* A custom command-line parameter whose value is interpreted as a integer.
* @public
*/
export interface IIntegerParameterJson extends IBaseParameterJson {
/**
* Denotes that this is a string parameter.
*/
parameterKind: 'integer';
/**
* The name of the argument for this parameter.
*/
argumentName: string;
}
/**
* A custom command-line parameter whose presence acts as a list of string
* @public
*/
export interface IStringListParameterJson extends IBaseParameterJson {
/**
* Denotes that this is a string list parameter.
*/
parameterKind: 'stringList';
/**
* The name of the argument for this parameter.
*/
argumentName: string;
}
/**
* A custom command-line parameter whose presence acts as a list of integer
* @public
*/
export interface IIntegerListParameterJson extends IBaseParameterJson {
/**
* Denotes that this is a integer list parameter.
*/
parameterKind: 'integerList';
/**
* The name of the argument for this parameter.
*/
argumentName: string;
}
/**
* A custom command-line parameter whose presence acts as a list of choice
* @public
*/
export interface IChoiceListParameterJson extends IBaseParameterJson {
/**
* Denotes that this is a choice list parameter.
*/
parameterKind: 'choiceList';
/**
* A list of alternative argument values that can be chosen for this parameter.
*/
alternatives: IChoiceParameterAlternativeJson[];
}
export type ParameterJson =
| IFlagParameterJson
| IChoiceParameterJson
| IStringParameterJson
| IIntegerParameterJson
| IStringListParameterJson
| IIntegerListParameterJson
| IChoiceListParameterJson;
/**
* Interfaces for the file format described by command-line.schema.json
*/
export interface ICommandLineJson {
commands?: CommandJson[];
phases?: IPhaseJson[];
parameters?: ParameterJson[];
}