Skip to content

Commit d520136

Browse files
authored
[rush-lib] Add subspaceName information to the output of the rush list command when subspace feature is enabled (microsoft#5463)
Co-authored-by: LPegasus <lpegasus@users.noreply.github.com>
1 parent a6dcf1a commit d520136

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "Add subspaceName to the output of the `rush list` command",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

libraries/rush-lib/src/cli/actions/ListAction.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export interface IJsonEntry {
4545
* @see {@link ../../api/RushConfigurationProject#RushConfigurationProject.tags | RushConfigurationProject.tags}
4646
*/
4747
tags: string[];
48+
/**
49+
* @see {@link ../../api/Subspace#Subspace.subspaceName | Subspace.subspaceName}
50+
*/
51+
subspaceName: string | undefined;
4852
}
4953

5054
export interface IJsonOutput {
@@ -145,6 +149,7 @@ export class ListAction extends BaseRushAction {
145149
let shouldPublish: undefined | boolean;
146150
let versionPolicy: undefined | string;
147151
let versionPolicyName: undefined | string;
152+
let subspaceName: undefined | string;
148153
if (config.versionPolicy !== undefined) {
149154
const definitionName: string = VersionPolicyDefinitionName[config.versionPolicy.definitionName];
150155
versionPolicy = `${definitionName}`;
@@ -157,6 +162,10 @@ export class ListAction extends BaseRushAction {
157162
reviewCategory = config.reviewCategory;
158163
}
159164

165+
if (this.rushConfiguration.subspacesFeatureEnabled) {
166+
subspaceName = config.subspace.subspaceName;
167+
}
168+
160169
return {
161170
name: config.packageName,
162171
version: config.packageJson.version,
@@ -166,7 +175,8 @@ export class ListAction extends BaseRushAction {
166175
versionPolicyName,
167176
shouldPublish,
168177
reviewCategory,
169-
tags: Array.from(config.tags)
178+
tags: Array.from(config.tags),
179+
subspaceName
170180
};
171181
});
172182

@@ -186,6 +196,10 @@ export class ListAction extends BaseRushAction {
186196

187197
private async _printListTableAsync(selection: Set<RushConfigurationProject>): Promise<void> {
188198
const tableHeader: string[] = ['Project'];
199+
if (this.rushConfiguration.subspacesFeatureEnabled) {
200+
tableHeader.push('Subspace');
201+
}
202+
189203
if (this._version.value || this._detailedFlag.value) {
190204
tableHeader.push('Version');
191205
}
@@ -219,6 +233,10 @@ export class ListAction extends BaseRushAction {
219233

220234
appendToPackageRow(project.packageName);
221235

236+
if (this.rushConfiguration.subspacesFeatureEnabled) {
237+
appendToPackageRow(project.subspace.subspaceName);
238+
}
239+
222240
if (this._version.value || this._detailedFlag.value) {
223241
appendToPackageRow(project.packageJson.version);
224242
}

0 commit comments

Comments
 (0)