-
Notifications
You must be signed in to change notification settings - Fork 678
[rush-lib] Abstract rush publish from npm only and introduce pluggable publish provider
#5619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 26 commits
5dbcf9d
0683ab2
e99ba6d
89f3ba6
01c3ee6
3cb77df
13dfb42
fba09e0
f02571f
148068c
381360f
895c676
9cad3b7
b5d735d
619e8c0
732921c
18bc9aa
186aa1b
e335dca
486acea
1cbf8f7
1d80df2
aac9cc7
6c61a5f
f3b9c82
98b9c97
0d2064c
47c2319
aad8dbe
9b994ed
37c223b
55528d3
e23f38f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
TheLarkInn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "mcpServers": { | ||
| "deepwiki": { | ||
| "type": "http", | ||
| "url": "https://mcp.deepwiki.com/mcp" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # Rush Stack Monorepo | ||
|
|
||
| ## Overview | ||
| Microsoft's Rush Stack: ~130 TypeScript projects providing the Rush monorepo manager, Heft build system, API Extractor, ESLint configs, webpack plugins, and supporting libraries. Managed by Rush v5 with pnpm. | ||
|
|
||
| ## Monorepo Structure | ||
| All projects are exactly 2 levels deep (e.g., `apps/rush`, `libraries/node-core-library`). | ||
|
|
||
| | Path | Purpose | | ||
| |------|---------| | ||
| | `apps/` | Published CLI tools (Rush, Heft, API Extractor, etc.) | | ||
| | `libraries/` | Core shared libraries | | ||
| | `heft-plugins/` | Heft build system plugins | | ||
| | `rush-plugins/` | Rush monorepo plugins | | ||
| | `webpack/` | Webpack loaders and plugins | | ||
| | `eslint/` | ESLint configs, plugins, patches | | ||
| | `rigs/` | Shared build configurations (rig packages) | | ||
| | `vscode-extensions/` | VS Code extensions | | ||
| | `build-tests/` | Integration/scenario tests (non-shipping) | | ||
| | `build-tests-samples/` | Tutorial sample projects (non-shipping) | | ||
| | `common/` | Rush config, autoinstallers, temp files | | ||
|
|
||
| ## Quick Reference | ||
|
|
||
| ### Commands | ||
| ```bash | ||
| rush install # Install deps (frozen lockfile) | ||
| rush build # Incremental build | ||
| rush test # Incremental build + test | ||
| rush retest # Full rebuild + test (CI uses this) | ||
| rush start # Watch mode | ||
| rush build -t <package-name> # Build single project + its deps | ||
| rush build --to . # Build project in current directory + deps | ||
| rush prettier # Format staged files (pre-commit hook) | ||
| rush change # Generate changelog entries for modified packages | ||
| ``` | ||
|
|
||
| ### Custom Build Parameters | ||
| - `--production` -- Production build with minification | ||
| - `--fix` -- Auto-fix lint problems | ||
| - `--update-snapshots` -- Update Jest snapshots | ||
| - `--verbose` -- Detailed build output | ||
|
|
||
| ### Build Phases | ||
| ``` | ||
| _phase:lite-build → _phase:build → _phase:test | ||
| (simple builds) (TS + lint + (Jest tests) | ||
| API Extractor) | ||
| ``` | ||
|
|
||
| ## Build System Architecture | ||
| - **Rush**: Monorepo orchestrator (dependency graph, parallelism, build cache) | ||
| - **Heft**: Project-level build system (TypeScript, ESLint, Jest, API Extractor via plugins) | ||
| - **Rig system**: Projects inherit build config via `config/rig.json` pointing to a rig package | ||
| - Most projects use `local-node-rig` or `decoupled-local-node-rig` | ||
| - `decoupled-local-node-rig` is for packages that are themselves deps of the build toolchain | ||
|
|
||
| ## Code Conventions | ||
| - TypeScript strict mode, target ES2017/ES2018, CommonJS output to `lib/` | ||
| - ESLint v9 flat config; per-project `eslint.config.js` composing profiles + mixins from rig | ||
| - Async methods must have `Async` suffix (ESLint naming convention rule) | ||
| - `export * from '...'` is forbidden (use explicit named exports) | ||
| - Tests: `src/test/*.test.ts`, run via Heft/Jest against compiled `lib/` output | ||
| - Prettier: `printWidth: 110`, `singleQuote: true`, `trailingComma: 'none'` | ||
|
|
||
| ## Verification | ||
| ```bash | ||
| rush build -t <package> # Build the package you changed | ||
| rush test -t <package> # Build + test the package you changed | ||
| ``` | ||
| The pre-commit hook runs `rush prettier` automatically on staged files. | ||
|
|
||
| ## Progressive Disclosure | ||
| | Topic | Location | | ||
| |-------|----------| | ||
| | Rush config | `rush.json`, `common/config/rush/` | | ||
| | Build phases & commands | `common/config/rush/command-line.json` | | ||
| | Build cache | `common/config/rush/build-cache.json` | | ||
| | Version policies | `common/config/rush/version-policies.json` | | ||
| | Node rig (build pipeline) | `rigs/heft-node-rig/profiles/default/config/heft.json` | | ||
| | TypeScript base config | `rigs/heft-node-rig/profiles/default/tsconfig-base.json` | | ||
| | ESLint rules | `rigs/decoupled-local-node-rig/profiles/default/includes/eslint/flat/` | | ||
| | Jest shared config | `heft-plugins/heft-jest-plugin/includes/jest-shared.config.json` | | ||
| | API review files | `common/reviews/api/` | | ||
| | Plugin architecture | `libraries/rush-lib/src/pluginFramework/` | | ||
| | CI pipeline | `.github/workflows/ci.yml` | | ||
| | Contributor guidelines | `.github/PULL_REQUEST_TEMPLATE.md`, rushstack.io | | ||
| | Existing research | `research/docs/` | | ||
|
|
||
| ## Universal Rules | ||
| 1. Run `rush build -t <pkg> && rush test -t <pkg>` to verify changes | ||
| 2. Run `rush change` when modifying published packages | ||
| 3. Git email must match `*@users.noreply.github.com` (enforced by rush.json git policy) | ||
| 4. Rush core packages (`@microsoft/rush`, `rush-lib`, `rush-sdk`, rush-plugins) share a lock-step version | ||
| 5. API Extractor reports in `common/reviews/api/` must be updated when public APIs change |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| import { ProjectConfigurationFile, InheritanceType } from '@rushstack/heft-config-file'; | ||
|
|
||
| import publishSchemaJson from '../schemas/publish.schema.json'; | ||
|
|
||
| /** | ||
| * Represents the parsed contents of a project's `config/publish.json` file. | ||
| * @public | ||
| */ | ||
| export interface IPublishJson { | ||
| /** | ||
| * An object whose keys are publish target names (e.g. 'npm', 'vsix') and whose | ||
| * values are provider-specific configuration objects. | ||
| */ | ||
| providers?: Record<string, Record<string, unknown>>; | ||
|
||
| } | ||
|
|
||
| /** | ||
| * The `ProjectConfigurationFile` instance for loading `config/publish.json` with | ||
| * rig resolution and property inheritance. | ||
| * | ||
| * @remarks | ||
| * The `providers` property uses custom inheritance: child provider sections are | ||
| * shallow-merged over parent provider sections. This means a project can override | ||
| * specific provider configs from a rig while inheriting others. | ||
| * | ||
| * @internal | ||
| */ | ||
| export const PUBLISH_CONFIGURATION_FILE: ProjectConfigurationFile<IPublishJson> = | ||
| new ProjectConfigurationFile<IPublishJson>({ | ||
| projectRelativeFilePath: 'config/publish.json', | ||
| jsonSchemaObject: publishSchemaJson, | ||
| propertyInheritance: { | ||
| providers: { | ||
| inheritanceType: InheritanceType.custom, | ||
| inheritanceFunction: ( | ||
| child: Record<string, Record<string, unknown>> | undefined, | ||
| parent: Record<string, Record<string, unknown>> | undefined | ||
| ): Record<string, Record<string, unknown>> | undefined => { | ||
| if (!child) { | ||
| return parent; | ||
| } | ||
| if (!parent) { | ||
| return child; | ||
| } | ||
| // Shallow merge: child provider sections override parent provider sections | ||
| return { ...parent, ...child }; | ||
| } | ||
| } | ||
| } | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.