You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: common/reviews/api/rush-lib.api.md
+66-1Lines changed: 66 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -946,6 +946,72 @@ export class Operation {
946
946
weight:number;
947
947
}
948
948
949
+
// Warning: (ae-internal-missing-underscore) The name "OperationExecutionRecord" should be prefixed with an underscore because the declaration is marked as @internal
This plugin allows for interaction with the Rush cache. It exposes some methods to set the cache.
3
+
This is a Rush plugin that adds an optional `--set-cache-only` flag to Rush's phased commands, so you can other tools to actual run the scripts and generate the build artifacts on disk, then separately populate the Rush cache for particular actions(s). For integrations with other build orchestrators, this allows the best of both worlds: using a different build tool to orchestrate the work, but still populate the Rush cache for benefiting local use of Rush.
4
4
5
+
## Here be dragons!
5
6
6
-
## Installation
7
-
8
-
`npm install @rushstack/rush-bridge-cache-plugin`
7
+
This is a power-user sort of plugin. It assumes that the work for a particular task has already been completed and the build artifacts have been generated on disk. **If you run this command on a package where the command hasn't already been ran and the build artifacts are missing or incorrect, you will cache invalid content**. Be careful and beware!
9
8
10
-
<!--
11
-
## Usage
12
-
The package contains a binary you can run from the command line. It will auto-detect the location of your rush.json file.
- `--packageName` (required) - this should map to the `packageName` entry in your `rush.json` file.
17
-
- `--phase` (required): the name of the phased command whose command has already been ran, and you want to cache the result on disk.
18
-
-->
12
+
(TODO)
19
13
20
-
--------------------
14
+
`npm install @rushstack/rush-bridge-cache-plugin`
21
15
22
-
So this will:
23
-
- tap into the hooks and do all the necessary shit to figure out how to po
24
-
- expose a simple API for external users to tap into, e.g. if you want to populate the cache externally you'd import this plugin and use the methods to do so. You could then wrap that in a rush function, or however you want to do it.
25
16
17
+
## Configuration
26
18
19
+
First you need to update your `command-line.json` file to add the new flag. Configure it to target whatever specific commands you want to have this feature. Example:
"description": "When the flag is added to any associated command, it'll bypass running the command itself, but cache the result of a previous run. Beware! Only run when you know the build artifacts are in a valid state for the command.",
Any of the rush command can now just be given a `--set-cache-only` property, e.g.
34
35
36
+
`rush build --to your-packageX --set-cache-only`
35
37
36
-
"populate-cache": "..." <--- called after any cacheable unit of work is complete
38
+
That will examine `your-packageX` and all of its dependencies, then populate the cache.
37
39
38
-
OperationExecutionRecord -> the smallest unit of work to be done.
39
-
- looks like it's strongly coupled to the runner. We need one-off method calls.
40
40
41
-
CacheableOperationPlugin
42
-
_tryGetProjectBuildCache() -> this returns the project build cache
41
+
## Performance
43
42
43
+
When running within a pipeline, you'll want to populate the cache as fast as possible. So instead of waiting until the full build graph has been processed, you'll wnt to run it after each successful task. For that, just use Rush's `--only` and target whatever task had just completed, for example:
0 commit comments