Skip to content

Commit b638b8f

Browse files
committed
Add interfaces corresponding to command-line.schema.json
1 parent a2c2747 commit b638b8f

File tree

2 files changed

+78
-6
lines changed

2 files changed

+78
-6
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
/**
5+
* "baseCommand" from command-line.schema.json
6+
*/
7+
export interface IBaseCommandJson {
8+
commandKind: 'bulk' | 'global';
9+
name: string;
10+
summary: string;
11+
description: string;
12+
}
13+
14+
/**
15+
* "bulkCommand" from command-line.schema.json
16+
*/
17+
export interface IBulkCommandJson extends IBaseCommandJson {
18+
commandKind: 'bulk';
19+
parallelized: boolean;
20+
ignoreMissingScript?: boolean;
21+
}
22+
23+
/**
24+
* "globalCommand" from command-line.schema.json
25+
*/
26+
export interface IGlobalCommandJson extends IBaseCommandJson {
27+
commandKind: 'global';
28+
scriptPath: string;
29+
}
30+
31+
export type CommandJson = IBulkCommandJson | IGlobalCommandJson;
32+
33+
/**
34+
* "baseParameter" from command-line.schema.json
35+
*/
36+
export interface IBaseParameterJson {
37+
parameterKind: 'flag' | 'choice';
38+
longName: string;
39+
shortName?: string;
40+
description: string;
41+
associatedCommands: string[];
42+
}
43+
44+
/**
45+
* "flagParameter" from command-line.schema.json
46+
*/
47+
export interface IFlagParameterJson extends IBaseParameterJson {
48+
parameterKind: 'flag';
49+
}
50+
51+
/**
52+
* Part of "choiceParameter" from command-line.schema.json
53+
*/
54+
export interface IChoiceParameterAlternativeJson {
55+
name: string;
56+
description: string;
57+
}
58+
59+
/**
60+
* "choiceParameter" from command-line.schema.json
61+
*/
62+
export interface IChoiceParameterJson extends IBaseParameterJson {
63+
parameterKind: 'choice';
64+
alternatives: IChoiceParameterAlternativeJson[];
65+
defaultValue?: string;
66+
}
67+
68+
export type ParameterJson = IFlagParameterJson | IChoiceParameterJson;
69+
70+
/**
71+
* Interfaces for the file format described by command-line.schema.json
72+
*/
73+
export interface ICommandLineJson {
74+
commands?: CommandJson[];
75+
parameters?: ParameterJson[];
76+
}

apps/rush-lib/src/schemas/command-line.schema.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,11 @@
138138
{
139139
"type": "object",
140140
"additionalProperties": false,
141-
"required": [ "scriptPath", "alternatives" ],
141+
"required": [ "alternatives" ],
142142
"properties": {
143143
"parameterKind": {
144144
"enum": [ "choice" ]
145145
},
146-
"scriptPath": {
147-
"title": "Script Path",
148-
"description": "The relative path to a JavaScript file that will be invoked using the NodeJS engine. The path is relative to the repository root folder that contains rush.json.",
149-
"type": "string"
150-
},
151146
"alternatives": {
152147
"title": "Alternatives",
153148
"description": "A list of alternative argument values that can be chosen for this parameter.",
@@ -184,6 +179,7 @@
184179

185180
"type": "object",
186181
"additionalProperties": false,
182+
"required": [ ],
187183

188184
"properties": {
189185
"$schema": {

0 commit comments

Comments
 (0)