@lage-run/cli 0.11.4 → 0.13.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.
- package/CHANGELOG.json +43 -1
- package/CHANGELOG.md +20 -2
- package/lib/commands/createReporter.js +13 -1
- package/lib/commands/run/infoAction.js +2 -13
- package/lib/commands/run/runAction.js +26 -31
- package/lib/commands/run/watchAction.js +26 -33
- package/package.json +3 -3
- package/lib/commands/run/createCacheProvider.d.ts +0 -15
- package/lib/commands/run/createCacheProvider.js +0 -48
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,49 @@
|
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 01 Apr 2023 00:28:19 GMT",
|
|
6
|
+
"tag": "@lage-run/cli_v0.13.0",
|
|
7
|
+
"version": "0.13.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/cli",
|
|
13
|
+
"commit": "884c8b5aba15cd1cc5f943c06a6a9da4af20f806",
|
|
14
|
+
"comment": "replace ink with @ms-cloudpack/task-reporter"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/cli",
|
|
19
|
+
"comment": "Bump @lage-run/reporters to v1.1.0",
|
|
20
|
+
"commit": "884c8b5aba15cd1cc5f943c06a6a9da4af20f806"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Thu, 30 Mar 2023 23:46:52 GMT",
|
|
27
|
+
"tag": "@lage-run/cli_v0.12.0",
|
|
28
|
+
"version": "0.12.0",
|
|
29
|
+
"comments": {
|
|
30
|
+
"minor": [
|
|
31
|
+
{
|
|
32
|
+
"author": "kchau@microsoft.com",
|
|
33
|
+
"package": "@lage-run/cli",
|
|
34
|
+
"commit": "41360ccbd7433afe537342c4c815b1e02bc9c9b8",
|
|
35
|
+
"comment": "moved caching to happen inside workers"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "beachball",
|
|
39
|
+
"package": "@lage-run/cli",
|
|
40
|
+
"comment": "Bump @lage-run/scheduler to v0.11.0",
|
|
41
|
+
"commit": "41360ccbd7433afe537342c4c815b1e02bc9c9b8"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"date": "Wed, 29 Mar 2023 22:41:49 GMT",
|
|
6
48
|
"tag": "@lage-run/cli_v0.11.4",
|
|
7
49
|
"version": "0.11.4",
|
|
8
50
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
# Change Log - @lage-run/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 01 Apr 2023 00:28:19 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.13.0
|
|
8
|
+
|
|
9
|
+
Sat, 01 Apr 2023 00:28:19 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- replace ink with @ms-cloudpack/task-reporter (kchau@microsoft.com)
|
|
14
|
+
- Bump @lage-run/reporters to v1.1.0
|
|
15
|
+
|
|
16
|
+
## 0.12.0
|
|
17
|
+
|
|
18
|
+
Thu, 30 Mar 2023 23:46:52 GMT
|
|
19
|
+
|
|
20
|
+
### Minor changes
|
|
21
|
+
|
|
22
|
+
- moved caching to happen inside workers (kchau@microsoft.com)
|
|
23
|
+
- Bump @lage-run/scheduler to v0.11.0
|
|
24
|
+
|
|
7
25
|
## 0.11.4
|
|
8
26
|
|
|
9
|
-
Wed, 29 Mar 2023 22:41:
|
|
27
|
+
Wed, 29 Mar 2023 22:41:49 GMT
|
|
10
28
|
|
|
11
29
|
### Patches
|
|
12
30
|
|
|
@@ -8,9 +8,20 @@ Object.defineProperty(exports, "createReporter", {
|
|
|
8
8
|
});
|
|
9
9
|
const _logger = require("@lage-run/logger");
|
|
10
10
|
const _reporters = require("@lage-run/reporters");
|
|
11
|
+
const _workspaceTools = require("workspace-tools");
|
|
12
|
+
const _fs = require("fs");
|
|
13
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
14
|
+
function _interopRequireDefault(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
11
19
|
function createReporter(reporter, options) {
|
|
12
20
|
const { verbose , grouped , logLevel: logLevelName , concurrency , profile , progress } = options;
|
|
13
21
|
const logLevel = _logger.LogLevel[logLevelName];
|
|
22
|
+
const root = (0, _workspaceTools.findPackageRoot)(__filename);
|
|
23
|
+
const packageJson = JSON.parse((0, _fs.readFileSync)(_path.default.join(root, "package.json"), "utf-8"));
|
|
24
|
+
const version = packageJson.version;
|
|
14
25
|
switch(reporter){
|
|
15
26
|
case "profile":
|
|
16
27
|
return new _reporters.ChromeTraceEventsReporter({
|
|
@@ -36,7 +47,8 @@ function createReporter(reporter, options) {
|
|
|
36
47
|
default:
|
|
37
48
|
if (progress && !(logLevel >= _logger.LogLevel.verbose || verbose || grouped)) {
|
|
38
49
|
return new _reporters.ProgressReporter({
|
|
39
|
-
concurrency
|
|
50
|
+
concurrency,
|
|
51
|
+
version
|
|
40
52
|
});
|
|
41
53
|
}
|
|
42
54
|
return new _reporters.LogReporter({
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "infoAction", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>infoAction
|
|
8
8
|
});
|
|
9
|
-
const _createCacheProviderJs = require("./createCacheProvider.js");
|
|
10
9
|
const _createTargetGraphJs = require("./createTargetGraph.js");
|
|
11
10
|
const _filterArgsForTasksJs = require("./filterArgsForTasks.js");
|
|
12
11
|
const _config = require("@lage-run/config");
|
|
@@ -25,7 +24,7 @@ async function infoAction(options, command) {
|
|
|
25
24
|
// Build Target Graph
|
|
26
25
|
const root = (0, _workspaceTools.getWorkspaceRoot)(process.cwd());
|
|
27
26
|
const packageInfos = (0, _workspaceTools.getPackageInfos)(root);
|
|
28
|
-
const { tasks
|
|
27
|
+
const { tasks } = (0, _filterArgsForTasksJs.filterArgsForTasks)(command.args);
|
|
29
28
|
const targetGraph = (0, _createTargetGraphJs.createTargetGraph)({
|
|
30
29
|
logger,
|
|
31
30
|
root,
|
|
@@ -42,13 +41,6 @@ async function infoAction(options, command) {
|
|
|
42
41
|
});
|
|
43
42
|
// Make sure we do not attempt writeRemoteCache in info mode
|
|
44
43
|
config.cacheOptions.writeRemoteCache = false;
|
|
45
|
-
const { hasher } = (0, _createCacheProviderJs.createCache)({
|
|
46
|
-
root,
|
|
47
|
-
logger,
|
|
48
|
-
cacheOptions: config.cacheOptions,
|
|
49
|
-
skipLocalCache: false,
|
|
50
|
-
cliArgs: taskArgs
|
|
51
|
-
});
|
|
52
44
|
const { targets } = targetGraph;
|
|
53
45
|
for (const target of targets.values()){
|
|
54
46
|
if (target.id === (0, _targetGraph.getStartTargetId)()) {
|
|
@@ -56,9 +48,6 @@ async function infoAction(options, command) {
|
|
|
56
48
|
}
|
|
57
49
|
const startIdIndex = target.dependencies.indexOf((0, _targetGraph.getStartTargetId)());
|
|
58
50
|
target.dependencies.splice(startIdIndex, 1);
|
|
59
|
-
process.stdout.write(`${JSON.stringify(
|
|
60
|
-
...target,
|
|
61
|
-
hash: await hasher.hash(target)
|
|
62
|
-
})}\n`);
|
|
51
|
+
process.stdout.write(`${JSON.stringify(target)}\n`);
|
|
63
52
|
}
|
|
64
53
|
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "runAction", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>runAction
|
|
8
8
|
});
|
|
9
|
-
const _createCacheProviderJs = require("./createCacheProvider.js");
|
|
10
9
|
const _createTargetGraphJs = require("./createTargetGraph.js");
|
|
11
10
|
const _filterArgsForTasksJs = require("./filterArgsForTasks.js");
|
|
12
11
|
const _filterPipelineDefinitionsJs = require("./filterPipelineDefinitions.js");
|
|
@@ -53,49 +52,45 @@ async function runAction(options, command) {
|
|
|
53
52
|
packageInfos
|
|
54
53
|
});
|
|
55
54
|
validateTargetGraph(targetGraph, allowNoTargetRuns);
|
|
56
|
-
const { cacheProvider , hasher } = (0, _createCacheProviderJs.createCache)({
|
|
57
|
-
root,
|
|
58
|
-
logger,
|
|
59
|
-
cacheOptions: config.cacheOptions,
|
|
60
|
-
skipLocalCache: options.skipLocalCache,
|
|
61
|
-
cliArgs: taskArgs
|
|
62
|
-
});
|
|
63
55
|
logger.verbose(`Running with ${concurrency} workers`);
|
|
64
56
|
const filteredPipeline = (0, _filterPipelineDefinitionsJs.filterPipelineDefinitions)(targetGraph.targets.values(), config.pipeline);
|
|
65
57
|
const maxWorkersPerTaskMap = (0, _config.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
|
|
66
58
|
const scheduler = new _scheduler.SimpleScheduler({
|
|
67
59
|
logger,
|
|
68
60
|
concurrency,
|
|
69
|
-
cacheProvider,
|
|
70
|
-
hasher,
|
|
71
61
|
continueOnError: options.continue,
|
|
72
62
|
shouldCache: options.cache,
|
|
73
63
|
shouldResetCache: options.resetCache,
|
|
64
|
+
workerData: {
|
|
65
|
+
root,
|
|
66
|
+
taskArgs,
|
|
67
|
+
skipLocalCache: options.skipLocalCache,
|
|
68
|
+
runners: {
|
|
69
|
+
npmScript: {
|
|
70
|
+
script: require.resolve("./runners/NpmScriptRunner.js"),
|
|
71
|
+
options: {
|
|
72
|
+
nodeArg: options.nodeArg,
|
|
73
|
+
taskArgs,
|
|
74
|
+
npmCmd: (0, _findNpmClient.findNpmClient)(config.npmClient)
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
worker: {
|
|
78
|
+
script: require.resolve("./runners/WorkerRunner.js"),
|
|
79
|
+
options: {
|
|
80
|
+
taskArgs
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
noop: {
|
|
84
|
+
script: require.resolve("./runners/NoOpRunner.js"),
|
|
85
|
+
options: {}
|
|
86
|
+
},
|
|
87
|
+
...config.runners
|
|
88
|
+
}
|
|
89
|
+
},
|
|
74
90
|
maxWorkersPerTask: new Map([
|
|
75
91
|
...(0, _config.getMaxWorkersPerTask)(filteredPipeline, concurrency),
|
|
76
92
|
...maxWorkersPerTaskMap
|
|
77
93
|
]),
|
|
78
|
-
runners: {
|
|
79
|
-
npmScript: {
|
|
80
|
-
script: require.resolve("./runners/NpmScriptRunner.js"),
|
|
81
|
-
options: {
|
|
82
|
-
nodeArg: options.nodeArg,
|
|
83
|
-
taskArgs,
|
|
84
|
-
npmCmd: (0, _findNpmClient.findNpmClient)(config.npmClient)
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
worker: {
|
|
88
|
-
script: require.resolve("./runners/WorkerRunner.js"),
|
|
89
|
-
options: {
|
|
90
|
-
taskArgs
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
noop: {
|
|
94
|
-
script: require.resolve("./runners/NoOpRunner.js"),
|
|
95
|
-
options: {}
|
|
96
|
-
},
|
|
97
|
-
...config.runners
|
|
98
|
-
},
|
|
99
94
|
workerIdleMemoryLimit: config.workerIdleMemoryLimit
|
|
100
95
|
});
|
|
101
96
|
const summary = await scheduler.run(root, targetGraph);
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "watchAction", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>watchAction
|
|
8
8
|
});
|
|
9
|
-
const _createCacheProviderJs = require("./createCacheProvider.js");
|
|
10
9
|
const _createTargetGraphJs = require("./createTargetGraph.js");
|
|
11
10
|
const _filterArgsForTasksJs = require("./filterArgsForTasks.js");
|
|
12
11
|
const _findNpmClient = require("@lage-run/find-npm-client");
|
|
@@ -86,48 +85,44 @@ async function watchAction(options, command) {
|
|
|
86
85
|
});
|
|
87
86
|
// Make sure we do not attempt writeRemoteCache in watch mode
|
|
88
87
|
config.cacheOptions.writeRemoteCache = false;
|
|
89
|
-
const { cacheProvider , hasher } = (0, _createCacheProviderJs.createCache)({
|
|
90
|
-
root,
|
|
91
|
-
logger,
|
|
92
|
-
cacheOptions: config.cacheOptions,
|
|
93
|
-
skipLocalCache: false,
|
|
94
|
-
cliArgs: taskArgs
|
|
95
|
-
});
|
|
96
88
|
const filteredPipeline = (0, _filterPipelineDefinitionsJs.filterPipelineDefinitions)(targetGraph.targets.values(), config.pipeline);
|
|
97
89
|
const maxWorkersPerTaskMap = (0, _config.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
|
|
98
90
|
const scheduler = new _scheduler.SimpleScheduler({
|
|
99
91
|
logger,
|
|
100
92
|
concurrency,
|
|
101
|
-
cacheProvider,
|
|
102
|
-
hasher,
|
|
103
93
|
continueOnError: true,
|
|
94
|
+
workerData: {
|
|
95
|
+
root,
|
|
96
|
+
taskArgs,
|
|
97
|
+
skipLocalCache: options.skipLocalCache,
|
|
98
|
+
runners: {
|
|
99
|
+
npmScript: {
|
|
100
|
+
script: require.resolve("./runners/NpmScriptRunner.js"),
|
|
101
|
+
options: {
|
|
102
|
+
nodeArg: options.nodeArg,
|
|
103
|
+
taskArgs,
|
|
104
|
+
npmCmd: (0, _findNpmClient.findNpmClient)(config.npmClient)
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
worker: {
|
|
108
|
+
script: require.resolve("./runners/WorkerRunner.js"),
|
|
109
|
+
options: {
|
|
110
|
+
taskArgs
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
noop: {
|
|
114
|
+
script: require.resolve("./runners/NoOpRunner.js"),
|
|
115
|
+
options: {}
|
|
116
|
+
},
|
|
117
|
+
...config.runners
|
|
118
|
+
}
|
|
119
|
+
},
|
|
104
120
|
shouldCache: options.cache,
|
|
105
121
|
shouldResetCache: options.resetCache,
|
|
106
122
|
maxWorkersPerTask: new Map([
|
|
107
123
|
...(0, _config.getMaxWorkersPerTask)(filteredPipeline, concurrency),
|
|
108
124
|
...maxWorkersPerTaskMap
|
|
109
125
|
]),
|
|
110
|
-
runners: {
|
|
111
|
-
npmScript: {
|
|
112
|
-
script: require.resolve("./runners/NpmScriptRunner.js"),
|
|
113
|
-
options: {
|
|
114
|
-
nodeArg: options.nodeArg,
|
|
115
|
-
taskArgs,
|
|
116
|
-
npmCmd: (0, _findNpmClient.findNpmClient)(config.npmClient)
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
worker: {
|
|
120
|
-
script: require.resolve("./runners/WorkerRunner.js"),
|
|
121
|
-
options: {
|
|
122
|
-
taskArgs
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
noop: {
|
|
126
|
-
script: require.resolve("./runners/NoOpRunner.js"),
|
|
127
|
-
options: {}
|
|
128
|
-
},
|
|
129
|
-
...config.runners
|
|
130
|
-
},
|
|
131
126
|
workerIdleMemoryLimit: config.workerIdleMemoryLimit
|
|
132
127
|
});
|
|
133
128
|
// Initial run
|
|
@@ -137,8 +132,6 @@ async function watchAction(options, command) {
|
|
|
137
132
|
// Disables cache for subsequent runs
|
|
138
133
|
// TODO: support updating hasher + write-only local cacheProvider for subsequent runs
|
|
139
134
|
for (const targetRun of scheduler.targetRuns.values()){
|
|
140
|
-
targetRun.options.cacheProvider = undefined;
|
|
141
|
-
targetRun.options.hasher = undefined;
|
|
142
135
|
targetRun.options.shouldCache = false;
|
|
143
136
|
}
|
|
144
137
|
// When initial run is done, disable fetching of caches on all targets, keep writing to the cache
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Command Line Interface for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/microsoft/lage"
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"@lage-run/config": "^0.1.1",
|
|
22
22
|
"@lage-run/find-npm-client": "^0.1.4",
|
|
23
23
|
"@lage-run/logger": "^1.2.2",
|
|
24
|
-
"@lage-run/scheduler": "^0.
|
|
24
|
+
"@lage-run/scheduler": "^0.11.0",
|
|
25
25
|
"@lage-run/scheduler-types": "^0.3.5",
|
|
26
26
|
"@lage-run/target-graph": "^0.8.1",
|
|
27
27
|
"@lage-run/cache": "^0.5.1",
|
|
28
|
-
"@lage-run/reporters": "^1.0
|
|
28
|
+
"@lage-run/reporters": "^1.1.0",
|
|
29
29
|
"commander": "^9.4.0",
|
|
30
30
|
"workspace-tools": "^0.30.0",
|
|
31
31
|
"chokidar": "3.5.3",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CacheOptions } from "@lage-run/cache";
|
|
2
|
-
import { RemoteFallbackCacheProvider, TargetHasher } from "@lage-run/cache";
|
|
3
|
-
import type { Logger } from "@lage-run/logger";
|
|
4
|
-
interface CreateCacheOptions {
|
|
5
|
-
cacheOptions?: CacheOptions;
|
|
6
|
-
logger: Logger;
|
|
7
|
-
root: string;
|
|
8
|
-
skipLocalCache: boolean;
|
|
9
|
-
cliArgs: string[];
|
|
10
|
-
}
|
|
11
|
-
export declare function createCache(options: CreateCacheOptions): {
|
|
12
|
-
cacheProvider: RemoteFallbackCacheProvider;
|
|
13
|
-
hasher: TargetHasher;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "createCache", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>createCache
|
|
8
|
-
});
|
|
9
|
-
const _cache = require("@lage-run/cache");
|
|
10
|
-
const _isRunningFromCIJs = require("../isRunningFromCI.js");
|
|
11
|
-
function createCache(options) {
|
|
12
|
-
const { cacheOptions , logger , root , skipLocalCache , cliArgs } = options;
|
|
13
|
-
const hasRemoteCacheConfig = !!cacheOptions?.cacheStorageConfig || !!process.env.BACKFILL_CACHE_PROVIDER || !!process.env.BACKFILL_CACHE_PROVIDER_OPTIONS;
|
|
14
|
-
// Create Cache Provider
|
|
15
|
-
const cacheProvider = new _cache.RemoteFallbackCacheProvider({
|
|
16
|
-
root,
|
|
17
|
-
logger,
|
|
18
|
-
localCacheProvider: skipLocalCache === true ? undefined : new _cache.BackfillCacheProvider({
|
|
19
|
-
logger,
|
|
20
|
-
root,
|
|
21
|
-
cacheOptions: {
|
|
22
|
-
outputGlob: cacheOptions?.outputGlob,
|
|
23
|
-
...cacheOptions?.internalCacheFolder && {
|
|
24
|
-
internalCacheFolder: cacheOptions.internalCacheFolder
|
|
25
|
-
},
|
|
26
|
-
...cacheOptions?.incrementalCaching && {
|
|
27
|
-
incrementalCaching: cacheOptions.incrementalCaching
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}),
|
|
31
|
-
remoteCacheProvider: hasRemoteCacheConfig ? new _cache.BackfillCacheProvider({
|
|
32
|
-
logger,
|
|
33
|
-
root,
|
|
34
|
-
cacheOptions: cacheOptions ?? {}
|
|
35
|
-
}) : undefined,
|
|
36
|
-
writeRemoteCache: cacheOptions?.writeRemoteCache === true || String(process.env.LAGE_WRITE_CACHE).toLowerCase() === "true" || _isRunningFromCIJs.isRunningFromCI
|
|
37
|
-
});
|
|
38
|
-
const hasher = new _cache.TargetHasher({
|
|
39
|
-
root,
|
|
40
|
-
environmentGlob: cacheOptions?.environmentGlob ?? [],
|
|
41
|
-
cacheKey: cacheOptions?.cacheKey,
|
|
42
|
-
cliArgs
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
cacheProvider,
|
|
46
|
-
hasher
|
|
47
|
-
};
|
|
48
|
-
}
|