-
Notifications
You must be signed in to change notification settings - Fork 671
[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 all 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
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,5 +135,4 @@ playwright-report/ | |
| test-results/ | ||
|
|
||
| # Claude Code local configuration | ||
| .claude/*.local.json | ||
|
|
||
| .claude/*.local.json | ||
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 |
|---|---|---|
|
|
@@ -103,6 +103,22 @@ export class ChangeManager { | |
| static createEmptyChangeFiles(rushConfiguration: RushConfiguration, projectName: string, emailAddress: string): string | undefined; | ||
| } | ||
|
|
||
| // @beta | ||
| export enum ChangeType { | ||
| // (undocumented) | ||
| dependency = 1, | ||
| // (undocumented) | ||
| hotfix = 2, | ||
| // (undocumented) | ||
| major = 5, | ||
| // (undocumented) | ||
| minor = 4, | ||
| // (undocumented) | ||
| none = 0, | ||
| // (undocumented) | ||
| patch = 3 | ||
| } | ||
|
|
||
|
Comment on lines
+106
to
+121
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not already exported somewhere? |
||
| // Warning: (ae-forgotten-export) The symbol "IBuildCacheJson" needs to be exported by the entry point index.d.ts | ||
| // | ||
| // @beta (undocumented) | ||
|
|
@@ -799,6 +815,51 @@ export type _IProjectBuildCacheOptions = _IOperationBuildCacheOptions & { | |
| phaseName: string; | ||
| }; | ||
|
|
||
| // @beta | ||
| export interface IPublishCommand extends IRushCommand { | ||
| readonly dryRun: boolean; | ||
| } | ||
|
|
||
| // @beta | ||
| export interface IPublishProjectInfo { | ||
| readonly changeType: ChangeType; | ||
| readonly newVersion: string; | ||
| readonly previousVersion: string; | ||
| readonly project: RushConfigurationProject; | ||
| readonly providerConfig: Record<string, unknown> | undefined; | ||
| } | ||
|
|
||
| // @beta | ||
| export interface IPublishProvider { | ||
| checkExistsAsync(options: IPublishProviderCheckExistsOptions): Promise<boolean>; | ||
| packAsync(options: IPublishProviderPackOptions): Promise<void>; | ||
| readonly providerName: string; | ||
| publishAsync(options: IPublishProviderPublishOptions): Promise<void>; | ||
| } | ||
|
|
||
| // @beta | ||
| export interface IPublishProviderCheckExistsOptions { | ||
| readonly project: RushConfigurationProject; | ||
| readonly providerConfig: Record<string, unknown> | undefined; | ||
| readonly version: string; | ||
| } | ||
|
|
||
| // @beta | ||
| export interface IPublishProviderPackOptions { | ||
| readonly dryRun: boolean; | ||
| readonly logger: ILogger; | ||
| readonly projects: ReadonlyArray<IPublishProjectInfo>; | ||
| readonly releaseFolder: string; | ||
| } | ||
|
|
||
| // @beta | ||
| export interface IPublishProviderPublishOptions { | ||
| readonly dryRun: boolean; | ||
| readonly logger: ILogger; | ||
| readonly projects: ReadonlyArray<IPublishProjectInfo>; | ||
| readonly tag: string | undefined; | ||
| } | ||
|
|
||
| // @beta | ||
| export interface IRushCommand { | ||
| readonly actionName: string; | ||
|
|
@@ -1202,6 +1263,9 @@ export class ProjectChangeAnalyzer { | |
| _tryGetSnapshotProviderAsync(projectConfigurations: ReadonlyMap<RushConfigurationProject, RushProjectConfiguration>, terminal: ITerminal, projectSelection?: ReadonlySet<RushConfigurationProject>): Promise<GetInputsSnapshotAsyncFn | undefined>; | ||
| } | ||
|
|
||
| // @beta | ||
| export type PublishProviderFactory = () => Promise<IPublishProvider>; | ||
|
|
||
| // @public | ||
| export class RepoStateFile { | ||
| readonly filePath: string; | ||
|
|
@@ -1389,6 +1453,7 @@ export class RushConfigurationProject { | |
| readonly projectRushConfigFolder: string; | ||
| readonly projectRushTempFolder: string; | ||
| readonly publishFolder: string; | ||
| get publishTargets(): ReadonlyArray<string>; | ||
| readonly reviewCategory: string | undefined; | ||
| readonly rushConfiguration: RushConfiguration; | ||
| get shouldPublish(): boolean; | ||
|
|
@@ -1492,11 +1557,13 @@ export class RushLifecycleHooks { | |
| subspace: Subspace, | ||
| variant: string | undefined | ||
| ]>; | ||
| readonly afterPublish: AsyncSeriesHook<[command: IPublishCommand]>; | ||
| readonly beforeInstall: AsyncSeriesHook<[ | ||
| command: IGlobalCommand, | ||
| subspace: Subspace, | ||
| variant: string | undefined | ||
| ]>; | ||
| readonly beforePublish: AsyncSeriesHook<[command: IPublishCommand]>; | ||
| readonly flushTelemetry: AsyncParallelHook<[ReadonlyArray<ITelemetryData>]>; | ||
| readonly initialize: AsyncSeriesHook<IRushCommand>; | ||
| readonly runAnyGlobalCustomCommand: AsyncSeriesHook<IGlobalCommand>; | ||
|
|
@@ -1536,12 +1603,16 @@ export class RushSession { | |
| // (undocumented) | ||
| getLogger(name: string): ILogger; | ||
| // (undocumented) | ||
| getPublishProviderFactory(publishTargetName: string): PublishProviderFactory | undefined; | ||
| // (undocumented) | ||
| readonly hooks: RushLifecycleHooks; | ||
| // (undocumented) | ||
| registerCloudBuildCacheProviderFactory(cacheProviderName: string, factory: CloudBuildCacheProviderFactory): void; | ||
| // (undocumented) | ||
| registerCobuildLockProviderFactory(cobuildLockProviderName: string, factory: CobuildLockProviderFactory): void; | ||
| // (undocumented) | ||
| registerPublishProviderFactory(publishTargetName: string, factory: PublishProviderFactory): void; | ||
| // (undocumented) | ||
| get terminalProvider(): ITerminalProvider; | ||
| } | ||
|
|
||
|
|
||
| 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>>; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rush's convention is to express things as arrays. I'm not married to that, but just noting that's the convention. See the Also would it be valid to have multiple instances of the same provider, but with different options? |
||
| } | ||
|
|
||
| /** | ||
| * 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.