@lage-run/cli 0.6.3 → 0.7.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 +31 -1
- package/CHANGELOG.md +18 -2
- package/lib/commands/addFilterOptions.d.ts +2 -0
- package/lib/commands/addFilterOptions.js +11 -0
- package/lib/commands/addLoggerOptions.js +1 -1
- package/lib/commands/run/action.d.ts +1 -0
- package/lib/commands/run/action.js +4 -1
- package/lib/commands/run/createCacheProvider.d.ts +1 -0
- package/lib/commands/run/createCacheProvider.js +3 -2
- package/lib/commands/run/index.js +3 -3
- package/lib/commands/run/infoAction.d.ts +14 -0
- package/lib/commands/run/infoAction.js +64 -0
- package/lib/commands/run/runAction.js +2 -1
- package/lib/commands/run/watchAction.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,37 @@
|
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Fri, 27 Jan 2023
|
|
5
|
+
"date": "Fri, 27 Jan 2023 20:50:19 GMT",
|
|
6
|
+
"tag": "@lage-run/cli_v0.7.0",
|
|
7
|
+
"version": "0.7.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/cli",
|
|
13
|
+
"commit": "2d6b70f69754030e144521409d3d5d6704746612",
|
|
14
|
+
"comment": "adding an info flag for run"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Fri, 27 Jan 2023 20:02:06 GMT",
|
|
21
|
+
"tag": "@lage-run/cli_v0.6.4",
|
|
22
|
+
"version": "0.6.4",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "kchau@microsoft.com",
|
|
27
|
+
"package": "@lage-run/cli",
|
|
28
|
+
"commit": "597b0e8ad233f460a0d16e0996079fa97bd9de14",
|
|
29
|
+
"comment": "make sure to take the task args into account for caching"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Fri, 27 Jan 2023 00:28:15 GMT",
|
|
6
36
|
"tag": "@lage-run/cli_v0.6.3",
|
|
7
37
|
"version": "0.6.3",
|
|
8
38
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @lage-run/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri, 27 Jan 2023
|
|
3
|
+
This log was last generated on Fri, 27 Jan 2023 20:50:19 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.7.0
|
|
8
|
+
|
|
9
|
+
Fri, 27 Jan 2023 20:50:19 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- adding an info flag for run (kchau@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 0.6.4
|
|
16
|
+
|
|
17
|
+
Fri, 27 Jan 2023 20:02:06 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- make sure to take the task args into account for caching (kchau@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 0.6.3
|
|
8
24
|
|
|
9
|
-
Fri, 27 Jan 2023 00:28:
|
|
25
|
+
Fri, 27 Jan 2023 00:28:15 GMT
|
|
10
26
|
|
|
11
27
|
### Patches
|
|
12
28
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "addFilterOptions", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>addFilterOptions
|
|
8
|
+
});
|
|
9
|
+
function addFilterOptions(program) {
|
|
10
|
+
return program.option("--scope <scope...>", "scopes the run to a subset of packages (by default, includes the dependencies and dependents as well)").option("--no-deps|--no-dependents", "disables running any dependents of the scoped packages").option("--include-dependencies|--dependencies", 'adds the scoped packages dependencies as the "entry points" for the target graph run').option("--to <scope...>", "runs up to a package (shorthand for --scope=<scope...> --no-dependents)").option("--since <since>", "only runs packages that have changed since the given commit, tag, or branch").option("--ignore <ignore...>", "ignores files when calculating the scope with `--since` in addition to the files specified in lage.config", []).option("--allow-no-target-runs");
|
|
11
|
+
}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "addLoggerOptions", {
|
|
|
9
9
|
const _commander = require("commander");
|
|
10
10
|
function addLoggerOptions(program) {
|
|
11
11
|
const isCI = process.env.CI || process.env.TF_BUILD;
|
|
12
|
-
return program.option("--reporter <reporter...>", "reporter", "npmLog").addOption(new _commander.Option("--progress").conflicts("--reporter").default(!isCI)).addOption(new _commander.Option("--log-level <level>", "log level").choices([
|
|
12
|
+
return program.option("--reporter <reporter...>", "reporter", "npmLog").option("--grouped", "groups the logs", false).addOption(new _commander.Option("--progress").conflicts("--reporter").default(!isCI)).addOption(new _commander.Option("--log-level <level>", "log level").choices([
|
|
13
13
|
"info",
|
|
14
14
|
"warn",
|
|
15
15
|
"error",
|
|
@@ -6,10 +6,13 @@ Object.defineProperty(exports, "action", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>action
|
|
8
8
|
});
|
|
9
|
+
const _infoActionJs = require("./infoAction.js");
|
|
9
10
|
const _runActionJs = require("./runAction.js");
|
|
10
11
|
const _watchActionJs = require("./watchAction.js");
|
|
11
12
|
async function action(options, command) {
|
|
12
|
-
if (options.
|
|
13
|
+
if (options.info) {
|
|
14
|
+
return (0, _infoActionJs.infoAction)(options, command);
|
|
15
|
+
} else if (options.unstableWatch) {
|
|
13
16
|
return (0, _watchActionJs.watchAction)(options, command);
|
|
14
17
|
} else {
|
|
15
18
|
return (0, _runActionJs.runAction)(options, command);
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "createCache", {
|
|
|
9
9
|
const _cache = require("@lage-run/cache");
|
|
10
10
|
const _isRunningFromCIJs = require("../isRunningFromCI.js");
|
|
11
11
|
function createCache(options) {
|
|
12
|
-
const { cacheOptions , logger , root , skipLocalCache } = options;
|
|
12
|
+
const { cacheOptions , logger , root , skipLocalCache , cliArgs } = options;
|
|
13
13
|
const hasRemoteCacheConfig = !!cacheOptions?.cacheStorageConfig || !!process.env.BACKFILL_CACHE_PROVIDER || !!process.env.BACKFILL_CACHE_PROVIDER_OPTIONS;
|
|
14
14
|
// Create Cache Provider
|
|
15
15
|
const cacheProvider = new _cache.RemoteFallbackCacheProvider({
|
|
@@ -38,7 +38,8 @@ function createCache(options) {
|
|
|
38
38
|
const hasher = new _cache.TargetHasher({
|
|
39
39
|
root,
|
|
40
40
|
environmentGlob: cacheOptions?.environmentGlob ?? [],
|
|
41
|
-
cacheKey: cacheOptions?.cacheKey
|
|
41
|
+
cacheKey: cacheOptions?.cacheKey,
|
|
42
|
+
cliArgs
|
|
42
43
|
});
|
|
43
44
|
return {
|
|
44
45
|
cacheProvider,
|
|
@@ -10,10 +10,10 @@ const _commander = require("commander");
|
|
|
10
10
|
const _actionJs = require("./action.js");
|
|
11
11
|
const _addLoggerOptionsJs = require("../addLoggerOptions.js");
|
|
12
12
|
const _isRunningFromCIJs = require("../isRunningFromCI.js");
|
|
13
|
+
const _addFilterOptionsJs = require("../addFilterOptions.js");
|
|
13
14
|
const runCommand = new _commander.Command("run");
|
|
14
|
-
(0, _addLoggerOptionsJs.addLoggerOptions)(runCommand).action(_actionJs.action).option("-c, --concurrency <n>", "concurrency", (value)=>parseInt(value, 10)).option("--max-workers-per-task <maxWorkersPerTarget...>", "set max worker per task, e.g. --max-workers-per-task build=2 test=4", [])//
|
|
15
|
-
.option("--
|
|
16
|
-
.option("--grouped", "groups the logs", false).option("--no-cache", "disables the cache").option("--reset-cache", "resets the cache, filling it after a run").option("--skip-local-cache", "skips caching locally (defaults to true in CI environments)", _isRunningFromCIJs.isRunningFromCI).option("--profile [profile]", "writes a run profile into a file that can be processed by Chromium devtool").option("--ignore <ignore...>", "ignores files when calculating the scope with `--since` in addition to the files specified in lage.config", []).option("--nodearg|--node-arg <nodeArg>", 'arguments to be passed to node (e.g. --nodearg="--max_old_space_size=1234 --heap-prof" - set via "NODE_OPTIONS" environment variable').option("--continue", "continues the run even on error").option("--unstable-watch", "runs in watch mode").allowUnknownOption(true).addHelpCommand("[run] command1 [command2...commandN] [options]", "run commands").addHelpText("after", `
|
|
15
|
+
(0, _addFilterOptionsJs.addFilterOptions)((0, _addLoggerOptionsJs.addLoggerOptions)(runCommand)).action(_actionJs.action).option("-c, --concurrency <n>", "concurrency", (value)=>parseInt(value, 10)).option("--max-workers-per-task <maxWorkersPerTarget...>", "set max worker per task, e.g. --max-workers-per-task build=2 test=4", [])// Run Command Options
|
|
16
|
+
.option("--no-cache", "disables the cache").option("--reset-cache", "resets the cache, filling it after a run").option("--skip-local-cache", "skips caching locally (defaults to true in CI environments)", _isRunningFromCIJs.isRunningFromCI).option("--profile [profile]", "writes a run profile into a file that can be processed by Chromium devtool").option("--nodearg|--node-arg <nodeArg>", 'arguments to be passed to node (e.g. --nodearg="--max_old_space_size=1234 --heap-prof" - set via "NODE_OPTIONS" environment variable').option("--continue", "continues the run even on error").addOption(new _commander.Option("--info", "outputs information about a run action, suitable for calculating shards or as an input for another task runner").conflicts("unstableWatch")).option("--unstable-watch", "runs in watch mode").allowUnknownOption(true).addHelpCommand("[run] command1 [command2...commandN] [options]", "run commands").addHelpText("after", `
|
|
17
17
|
Runs a set of commands in a target graph. The targets are defined by packages and their scripts as defined the package.json files.
|
|
18
18
|
|
|
19
19
|
Examples
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { ReporterInitOptions } from "@lage-run/reporters";
|
|
3
|
+
interface RunOptions extends ReporterInitOptions {
|
|
4
|
+
dependencies: boolean;
|
|
5
|
+
dependents: boolean;
|
|
6
|
+
since: string;
|
|
7
|
+
scope: string[];
|
|
8
|
+
to: string[];
|
|
9
|
+
cache: boolean;
|
|
10
|
+
nodeArg: string;
|
|
11
|
+
ignore: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function infoAction(options: RunOptions, command: Command): Promise<void>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "infoAction", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>infoAction
|
|
8
|
+
});
|
|
9
|
+
const _createCacheProviderJs = require("./createCacheProvider.js");
|
|
10
|
+
const _createTargetGraphJs = require("./createTargetGraph.js");
|
|
11
|
+
const _filterArgsForTasksJs = require("./filterArgsForTasks.js");
|
|
12
|
+
const _getConfigJs = require("../../config/getConfig.js");
|
|
13
|
+
const _workspaceTools = require("workspace-tools");
|
|
14
|
+
const _logger = /*#__PURE__*/ _interopRequireDefault(require("@lage-run/logger"));
|
|
15
|
+
const _targetGraph = require("@lage-run/target-graph");
|
|
16
|
+
function _interopRequireDefault(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async function infoAction(options, command) {
|
|
22
|
+
const cwd = process.cwd();
|
|
23
|
+
const config = await (0, _getConfigJs.getConfig)(cwd);
|
|
24
|
+
const logger = (0, _logger.default)();
|
|
25
|
+
// Build Target Graph
|
|
26
|
+
const root = (0, _workspaceTools.getWorkspaceRoot)(process.cwd());
|
|
27
|
+
const packageInfos = (0, _workspaceTools.getPackageInfos)(root);
|
|
28
|
+
const { tasks , taskArgs } = (0, _filterArgsForTasksJs.filterArgsForTasks)(command.args);
|
|
29
|
+
const targetGraph = (0, _createTargetGraphJs.createTargetGraph)({
|
|
30
|
+
logger,
|
|
31
|
+
root,
|
|
32
|
+
dependencies: options.dependencies,
|
|
33
|
+
dependents: options.dependents && !options.to,
|
|
34
|
+
ignore: options.ignore.concat(config.ignore),
|
|
35
|
+
pipeline: config.pipeline,
|
|
36
|
+
repoWideChanges: config.repoWideChanges,
|
|
37
|
+
scope: (options.scope ?? []).concat(options.to ?? []),
|
|
38
|
+
since: options.since,
|
|
39
|
+
outputs: config.cacheOptions.outputGlob,
|
|
40
|
+
tasks,
|
|
41
|
+
packageInfos
|
|
42
|
+
});
|
|
43
|
+
// Make sure we do not attempt writeRemoteCache in info mode
|
|
44
|
+
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
|
+
const { targets } = targetGraph;
|
|
53
|
+
for (const target of targets.values()){
|
|
54
|
+
if (target.id === (0, _targetGraph.getStartTargetId)()) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const startIdIndex = target.dependencies.indexOf((0, _targetGraph.getStartTargetId)());
|
|
58
|
+
target.dependencies.splice(startIdIndex, 1);
|
|
59
|
+
process.stdout.write(`${JSON.stringify({
|
|
60
|
+
...target,
|
|
61
|
+
hash: await hasher.hash(target)
|
|
62
|
+
})}\n`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -67,7 +67,8 @@ async function runAction(options, command) {
|
|
|
67
67
|
root,
|
|
68
68
|
logger,
|
|
69
69
|
cacheOptions: config.cacheOptions,
|
|
70
|
-
skipLocalCache: options.skipLocalCache
|
|
70
|
+
skipLocalCache: options.skipLocalCache,
|
|
71
|
+
cliArgs: taskArgs
|
|
71
72
|
});
|
|
72
73
|
logger.verbose(`Running with ${concurrency} workers`);
|
|
73
74
|
const filteredPipeline = (0, _filterPipelineDefinitionsJs.filterPipelineDefinitions)(targetGraph.targets.values(), config.pipeline);
|
|
@@ -92,7 +92,8 @@ async function watchAction(options, command) {
|
|
|
92
92
|
root,
|
|
93
93
|
logger,
|
|
94
94
|
cacheOptions: config.cacheOptions,
|
|
95
|
-
skipLocalCache: false
|
|
95
|
+
skipLocalCache: false,
|
|
96
|
+
cliArgs: taskArgs
|
|
96
97
|
});
|
|
97
98
|
const filteredPipeline = (0, _filterPipelineDefinitionsJs.filterPipelineDefinitions)(targetGraph.targets.values(), config.pipeline);
|
|
98
99
|
const maxWorkersPerTaskMap = (0, _getMaxWorkersPerTaskJs.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
|