Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
william2958 committed Aug 26, 2024
1 parent e898f19 commit 6ab7fd2
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 202 deletions.
2 changes: 1 addition & 1 deletion common/reviews/api/rush-lib.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ export class RushConfiguration {
// Warning: (ae-forgotten-export) The symbol "IRushProjectsJson" needs to be exported by the entry point index.d.ts
//
// @internal
readonly rushProjectsJson: IRushProjectsJson | undefined;
readonly _rushProjectsJson: IRushProjectsJson | undefined;
readonly shrinkwrapFilename: string;
get shrinkwrapFilePhrase(): string;
// @beta
Expand Down
13 changes: 8 additions & 5 deletions libraries/rush-lib/src/api/RushConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export class RushConfiguration {
*
* @internal
*/
public readonly rushProjectsJson: IRushProjectsJson | undefined;
public readonly _rushProjectsJson: IRushProjectsJson | undefined;

/**
* The absolute path to the "rush.json" configuration file that was loaded to construct this object.
Expand Down Expand Up @@ -884,13 +884,15 @@ export class RushConfiguration {

// Look for rush projects in a seperate file first, and if it does not exist fallback onto rush.json

const resolvedRushProjectsFilename: string = path.resolve(
`${path.dirname(this.rushJsonFile)}/${RushConstants.rushProjectsFilename}`
);
const resolvedRushProjectsFilename: string = `${this.rushJsonFolder}/${RushConstants.rushProjectsFilename}`;
let rushProjects: IRushConfigurationProjectJson[] | undefined;
if (FileSystem.exists(resolvedRushProjectsFilename)) {
try {
const rushProjectsJson: IRushProjectsJson = JsonFile.load(resolvedRushProjectsFilename);
rushProjects = rushProjectsJson.projects;
} catch (e) {
if (!FileSystem.isNotExistError(e)) {
throw e;
}
}
if (this.rushConfigurationJson.projects) {
if (rushProjects) {
Expand All @@ -900,6 +902,7 @@ export class RushConfiguration {
}
rushProjects = this.rushConfigurationJson.projects;
}

if (!rushProjects) {
throw new Error(
`The rush.json is missing a projects field, and a seperate ${RushConstants.rushProjectsFilename} file is missing. Rush projects need to be defined in one of the two places.`
Expand Down
136 changes: 3 additions & 133 deletions libraries/rush-lib/src/schemas/projects.schema.json
Original file line number Diff line number Diff line change
@@ -1,146 +1,16 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Rush main config File",
"description": "The main configuration file for the Rush multi-project build tool. See http://rushjs.io for details.",
"title": "Rush main project list config File",
"description": "The configuration file for the projects used in a Rush monorepo.",
"type": "object",

"definitions": {
"environmentVariables": {
"description": "Environment variables for the package manager",
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"value": {
"type": "string"
},
"override": {
"type": "boolean"
}
},
"additionalProperties": false
}
}
},

"properties": {
"$schema": {
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
"type": "string"
},
"projects": {
"description": "A list of projects managed by this tool.",
"type": "array",
"items": {
"type": "object",
"properties": {
"packageName": {
"description": "The NPM package name of the project.",
"type": "string"
},
"projectFolder": {
"description": "The path to the project folder relative to the Rush config file.",
"type": "string"
},
"reviewCategory": {
"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.",
"type": "string"
},
"cyclicDependencyProjects": {
"description": "(Deprecated) This field was renamed to \"decoupledLocalDependencies\".",
"type": "array",
"items": {
"type": "string"
}
},
"decoupledLocalDependencies": {
"description": "A list of local projects that appear as devDependencies for this project, but cannot be locally linked because it would create a cyclic dependency; instead, the last published version will be installed in the Common folder.",
"type": "array",
"items": {
"type": "string"
}
},
"shouldPublish": {
"description": "A flag indicating that changes to this project will be published to npm, which affects the Rush change and publish workflows.",
"type": "boolean"
},
"skipRushCheck": {
"description": "If true, then this project will be ignored by the \"rush check\" command. The default value is false.",
"type": "boolean"
},
"versionPolicyName": {
"description": "An optional version policy associated with the project. Version policies are defined in \"version-policies.json\" file.",
"type": "string"
},
"publishFolder": {
"description": "Facilitates postprocessing of a project's files prior to publishing. If specified, the \"publishFolder\" is the relative path to a subfolder of the project folder. The \"rush publish\" command will publish the subfolder instead of the project folder. The subfolder must contain its own package.json file, which is typically a build output.",
"type": "string"
},
"tags": {
"description": "An optional set of custom tags that can be used to select this project. For example, adding \"my-custom-tag\" will allow this project to be selected by the command \"rush list --only tag:my-custom-tag\". The tag name must be one or more words separated by hyphens or slashes, where a word may contain lowercase ASCII letters, digits, \".\", and \"@\" characters.",
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z0-9.@]+([-/][a-z0-9.@]+)*$"
}
},
"subspaceName": {
"description": "(EXPERIMENTAL) An optional entry for specifying which subspace this project belongs to if the subspaces feature is enabled.",
"type": "string"
}
},
"additionalProperties": false,
"required": ["packageName", "projectFolder"]
}
},
"eventHooks": {
"description": "Hooks are customized script actions that Rush executes when specific events occur.",
"type": "object",
"properties": {
"preRushInstall": {
"description": "The list of scripts to run before the Rush installation starts.",
"type": "array",
"items": {
"type": "string"
}
},
"postRushInstall": {
"description": "The list of scripts to run after the Rush installation finishes.",
"type": "array",
"items": {
"type": "string"
}
},
"preRushBuild": {
"description": "The list of scripts to run before the Rush build command starts.",
"type": "array",
"items": {
"type": "string"
}
},
"postRushBuild": {
"description": "The list of scripts to run after the Rush build command finishes.",
"type": "array",
"items": {
"type": "string"
}
},
"preRushx": {
"description": "The list of scripts to run before rushx starts.",
"type": "array",
"items": {
"type": "string"
}
},
"postRushx": {
"description": "The list of scripts to run after rushx finishes.",
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
"description": "A list of projects managed by this tool."
}
},
"additionalProperties": false,
Expand Down
67 changes: 67 additions & 0 deletions libraries/rush-lib/src/schemas/rush-project-config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Project list managed by rush.",
"description": "A list of projects managed by rush.",
"type": "array",
"items": {
"type": "object",
"properties": {
"packageName": {
"description": "The NPM package name of the project.",
"type": "string"
},
"projectFolder": {
"description": "The path to the project folder relative to the Rush config file.",
"type": "string"
},
"reviewCategory": {
"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.",
"type": "string"
},
"cyclicDependencyProjects": {
"description": "(Deprecated) This field was renamed to \"decoupledLocalDependencies\".",
"type": "array",
"items": {
"type": "string"
}
},
"decoupledLocalDependencies": {
"description": "A list of local projects that appear as devDependencies for this project, but cannot be locally linked because it would create a cyclic dependency; instead, the last published version will be installed in the Common folder.",
"type": "array",
"items": {
"type": "string"
}
},
"shouldPublish": {
"description": "A flag indicating that changes to this project will be published to npm, which affects the Rush change and publish workflows.",
"type": "boolean"
},
"skipRushCheck": {
"description": "If true, then this project will be ignored by the \"rush check\" command. The default value is false.",
"type": "boolean"
},
"versionPolicyName": {
"description": "An optional version policy associated with the project. Version policies are defined in \"version-policies.json\" file.",
"type": "string"
},
"publishFolder": {
"description": "Facilitates postprocessing of a project's files prior to publishing. If specified, the \"publishFolder\" is the relative path to a subfolder of the project folder. The \"rush publish\" command will publish the subfolder instead of the project folder. The subfolder must contain its own package.json file, which is typically a build output.",
"type": "string"
},
"tags": {
"description": "An optional set of custom tags that can be used to select this project. For example, adding \"my-custom-tag\" will allow this project to be selected by the command \"rush list --only tag:my-custom-tag\". The tag name must be one or more words separated by hyphens or slashes, where a word may contain lowercase ASCII letters, digits, \".\", and \"@\" characters.",
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z0-9.@]+([-/][a-z0-9.@]+)*$"
}
},
"subspaceName": {
"description": "(EXPERIMENTAL) An optional entry for specifying which subspace this project belongs to if the subspaces feature is enabled.",
"type": "string"
}
},
"additionalProperties": false,
"required": ["packageName", "projectFolder"]
}
}
64 changes: 1 addition & 63 deletions libraries/rush-lib/src/schemas/rush.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,69 +239,7 @@
}
},
"projects": {
"description": "A list of projects managed by this tool.",
"type": "array",
"items": {
"type": "object",
"properties": {
"packageName": {
"description": "The NPM package name of the project.",
"type": "string"
},
"projectFolder": {
"description": "The path to the project folder relative to the Rush config file.",
"type": "string"
},
"reviewCategory": {
"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.",
"type": "string"
},
"cyclicDependencyProjects": {
"description": "(Deprecated) This field was renamed to \"decoupledLocalDependencies\".",
"type": "array",
"items": {
"type": "string"
}
},
"decoupledLocalDependencies": {
"description": "A list of local projects that appear as devDependencies for this project, but cannot be locally linked because it would create a cyclic dependency; instead, the last published version will be installed in the Common folder.",
"type": "array",
"items": {
"type": "string"
}
},
"shouldPublish": {
"description": "A flag indicating that changes to this project will be published to npm, which affects the Rush change and publish workflows.",
"type": "boolean"
},
"skipRushCheck": {
"description": "If true, then this project will be ignored by the \"rush check\" command. The default value is false.",
"type": "boolean"
},
"versionPolicyName": {
"description": "An optional version policy associated with the project. Version policies are defined in \"version-policies.json\" file.",
"type": "string"
},
"publishFolder": {
"description": "Facilitates postprocessing of a project's files prior to publishing. If specified, the \"publishFolder\" is the relative path to a subfolder of the project folder. The \"rush publish\" command will publish the subfolder instead of the project folder. The subfolder must contain its own package.json file, which is typically a build output.",
"type": "string"
},
"tags": {
"description": "An optional set of custom tags that can be used to select this project. For example, adding \"my-custom-tag\" will allow this project to be selected by the command \"rush list --only tag:my-custom-tag\". The tag name must be one or more words separated by hyphens or slashes, where a word may contain lowercase ASCII letters, digits, \".\", and \"@\" characters.",
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z0-9.@]+([-/][a-z0-9.@]+)*$"
}
},
"subspaceName": {
"description": "(EXPERIMENTAL) An optional entry for specifying which subspace this project belongs to if the subspaces feature is enabled.",
"type": "string"
}
},
"additionalProperties": false,
"required": ["packageName", "projectFolder"]
}
"description": "A list of projects managed by this tool."
},
"eventHooks": {
"description": "Hooks are customized script actions that Rush executes when specific events occur.",
Expand Down

0 comments on commit 6ab7fd2

Please sign in to comment.