@rushstack/rush-sdk 5.134.0 → 5.135.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -256,6 +256,11 @@ export declare class CobuildConfiguration {
256
256
  * to improve the performance in CI validations and the leaf projects have not enabled cache.
257
257
  */
258
258
  readonly cobuildLeafProjectLogOnlyAllowed: boolean;
259
+ /**
260
+ * If true, operations can opt into leveraging cobuilds without restoring from the build cache.
261
+ * Operations will need to us the allowCobuildWithoutCache flag to opt into this behavior per phase.
262
+ */
263
+ readonly cobuildWithoutCacheAllowed: boolean;
259
264
  private _cobuildLockProvider;
260
265
  private readonly _cobuildLockProviderFactory;
261
266
  private readonly _cobuildJson;
@@ -1428,6 +1433,12 @@ export declare interface IExperimentsJson {
1428
1433
  * ignore normal discussion group messages or don't know to subscribe.
1429
1434
  */
1430
1435
  rushAlerts?: boolean;
1436
+ /**
1437
+ * Allow cobuilds without using the build cache to store previous execution info. When setting up
1438
+ * distributed builds, Rush will allow uncacheable projects to still leverage the cobuild feature.
1439
+ * This is useful when you want to speed up operations that can't (or shouldn't) be cached.
1440
+ */
1441
+ allowCobuildWithoutCache?: boolean;
1431
1442
  }
1432
1443
 
1433
1444
  /**
@@ -1543,6 +1554,38 @@ declare interface ILockStepVersionJson extends IVersionPolicyJson {
1543
1554
  mainProject?: string;
1544
1555
  }
1545
1556
 
1557
+ /**
1558
+ * Information about the log files for an operation.
1559
+ *
1560
+ * @alpha
1561
+ */
1562
+ export declare interface ILogFilePaths {
1563
+ /**
1564
+ * The absolute path to the folder containing the text log files.
1565
+ * Provided as a convenience since it is an intermediary value of producing the text log file path.
1566
+ */
1567
+ textFolder: string;
1568
+ /**
1569
+ * The absolute path to the folder containing the JSONL log files.
1570
+ * Provided as a convenience since it is an intermediary value of producing the jsonl log file path.
1571
+ */
1572
+ jsonlFolder: string;
1573
+ /**
1574
+ * The absolute path to the merged (interleaved stdout and stderr) text log.
1575
+ * ANSI escape codes have been stripped.
1576
+ */
1577
+ text: string;
1578
+ /**
1579
+ * The absolute path to the stderr text log.
1580
+ * ANSI escape codes have been stripped.
1581
+ */
1582
+ error: string;
1583
+ /**
1584
+ * The absolute path to the JSONL log. ANSI escape codes are left intact to be able to reproduce the console output.
1585
+ */
1586
+ jsonl: string;
1587
+ }
1588
+
1546
1589
  /**
1547
1590
  * @beta
1548
1591
  */
@@ -1645,6 +1688,10 @@ export declare interface IOperationExecutionResult {
1645
1688
  * The id of the runner which actually runs the building process in cobuild mode.
1646
1689
  */
1647
1690
  readonly cobuildRunnerId: string | undefined;
1691
+ /**
1692
+ * The paths to the log files, if applicable.
1693
+ */
1694
+ readonly logFilePaths: ILogFilePaths | undefined;
1648
1695
  }
1649
1696
 
1650
1697
  /**
@@ -1849,6 +1896,10 @@ export declare interface IOperationSettings {
1849
1896
  * determined by the -p flag.
1850
1897
  */
1851
1898
  weight?: number;
1899
+ /**
1900
+ * If true, this operation can use cobuilds for orchestration without restoring build cache entries.
1901
+ */
1902
+ allowCobuildWithoutCache?: boolean;
1852
1903
  }
1853
1904
 
1854
1905
  /**
@@ -2241,15 +2292,9 @@ export declare interface IRushPhaseSharding {
2241
2292
  */
2242
2293
  outputFolderArgumentFormat?: string;
2243
2294
  /**
2244
- * Configuration for the shard operation. All other configuration applies to the collator operation.
2295
+ * @deprecated Create a separate operation settings object for the shard operation settings with the name `{operationName}:shard`.
2245
2296
  */
2246
- shardOperationSettings?: {
2247
- /**
2248
- * How many concurrency units this operation should take up during execution. The maximum concurrent units is
2249
- * determined by the -p flag.
2250
- */
2251
- weight?: number;
2252
- };
2297
+ shardOperationSettings?: unknown;
2253
2298
  }
2254
2299
 
2255
2300
  /**
@@ -53,6 +53,11 @@ export declare class CobuildConfiguration {
53
53
  * to improve the performance in CI validations and the leaf projects have not enabled cache.
54
54
  */
55
55
  readonly cobuildLeafProjectLogOnlyAllowed: boolean;
56
+ /**
57
+ * If true, operations can opt into leveraging cobuilds without restoring from the build cache.
58
+ * Operations will need to us the allowCobuildWithoutCache flag to opt into this behavior per phase.
59
+ */
60
+ readonly cobuildWithoutCacheAllowed: boolean;
56
61
  private _cobuildLockProvider;
57
62
  private readonly _cobuildLockProviderFactory;
58
63
  private readonly _cobuildJson;
@@ -83,6 +83,12 @@ export interface IExperimentsJson {
83
83
  * ignore normal discussion group messages or don't know to subscribe.
84
84
  */
85
85
  rushAlerts?: boolean;
86
+ /**
87
+ * Allow cobuilds without using the build cache to store previous execution info. When setting up
88
+ * distributed builds, Rush will allow uncacheable projects to still leverage the cobuild feature.
89
+ * This is useful when you want to speed up operations that can't (or shouldn't) be cached.
90
+ */
91
+ allowCobuildWithoutCache?: boolean;
86
92
  }
87
93
  /**
88
94
  * Use this class to load the "common/config/rush/experiments.json" config file.
@@ -47,15 +47,9 @@ export interface IRushPhaseSharding {
47
47
  */
48
48
  outputFolderArgumentFormat?: string;
49
49
  /**
50
- * Configuration for the shard operation. All other configuration applies to the collator operation.
51
- */
52
- shardOperationSettings?: {
53
- /**
54
- * How many concurrency units this operation should take up during execution. The maximum concurrent units is
55
- * determined by the -p flag.
56
- */
57
- weight?: number;
58
- };
50
+ * @deprecated Create a separate operation settings object for the shard operation settings with the name `{operationName}:shard`.
51
+ */
52
+ shardOperationSettings?: unknown;
59
53
  }
60
54
  /**
61
55
  * @alpha
@@ -115,6 +109,10 @@ export interface IOperationSettings {
115
109
  * determined by the -p flag.
116
110
  */
117
111
  weight?: number;
112
+ /**
113
+ * If true, this operation can use cobuilds for orchestration without restoring build cache entries.
114
+ */
115
+ allowCobuildWithoutCache?: boolean;
118
116
  }
119
117
  /**
120
118
  * Use this class to load the "config/rush-project.json" config file.
package/lib/index.d.ts CHANGED
@@ -41,6 +41,7 @@ export type { IOperationRunner, IOperationRunnerContext } from './logic/operatio
41
41
  export type { IExecutionResult, IOperationExecutionResult } from './logic/operations/IOperationExecutionResult';
42
42
  export { type IOperationOptions, Operation } from './logic/operations/Operation';
43
43
  export { OperationStatus } from './logic/operations/OperationStatus';
44
+ export type { ILogFilePaths } from './logic/operations/ProjectLogWritable';
44
45
  export { RushSession, type IRushSessionOptions, type CloudBuildCacheProviderFactory, type CobuildLockProviderFactory } from './pluginFramework/RushSession';
45
46
  export { type IRushCommand, type IGlobalCommand, type IPhasedCommand, RushLifecycleHooks } from './pluginFramework/RushLifeCycle';
46
47
  export { type ICreateOperationsContext, type IExecuteOperationsContext, PhasedCommandHooks } from './pluginFramework/PhasedCommandHooks';
@@ -1,8 +1,7 @@
1
- import { type ITerminal } from '@rushstack/terminal';
1
+ import { type TerminalWritable, type ITerminal } from '@rushstack/terminal';
2
2
  import { CobuildLock } from '../cobuild/CobuildLock';
3
3
  import { ProjectBuildCache } from '../buildCache/ProjectBuildCache';
4
4
  import { type IOperationSettings } from '../../api/RushProjectConfiguration';
5
- import { ProjectLogWritable } from './ProjectLogWritable';
6
5
  import type { CobuildConfiguration } from '../../api/CobuildConfiguration';
7
6
  import { DisjointSet } from '../cobuild/DisjointSet';
8
7
  import { PeriodicCallback } from './PeriodicCallback';
@@ -26,7 +25,7 @@ export interface IOperationBuildCacheContext {
26
25
  cobuildLock: CobuildLock | undefined;
27
26
  cobuildClusterId: string | undefined;
28
27
  buildCacheTerminal: ITerminal | undefined;
29
- buildCacheProjectLogWritable: ProjectLogWritable | undefined;
28
+ buildCacheTerminalWritable: TerminalWritable | undefined;
30
29
  periodicCallback: PeriodicCallback;
31
30
  cacheRestored: boolean;
32
31
  isCacheReadAttempted: boolean;
@@ -48,7 +47,7 @@ export declare class CacheableOperationPlugin implements IPhasedCommandPlugin {
48
47
  private _tryGetLogOnlyProjectBuildCacheAsync;
49
48
  private _tryGetCobuildLockAsync;
50
49
  private _createBuildCacheTerminalAsync;
51
- private _tryGetBuildCacheProjectLogWritableAsync;
50
+ private _tryGetBuildCacheTerminalWritableAsync;
52
51
  }
53
52
  export declare function clusterOperations(initialClusters: DisjointSet<Operation>, operationBuildCacheMap: Map<Operation, {
54
53
  cacheDisabledReason: string | undefined;
@@ -2,6 +2,7 @@ import type { StdioSummarizer } from '@rushstack/terminal';
2
2
  import type { OperationStatus } from './OperationStatus';
3
3
  import type { Operation } from './Operation';
4
4
  import type { IStopwatchResult } from '../../utilities/Stopwatch';
5
+ import type { ILogFilePaths } from './ProjectLogWritable';
5
6
  /**
6
7
  * The `IOperationExecutionResult` interface represents the results of executing an {@link Operation}.
7
8
  * @alpha
@@ -39,6 +40,10 @@ export interface IOperationExecutionResult {
39
40
  * The id of the runner which actually runs the building process in cobuild mode.
40
41
  */
41
42
  readonly cobuildRunnerId: string | undefined;
43
+ /**
44
+ * The paths to the log files, if applicable.
45
+ */
46
+ readonly logFilePaths: ILogFilePaths | undefined;
42
47
  }
43
48
  /**
44
49
  * The `IExecutionResult` interface represents the results of executing a set of {@link Operation}s.
@@ -7,6 +7,7 @@ import { Stopwatch } from '../../utilities/Stopwatch';
7
7
  import { OperationMetadataManager } from './OperationMetadataManager';
8
8
  import type { IPhase } from '../../api/CommandLineConfiguration';
9
9
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
10
+ import { type ILogFilePaths } from './ProjectLogWritable';
10
11
  export interface IOperationExecutionRecordContext {
11
12
  streamCollator: StreamCollator;
12
13
  onOperationStatusChanged?: (record: OperationExecutionRecord) => void;
@@ -74,6 +75,7 @@ export declare class OperationExecutionRecord implements IOperationRunnerContext
74
75
  readonly associatedPhase: IPhase | undefined;
75
76
  readonly associatedProject: RushConfigurationProject | undefined;
76
77
  readonly _operationMetadataManager: OperationMetadataManager | undefined;
78
+ logFilePaths: ILogFilePaths | undefined;
77
79
  private readonly _context;
78
80
  private _collatedWriter;
79
81
  private _status;
@@ -1,68 +1,122 @@
1
1
  import { TerminalWritable, type ITerminalChunk } from '@rushstack/terminal';
2
- import type { CollatedTerminal } from '@rushstack/stream-collator';
3
2
  import type { RushConfigurationProject } from '../../api/RushConfigurationProject';
4
3
  export interface IProjectLogWritableOptions {
5
- project: RushConfigurationProject;
6
- terminal: CollatedTerminal;
7
- logFilenameIdentifier: string;
4
+ logFilePaths: ILogFilePaths;
8
5
  enableChunkedOutput?: boolean;
9
6
  }
7
+ export interface ILogFileNames {
8
+ textFileName: string;
9
+ jsonlFileName: string;
10
+ errorFileName: string;
11
+ }
12
+ /**
13
+ * Information about the log files for an operation.
14
+ *
15
+ * @alpha
16
+ */
10
17
  export interface ILogFilePaths {
11
- logFolderPath: string;
12
- logChunksFolderPath: string;
13
- logPath: string;
14
- logChunksPath: string;
15
- errorLogPath: string;
16
- relativeLogPath: string;
17
- relativeErrorLogPath: string;
18
- relativeLogChunksPath: string;
18
+ /**
19
+ * The absolute path to the folder containing the text log files.
20
+ * Provided as a convenience since it is an intermediary value of producing the text log file path.
21
+ */
22
+ textFolder: string;
23
+ /**
24
+ * The absolute path to the folder containing the JSONL log files.
25
+ * Provided as a convenience since it is an intermediary value of producing the jsonl log file path.
26
+ */
27
+ jsonlFolder: string;
28
+ /**
29
+ * The absolute path to the merged (interleaved stdout and stderr) text log.
30
+ * ANSI escape codes have been stripped.
31
+ */
32
+ text: string;
33
+ /**
34
+ * The absolute path to the stderr text log.
35
+ * ANSI escape codes have been stripped.
36
+ */
37
+ error: string;
38
+ /**
39
+ * The absolute path to the JSONL log. ANSI escape codes are left intact to be able to reproduce the console output.
40
+ */
41
+ jsonl: string;
19
42
  }
20
43
  export interface IGetLogFilePathsOptions {
21
- project: RushConfigurationProject;
44
+ project: Pick<RushConfigurationProject, 'projectFolder' | 'packageName'>;
22
45
  logFilenameIdentifier: string;
23
46
  }
24
- export declare class ProjectLogWritable extends TerminalWritable {
25
- private readonly _terminal;
47
+ /**
48
+ * A terminal stream that writes all log chunks to a JSONL format so they can be faithfully reconstructed
49
+ * during build cache restores. This is used for adding warning + error messages in cobuilds where the original
50
+ * logs cannot be completely restored from the existing `all.log` and `error.log` files.
51
+ *
52
+ * Example output:
53
+ * libraries/rush-lib/.rush/temp/operations/rush-lib._phase_build.chunks.jsonl
54
+ * ```
55
+ * {"kind":"O","text":"Invoking: heft run --only build -- --clean \n"}
56
+ * {"kind":"O","text":" ---- build started ---- \n"}
57
+ * {"kind":"O","text":"[build:clean] Deleted 0 files and 5 folders\n"}
58
+ * {"kind":"O","text":"[build:typescript] Using TypeScript version 5.4.2\n"}
59
+ * {"kind":"O","text":"[build:lint] Using ESLint version 8.57.0\n"}
60
+ * {"kind":"E","text":"[build:lint] Warning: libraries/rush-lib/src/logic/operations/LogChunksWritable.ts:15:7 - (@typescript-eslint/typedef) Expected test to have a type annotation.\n"}
61
+ * {"kind":"E","text":"[build:lint] Warning: libraries/rush-lib/src/logic/operations/LogChunksWritable.ts:15:7 - (@typescript-eslint/no-unused-vars) 'test' is assigned a value but never used.\n"}
62
+ * {"kind":"O","text":"[build:typescript] Copied 1138 folders or files and linked 0 files\n"}
63
+ * {"kind":"O","text":"[build:webpack] Using Webpack version 5.82.1\n"}
64
+ * {"kind":"O","text":"[build:webpack] Running Webpack compilation\n"}
65
+ * {"kind":"O","text":"[build:api-extractor] Using API Extractor version 7.43.1\n"}
66
+ * {"kind":"O","text":"[build:api-extractor] Analysis will use the bundled TypeScript version 5.4.2\n"}
67
+ * {"kind":"O","text":"[build:copy-mock-flush-telemetry-plugin] Copied 1260 folders or files and linked 5 files\n"}
68
+ * {"kind":"O","text":" ---- build finished (6.856s) ---- \n"}
69
+ * {"kind":"O","text":"-------------------- Finished (6.858s) --------------------\n"}
70
+ * ```
71
+ */
72
+ export declare class JsonLFileWritable extends TerminalWritable {
73
+ readonly logPath: string;
74
+ private _writer;
75
+ constructor(logPath: string);
76
+ writeChunk(chunk: ITerminalChunk): void;
77
+ protected onWriteChunk(chunk: ITerminalChunk): void;
78
+ protected onClose(): void;
79
+ }
80
+ /**
81
+ * A terminal stream that writes two text log files: one with interleaved stdout and stderr, and one with just stderr.
82
+ */
83
+ export declare class SplitLogFileWritable extends TerminalWritable {
26
84
  readonly logPath: string;
27
85
  readonly errorLogPath: string;
28
- readonly logChunksPath: string;
29
- readonly relativeLogPath: string;
30
- readonly relativeErrorLogPath: string;
31
- readonly relativeLogChunksPath: string;
32
86
  private _logWriter;
33
87
  private _errorLogWriter;
34
- /**
35
- * A new terminal stream that writes all log chunks to a JSON format so they can be faithfully reconstructed
36
- * during build cache restores. This is used for adding warning + error messages in cobuilds where the original
37
- * logs cannot be completely restored from the existing `all.log` and `error.log` files.
38
- *
39
- * Example output:
40
- * libraries/rush-lib/.rush/temp/operations/rush-lib._phase_build.chunks.jsonl
41
- * ```
42
- * {"kind":"O","text":"Invoking: heft run --only build -- --clean \n"}
43
- * {"kind":"O","text":" ---- build started ---- \n"}
44
- * {"kind":"O","text":"[build:clean] Deleted 0 files and 5 folders\n"}
45
- * {"kind":"O","text":"[build:typescript] Using TypeScript version 5.4.2\n"}
46
- * {"kind":"O","text":"[build:lint] Using ESLint version 8.57.0\n"}
47
- * {"kind":"E","text":"[build:lint] Warning: libraries/rush-lib/src/logic/operations/LogChunksWritable.ts:15:7 - (@typescript-eslint/typedef) Expected test to have a type annotation.\n"}
48
- * {"kind":"E","text":"[build:lint] Warning: libraries/rush-lib/src/logic/operations/LogChunksWritable.ts:15:7 - (@typescript-eslint/no-unused-vars) 'test' is assigned a value but never used.\n"}
49
- * {"kind":"O","text":"[build:typescript] Copied 1138 folders or files and linked 0 files\n"}
50
- * {"kind":"O","text":"[build:webpack] Using Webpack version 5.82.1\n"}
51
- * {"kind":"O","text":"[build:webpack] Running Webpack compilation\n"}
52
- * {"kind":"O","text":"[build:api-extractor] Using API Extractor version 7.43.1\n"}
53
- * {"kind":"O","text":"[build:api-extractor] Analysis will use the bundled TypeScript version 5.4.2\n"}
54
- * {"kind":"O","text":"[build:copy-mock-flush-telemetry-plugin] Copied 1260 folders or files and linked 5 files\n"}
55
- * {"kind":"O","text":" ---- build finished (6.856s) ---- \n"}
56
- * {"kind":"O","text":"-------------------- Finished (6.858s) --------------------\n"}
57
- * ```
58
- */
59
- private _chunkWriter;
60
- private _enableChunkedOutput;
61
- private constructor();
62
- static initializeAsync({ project, terminal, logFilenameIdentifier, enableChunkedOutput }: IProjectLogWritableOptions): Promise<ProjectLogWritable>;
63
- static getLogFilePaths({ project: { projectFolder, packageName }, logFilenameIdentifier }: IGetLogFilePathsOptions): ILogFilePaths;
88
+ constructor(logPath: string, errorLogPath: string);
64
89
  writeChunk(chunk: ITerminalChunk): void;
65
90
  protected onWriteChunk(chunk: ITerminalChunk): void;
66
91
  protected onClose(): void;
67
92
  }
93
+ /**
94
+ * Initializes the project log files for a project. Produces a combined log file, an error log file, and optionally a
95
+ * chunks file that can be used to reconstrct the original console output.
96
+ * @param options - The options to initialize the project log files.
97
+ * @returns The terminal writable stream that will write to the log files.
98
+ */
99
+ export declare function initializeProjectLogFilesAsync(options: IProjectLogWritableOptions): Promise<TerminalWritable>;
100
+ /**
101
+ * @internal
102
+ *
103
+ * @param packageName - The raw package name
104
+ * @param logFilenameIdentifier - The identifier to append to the log file name (typically the phase name)
105
+ * @returns The base names of the log files
106
+ */
107
+ export declare function getLogfileBaseNames(packageName: string, logFilenameIdentifier: string): ILogFileNames;
108
+ /**
109
+ * @internal
110
+ *
111
+ * @param projectFolder - The absolute path of the project folder
112
+ * @returns The absolute paths of the log folders for regular and chunked logs
113
+ */
114
+ export declare function getProjectLogFolders(projectFolder: string): Pick<ILogFilePaths, 'textFolder' | 'jsonlFolder'>;
115
+ /**
116
+ * @internal
117
+ *
118
+ * @param options - The options to get the log file paths
119
+ * @returns All information about log file paths for the project and log identifier
120
+ */
121
+ export declare function getProjectLogFilePaths(options: IGetLogFilePathsOptions): ILogFilePaths;
68
122
  //# sourceMappingURL=ProjectLogWritable.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/rush-sdk",
3
- "version": "5.134.0",
3
+ "version": "5.135.0",
4
4
  "description": "An API for interacting with the Rush engine",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,13 +43,13 @@
43
43
  "@types/semver": "7.5.0",
44
44
  "@types/webpack-env": "1.18.0",
45
45
  "webpack": "~5.82.1",
46
+ "@microsoft/rush-lib": "5.135.0",
46
47
  "@rushstack/heft": "0.67.2",
47
- "local-node-rig": "1.0.0",
48
48
  "@rushstack/heft-webpack5-plugin": "0.10.11",
49
- "@microsoft/rush-lib": "5.134.0",
50
- "@rushstack/ts-command-line": "4.22.8",
51
49
  "@rushstack/stream-collator": "4.1.67",
52
- "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.66"
50
+ "@rushstack/webpack-preserve-dynamic-require-plugin": "0.11.66",
51
+ "@rushstack/ts-command-line": "4.22.8",
52
+ "local-node-rig": "1.0.0"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "heft build --clean",