Skip to content

Commit ec0071c

Browse files
yumikoheyCopilot
andcommitted
[rush] Add an optional "description" field for rush.json project entries
Allow project entries in rush.json to specify an optional, human-readable "description" string, and expose it as the new (beta) RushConfigurationProject.description property. Rush does not interpret the value; it is available to people and tools reading the project inventory. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7a0348d commit ec0071c

7 files changed

Lines changed: 42 additions & 1 deletion

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Add an optional \"description\" field for project entries in rush.json, exposed as the new `RushConfigurationProject.description` API.",
5+
"type": "none",
6+
"packageName": "@microsoft/rush"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "3360621+yumikohey@users.noreply.github.com"
11+
}

‎common/reviews/api/rush-lib.api.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,6 +1799,8 @@ export class RushConfigurationProject {
17991799
get cyclicDependencyProjects(): Set<string>;
18001800
readonly decoupledLocalDependencies: Set<string>;
18011801
get dependencyProjects(): ReadonlySet<RushConfigurationProject>;
1802+
// @beta
1803+
readonly description: string | undefined;
18021804
// @deprecated
18031805
get downstreamDependencyProjects(): string[];
18041806
// @beta

‎libraries/rush-lib/assets/rush-init/rush.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,13 @@
389389
*/
390390
"projectFolder": "apps/my-app",
391391

392+
/**
393+
* An optional human-readable description of the project, for example a one-line
394+
* summary of its purpose. Rush does not interpret this value, but it is available
395+
* to tools and plugins via the Rush API.
396+
*/
397+
/*[LINE "HYPOTHETICAL"]*/ "description": "The main web application for the example repo",
398+
392399
/**
393400
* This field is only used if "subspacesEnabled" is true in subspaces.json.
394401
* It specifies the subspace that this project belongs to. If omitted, then the

‎libraries/rush-lib/src/api/RushConfigurationProject.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import type { Subspace } from './Subspace';
2222
export interface IRushConfigurationProjectJson {
2323
packageName: string;
2424
projectFolder: string;
25+
description?: string;
2526
reviewCategory?: string;
2627
decoupledLocalDependencies: string[];
2728
cyclicDependencyProjects?: string[];
@@ -95,6 +96,18 @@ export class RushConfigurationProject {
9596
*/
9697
public readonly projectRelativeFolder: string;
9798

99+
/**
100+
* An optional human-readable description of the project, as specified by the `"description"`
101+
* field in `rush.json`, or `undefined` if no description was provided.
102+
*
103+
* @remarks
104+
* Rush does not interpret this value; it is intended to help people and tools understand
105+
* the purpose of the project.
106+
*
107+
* @beta
108+
*/
109+
public readonly description: string | undefined;
110+
98111
/**
99112
* The project-specific Rush configuration folder.
100113
*
@@ -211,10 +224,11 @@ export class RushConfigurationProject {
211224
/** @internal */
212225
public constructor(options: IRushConfigurationProjectOptions) {
213226
const { projectJson, rushConfiguration, tempProjectName, allowedProjectTags } = options;
214-
const { packageName, projectFolder: projectRelativeFolder } = projectJson;
227+
const { packageName, projectFolder: projectRelativeFolder, description } = projectJson;
215228
this.rushConfiguration = rushConfiguration;
216229
this.packageName = packageName;
217230
this.projectRelativeFolder = projectRelativeFolder;
231+
this.description = description;
218232

219233
validateRelativePathField(projectRelativeFolder, 'projectFolder', rushConfiguration.rushJsonFile);
220234

‎libraries/rush-lib/src/api/test/RushConfiguration.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ describe(RushConfiguration.name, () => {
104104
expect(project1.tempProjectName).toEqual('@rush-temp/project1');
105105
expect(project1.unscopedTempProjectName).toEqual('project1');
106106
expect(project1.skipRushCheck).toEqual(false);
107+
expect(project1.description).toEqual('An example project with a description');
107108

108109
// Validate project2 settings
109110
const project2: RushConfigurationProject = rushConfiguration.getProjectByName('project2')!;
110111
expect(project2.skipRushCheck).toEqual(true);
112+
expect(project2.description).toBeUndefined();
111113
});
112114

113115
it('can load repo/rush-pnpm.json', () => {

‎libraries/rush-lib/src/api/test/repo/rush-npm.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
{
2828
"packageName": "project1",
2929
"projectFolder": "project1",
30+
"description": "An example project with a description",
3031
"reviewCategory": "third-party",
3132
"tags": ["frontend", "ui"],
3233
"versionPolicyName": "testPolicy"

‎libraries/rush-lib/src/schemas/rush.schema.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,10 @@
356356
"description": "The path to the project folder relative to the Rush config file.",
357357
"type": "string"
358358
},
359+
"description": {
360+
"description": "An optional human-readable description of the project, for example a one-line summary of its purpose. Rush does not interpret this value, but it is available to tools and plugins via the Rush API.",
361+
"type": "string"
362+
},
359363
"reviewCategory": {
360364
"description": "An optional category for usage in the \"browser-approved-packages.json\" and \"nonbrowser-approved-packages.json\" files. Only strings from reviewCategories are allowed here.",
361365
"type": "string"

0 commit comments

Comments
 (0)