@lage-run/cli 0.15.0 → 0.15.2
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 +75 -3
- package/CHANGELOG.md +25 -2
- package/lib/cache/createCacheProvider.d.ts +14 -0
- package/lib/cache/createCacheProvider.js +24 -0
- package/lib/cache/isRunningFromCI.d.ts +1 -0
- package/lib/cache/isRunningFromCI.js +11 -0
- package/lib/cli.js +10 -10
- package/lib/commands/addFilterOptions.js +3 -1
- package/lib/commands/addLoggerOptions.js +3 -1
- package/lib/commands/affected/action.js +10 -8
- package/lib/commands/affected/index.js +6 -4
- package/lib/commands/cache/action.js +9 -7
- package/lib/commands/cache/clearCache.js +5 -3
- package/lib/commands/cache/index.js +6 -4
- package/lib/commands/cache/pruneCache.js +5 -3
- package/lib/commands/cache/runners/ClearCacheRunner.js +6 -4
- package/lib/commands/cache/runners/PruneCacheRunner.js +6 -4
- package/lib/commands/createReporter.js +7 -5
- package/lib/commands/init/action.js +9 -6
- package/lib/commands/init/index.js +6 -4
- package/lib/commands/initializeReporters.js +5 -3
- package/lib/commands/isRunningFromCI.js +3 -1
- package/lib/commands/run/action.js +9 -7
- package/lib/commands/run/createTargetGraph.js +7 -5
- package/lib/commands/run/filterArgsForTasks.js +3 -1
- package/lib/commands/run/filterPipelineDefinitions.js +3 -1
- package/lib/commands/run/index.js +9 -7
- package/lib/commands/run/infoAction.js +15 -13
- package/lib/commands/run/runAction.js +29 -18
- package/lib/commands/run/runners/NoOpRunner.js +3 -1
- package/lib/commands/run/runners/NpmScriptRunner.js +3 -1
- package/lib/commands/run/runners/WorkerRunner.js +3 -1
- package/lib/commands/run/watchAction.js +27 -16
- package/lib/commands/run/watcher.js +9 -7
- package/lib/filter/getFilteredPackages.js +16 -12
- package/lib/showHelp.js +3 -1
- package/lib/types/errors.js +3 -1
- package/package.json +8 -7
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,79 @@
|
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 08 May 2023 22:26:52 GMT",
|
|
6
|
+
"tag": "@lage-run/cli_v0.15.2",
|
|
7
|
+
"version": "0.15.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/cli",
|
|
13
|
+
"commit": "5a132808f166179bc316a279c9e11a13d3a39103",
|
|
14
|
+
"comment": "fixed to utilize the correct package for the hasher"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/cli",
|
|
19
|
+
"comment": "Bump @lage-run/cache to v1.1.1",
|
|
20
|
+
"commit": "5a132808f166179bc316a279c9e11a13d3a39103"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@lage-run/cli",
|
|
25
|
+
"comment": "Bump @lage-run/config to v0.2.1",
|
|
26
|
+
"commit": "5a132808f166179bc316a279c9e11a13d3a39103"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@lage-run/cli",
|
|
31
|
+
"comment": "Bump @lage-run/hasher to v1.0.0",
|
|
32
|
+
"commit": "5a132808f166179bc316a279c9e11a13d3a39103"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@lage-run/cli",
|
|
37
|
+
"comment": "Bump @lage-run/reporters to v1.2.2",
|
|
38
|
+
"commit": "5a132808f166179bc316a279c9e11a13d3a39103"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@lage-run/cli",
|
|
43
|
+
"comment": "Bump @lage-run/scheduler to v1.0.0",
|
|
44
|
+
"commit": "5a132808f166179bc316a279c9e11a13d3a39103"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@lage-run/cli",
|
|
49
|
+
"comment": "Bump @lage-run/scheduler-types to v0.3.9",
|
|
50
|
+
"commit": "5a132808f166179bc316a279c9e11a13d3a39103"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@lage-run/cli",
|
|
55
|
+
"comment": "Bump @lage-run/target-graph to v0.8.6",
|
|
56
|
+
"commit": "5a132808f166179bc316a279c9e11a13d3a39103"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"date": "Mon, 08 May 2023 16:33:24 GMT",
|
|
63
|
+
"tag": "@lage-run/cli_v0.15.1",
|
|
64
|
+
"version": "0.15.1",
|
|
65
|
+
"comments": {
|
|
66
|
+
"patch": [
|
|
67
|
+
{
|
|
68
|
+
"author": "beachball",
|
|
69
|
+
"package": "@lage-run/cli",
|
|
70
|
+
"comment": "Bump @lage-run/reporters to v1.2.1",
|
|
71
|
+
"commit": "fbe51aa289332ec599ceeace4171dc1f7d2f5377"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"date": "Wed, 26 Apr 2023 04:56:20 GMT",
|
|
6
78
|
"tag": "@lage-run/cli_v0.15.0",
|
|
7
79
|
"version": "0.15.0",
|
|
8
80
|
"comments": {
|
|
@@ -17,13 +89,13 @@
|
|
|
17
89
|
"author": "beachball",
|
|
18
90
|
"package": "@lage-run/cli",
|
|
19
91
|
"comment": "Bump @lage-run/config to v0.2.0",
|
|
20
|
-
"commit": "
|
|
92
|
+
"commit": "994af55fcc890b448fc2b5cd5e4ba8bca0832997"
|
|
21
93
|
},
|
|
22
94
|
{
|
|
23
95
|
"author": "beachball",
|
|
24
96
|
"package": "@lage-run/cli",
|
|
25
97
|
"comment": "Bump @lage-run/scheduler to v0.11.4",
|
|
26
|
-
"commit": "
|
|
98
|
+
"commit": "994af55fcc890b448fc2b5cd5e4ba8bca0832997"
|
|
27
99
|
}
|
|
28
100
|
]
|
|
29
101
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
# Change Log - @lage-run/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 08 May 2023 22:26:52 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.15.2
|
|
8
|
+
|
|
9
|
+
Mon, 08 May 2023 22:26:52 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- fixed to utilize the correct package for the hasher (kchau@microsoft.com)
|
|
14
|
+
- Bump @lage-run/cache to v1.1.1
|
|
15
|
+
- Bump @lage-run/config to v0.2.1
|
|
16
|
+
- Bump @lage-run/hasher to v1.0.0
|
|
17
|
+
- Bump @lage-run/reporters to v1.2.2
|
|
18
|
+
- Bump @lage-run/scheduler to v1.0.0
|
|
19
|
+
- Bump @lage-run/scheduler-types to v0.3.9
|
|
20
|
+
- Bump @lage-run/target-graph to v0.8.6
|
|
21
|
+
|
|
22
|
+
## 0.15.1
|
|
23
|
+
|
|
24
|
+
Mon, 08 May 2023 16:33:24 GMT
|
|
25
|
+
|
|
26
|
+
### Patches
|
|
27
|
+
|
|
28
|
+
- Bump @lage-run/reporters to v1.2.1
|
|
29
|
+
|
|
7
30
|
## 0.15.0
|
|
8
31
|
|
|
9
|
-
Wed, 26 Apr 2023 04:56:
|
|
32
|
+
Wed, 26 Apr 2023 04:56:20 GMT
|
|
10
33
|
|
|
11
34
|
### Minor changes
|
|
12
35
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CacheOptions } from "@lage-run/cache";
|
|
2
|
+
import { TargetHasher } from "@lage-run/hasher";
|
|
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): Promise<{
|
|
12
|
+
hasher: TargetHasher;
|
|
13
|
+
}>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createCache", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return createCache;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _hasher = require("@lage-run/hasher");
|
|
12
|
+
async function createCache(options) {
|
|
13
|
+
const { cacheOptions , root , cliArgs } = options;
|
|
14
|
+
const hasher = new _hasher.TargetHasher({
|
|
15
|
+
root,
|
|
16
|
+
environmentGlob: cacheOptions?.environmentGlob ?? [],
|
|
17
|
+
cacheKey: cacheOptions?.cacheKey,
|
|
18
|
+
cliArgs
|
|
19
|
+
});
|
|
20
|
+
await hasher.initialize();
|
|
21
|
+
return {
|
|
22
|
+
hasher
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isRunningFromCI: boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "isRunningFromCI", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return isRunningFromCI;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const isRunningFromCI = process.env.NODE_ENV !== "test" && (!!process.env.CI || !!process.env.TF_BUILD);
|
package/lib/cli.js
CHANGED
|
@@ -3,24 +3,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _commander = require("commander");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
6
|
+
const _index = require("./commands/run/index.js");
|
|
7
|
+
const _index1 = require("./commands/cache/index.js");
|
|
8
|
+
const _errors = require("./types/errors.js");
|
|
9
|
+
const _index2 = require("./commands/affected/index.js");
|
|
10
|
+
const _index3 = require("./commands/init/index.js");
|
|
11
11
|
async function main() {
|
|
12
12
|
const program = new _commander.Command();
|
|
13
|
-
program.addCommand(
|
|
13
|
+
program.addCommand(_index.runCommand, {
|
|
14
14
|
isDefault: true
|
|
15
15
|
});
|
|
16
|
-
program.addCommand(
|
|
17
|
-
program.addCommand(
|
|
18
|
-
program.addCommand(
|
|
16
|
+
program.addCommand(_index1.cacheCommand);
|
|
17
|
+
program.addCommand(_index2.affectedCommand);
|
|
18
|
+
program.addCommand(_index3.initCommand);
|
|
19
19
|
await program.parseAsync(process.argv);
|
|
20
20
|
}
|
|
21
21
|
main().catch((err)=>{
|
|
22
22
|
/* eslint-disable no-console */ switch(err){
|
|
23
|
-
case
|
|
23
|
+
case _errors.NoTargetFoundError:
|
|
24
24
|
console.log("lage: no targets found that matches the given scope.");
|
|
25
25
|
break;
|
|
26
26
|
default:
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "addFilterOptions", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return addFilterOptions;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
function addFilterOptions(program) {
|
|
10
12
|
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", []);
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "addLoggerOptions", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return addLoggerOptions;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _commander = require("commander");
|
|
10
12
|
function addLoggerOptions(program) {
|
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "affectedAction", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return affectedAction;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _logger = /*#__PURE__*/
|
|
10
|
-
const
|
|
11
|
+
const _logger = /*#__PURE__*/ _interop_require_default(require("@lage-run/logger"));
|
|
12
|
+
const _workspacetools = require("workspace-tools");
|
|
11
13
|
const _config = require("@lage-run/config");
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
+
const _getFilteredPackages = require("../../filter/getFilteredPackages.js");
|
|
15
|
+
function _interop_require_default(obj) {
|
|
14
16
|
return obj && obj.__esModule ? obj : {
|
|
15
17
|
default: obj
|
|
16
18
|
};
|
|
@@ -20,9 +22,9 @@ async function affectedAction(options) {
|
|
|
20
22
|
const cwd = process.cwd();
|
|
21
23
|
const config = await (0, _config.getConfig)(cwd);
|
|
22
24
|
const logger = (0, _logger.default)();
|
|
23
|
-
const root = (0,
|
|
24
|
-
const packageInfos = await (0,
|
|
25
|
-
const packages = (0,
|
|
25
|
+
const root = (0, _workspacetools.getWorkspaceRoot)(cwd);
|
|
26
|
+
const packageInfos = await (0, _workspacetools.getPackageInfosAsync)(root);
|
|
27
|
+
const packages = (0, _getFilteredPackages.getFilteredPackages)({
|
|
26
28
|
root,
|
|
27
29
|
logger,
|
|
28
30
|
packageInfos,
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "affectedCommand", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return affectedCommand;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _commander = require("commander");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
+
const _addFilterOptions = require("../addFilterOptions.js");
|
|
13
|
+
const _action = require("./action.js");
|
|
12
14
|
const affectedCommand = new _commander.Command("affected");
|
|
13
|
-
(0,
|
|
15
|
+
(0, _addFilterOptions.addFilterOptions)(affectedCommand).action(_action.affectedAction).option("--output-format <graph|json|default>", `Generate a report about what packages are affected by the current change (defaults to human readable format) ` + `"graph" will generate a GraphViz .dot file format`).option("--since <branch>", "Calculate changes since this branch (defaults to origin/master)", "origin/master");
|
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "cacheAction", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return cacheAction;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
11
|
+
const _clearCache = require("./clearCache.js");
|
|
10
12
|
const _config = require("@lage-run/config");
|
|
11
|
-
const
|
|
12
|
-
const _logger = /*#__PURE__*/
|
|
13
|
-
function
|
|
13
|
+
const _pruneCache = require("./pruneCache.js");
|
|
14
|
+
const _logger = /*#__PURE__*/ _interop_require_default(require("@lage-run/logger"));
|
|
15
|
+
function _interop_require_default(obj) {
|
|
14
16
|
return obj && obj.__esModule ? obj : {
|
|
15
17
|
default: obj
|
|
16
18
|
};
|
|
@@ -20,14 +22,14 @@ async function cacheAction(options, command) {
|
|
|
20
22
|
const config = await (0, _config.getConfig)(cwd);
|
|
21
23
|
const logger = (0, _logger.default)();
|
|
22
24
|
if (options.clear) {
|
|
23
|
-
return await (0,
|
|
25
|
+
return await (0, _clearCache.clearCache)({
|
|
24
26
|
cwd: process.cwd(),
|
|
25
27
|
internalCacheFolder: config.cacheOptions.internalCacheFolder,
|
|
26
28
|
logger,
|
|
27
29
|
concurrency: options.concurrency
|
|
28
30
|
});
|
|
29
31
|
} else if (options.prune) {
|
|
30
|
-
return await (0,
|
|
32
|
+
return await (0, _pruneCache.pruneCache)({
|
|
31
33
|
pruneDays: options.prune,
|
|
32
34
|
cwd: process.cwd(),
|
|
33
35
|
internalCacheFolder: config.cacheOptions.internalCacheFolder,
|
|
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "clearCache", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return clearCache;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _config = require("@lage-run/config");
|
|
10
|
-
const
|
|
12
|
+
const _workspacetools = require("workspace-tools");
|
|
11
13
|
const _cache = require("@lage-run/cache");
|
|
12
14
|
async function clearCache(options) {
|
|
13
15
|
const { logger , cwd } = options;
|
|
14
16
|
const config = await (0, _config.getConfig)(cwd);
|
|
15
|
-
const workspaceRoot = (0,
|
|
17
|
+
const workspaceRoot = (0, _workspacetools.getWorkspaceRoot)(cwd);
|
|
16
18
|
const concurrency = (0, _config.getConcurrency)(options.concurrency, config.concurrency);
|
|
17
19
|
if (!workspaceRoot) {
|
|
18
20
|
return;
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "cacheCommand", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return cacheCommand;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _commander = require("commander");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
+
const _addLoggerOptions = require("../addLoggerOptions.js");
|
|
13
|
+
const _action = require("./action.js");
|
|
12
14
|
const cacheCommand = new _commander.Command("cache");
|
|
13
|
-
(0,
|
|
15
|
+
(0, _addLoggerOptions.addLoggerOptions)(cacheCommand).action(_action.cacheAction).addOption(new _commander.Option("--prune <days>", "Prunes cache older than certain number of <days>").argParser(parseInt).conflicts("--clear")).option("--clear", "Clears the cache locally");
|
|
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "pruneCache", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return pruneCache;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
11
|
+
const _workspacetools = require("workspace-tools");
|
|
10
12
|
const _config = require("@lage-run/config");
|
|
11
13
|
const _cache = require("@lage-run/cache");
|
|
12
14
|
async function pruneCache(options) {
|
|
13
15
|
const { logger , cwd , pruneDays } = options;
|
|
14
16
|
const config = await (0, _config.getConfig)(cwd);
|
|
15
|
-
const workspaceRoot = (0,
|
|
17
|
+
const workspaceRoot = (0, _workspacetools.getWorkspaceRoot)(cwd);
|
|
16
18
|
const concurrency = (0, _config.getConcurrency)(options.concurrency, config.concurrency);
|
|
17
19
|
if (!workspaceRoot) {
|
|
18
20
|
return;
|
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "ClearCacheRunner", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return ClearCacheRunner;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _fs = /*#__PURE__*/
|
|
10
|
-
const _path = /*#__PURE__*/
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
11
13
|
const _promises = require("fs/promises");
|
|
12
|
-
function
|
|
14
|
+
function _interop_require_default(obj) {
|
|
13
15
|
return obj && obj.__esModule ? obj : {
|
|
14
16
|
default: obj
|
|
15
17
|
};
|
|
@@ -4,12 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "PruneCacheRunner", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return PruneCacheRunner;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _fs = /*#__PURE__*/
|
|
10
|
-
const _path = /*#__PURE__*/
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
11
13
|
const _promises = require("fs/promises");
|
|
12
|
-
function
|
|
14
|
+
function _interop_require_default(obj) {
|
|
13
15
|
return obj && obj.__esModule ? obj : {
|
|
14
16
|
default: obj
|
|
15
17
|
};
|
|
@@ -4,14 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "createReporter", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return createReporter;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _logger = require("@lage-run/logger");
|
|
10
12
|
const _reporters = require("@lage-run/reporters");
|
|
11
|
-
const
|
|
13
|
+
const _workspacetools = require("workspace-tools");
|
|
12
14
|
const _fs = require("fs");
|
|
13
|
-
const _path = /*#__PURE__*/
|
|
14
|
-
function
|
|
15
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
16
|
+
function _interop_require_default(obj) {
|
|
15
17
|
return obj && obj.__esModule ? obj : {
|
|
16
18
|
default: obj
|
|
17
19
|
};
|
|
@@ -19,7 +21,7 @@ function _interopRequireDefault(obj) {
|
|
|
19
21
|
function createReporter(reporter, options) {
|
|
20
22
|
const { verbose , grouped , logLevel: logLevelName , concurrency , profile , progress , logFile } = options;
|
|
21
23
|
const logLevel = _logger.LogLevel[logLevelName];
|
|
22
|
-
const root = (0,
|
|
24
|
+
const root = (0, _workspacetools.findPackageRoot)(__filename);
|
|
23
25
|
const packageJson = JSON.parse((0, _fs.readFileSync)(_path.default.join(root, "package.json"), "utf-8"));
|
|
24
26
|
const version = packageJson.version;
|
|
25
27
|
switch(reporter){
|
|
@@ -4,18 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "initAction", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return initAction;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _config = require("@lage-run/config");
|
|
10
|
-
const _fs = /*#__PURE__*/
|
|
11
|
-
const _path = /*#__PURE__*/
|
|
12
|
-
const _execa = /*#__PURE__*/
|
|
13
|
-
function
|
|
12
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
13
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
14
|
+
const _execa = /*#__PURE__*/ _interop_require_default(require("execa"));
|
|
15
|
+
function _interop_require_default(obj) {
|
|
14
16
|
return obj && obj.__esModule ? obj : {
|
|
15
17
|
default: obj
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
|
-
var _packageJson, _packageJson1;
|
|
19
20
|
async function initAction() {
|
|
20
21
|
const cwd = process.cwd();
|
|
21
22
|
const config = await (0, _config.readConfigFile)(cwd);
|
|
@@ -79,6 +80,7 @@ function whichWorkspaceManager(cwd) {
|
|
|
79
80
|
throw new Error("not a workspace");
|
|
80
81
|
}
|
|
81
82
|
async function installLage(cwd, workspaceManager, pipeline) {
|
|
83
|
+
var _packageJson;
|
|
82
84
|
const lageVersion = getLageVersion();
|
|
83
85
|
const packageJson = readPackageJson(cwd);
|
|
84
86
|
(_packageJson = packageJson).scripts ?? (_packageJson.scripts = {});
|
|
@@ -89,6 +91,7 @@ async function installLage(cwd, workspaceManager, pipeline) {
|
|
|
89
91
|
packageJson.scripts.lage = `node common/scripts/install-run.js lage@${lageVersion} lage`;
|
|
90
92
|
writePackageJson(cwd, packageJson);
|
|
91
93
|
} else {
|
|
94
|
+
var _packageJson1;
|
|
92
95
|
packageJson.scripts.lage = "lage";
|
|
93
96
|
(_packageJson1 = packageJson).devDependencies ?? (_packageJson1.devDependencies = {});
|
|
94
97
|
packageJson.devDependencies.lage = lageVersion;
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "initCommand", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return initCommand;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _commander = require("commander");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
+
const _addFilterOptions = require("../addFilterOptions.js");
|
|
13
|
+
const _action = require("./action.js");
|
|
12
14
|
const initCommand = new _commander.Command("init");
|
|
13
|
-
(0,
|
|
15
|
+
(0, _addFilterOptions.addFilterOptions)(initCommand).description("Install lage in a workspace and create a config file").action(_action.initAction);
|
|
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "initializeReporters", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return initializeReporters;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
11
|
+
const _createReporter = require("./createReporter.js");
|
|
10
12
|
function initializeReporters(logger, options) {
|
|
11
13
|
const { reporter } = options;
|
|
12
14
|
// filter out falsy values (e.g. undefined) from the reporter array
|
|
@@ -22,7 +24,7 @@ function initializeReporters(logger, options) {
|
|
|
22
24
|
reporterOptions.push("profile");
|
|
23
25
|
}
|
|
24
26
|
for (const reporterName of reporterOptions){
|
|
25
|
-
const reporterInstance = (0,
|
|
27
|
+
const reporterInstance = (0, _createReporter.createReporter)(reporterName, options);
|
|
26
28
|
logger.addReporter(reporterInstance);
|
|
27
29
|
}
|
|
28
30
|
return logger.reporters;
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "isRunningFromCI", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return isRunningFromCI;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const isRunningFromCI = process.env.NODE_ENV !== "test" && (!!process.env.CI || !!process.env.TF_BUILD);
|
|
@@ -4,17 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "action", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return action;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
const _infoAction = require("./infoAction.js");
|
|
12
|
+
const _runAction = require("./runAction.js");
|
|
13
|
+
const _watchAction = require("./watchAction.js");
|
|
12
14
|
async function action(options, command) {
|
|
13
15
|
if (options.info) {
|
|
14
|
-
return (0,
|
|
16
|
+
return (0, _infoAction.infoAction)(options, command);
|
|
15
17
|
} else if (options.unstableWatch) {
|
|
16
|
-
return (0,
|
|
18
|
+
return (0, _watchAction.watchAction)(options, command);
|
|
17
19
|
} else {
|
|
18
|
-
return (0,
|
|
20
|
+
return (0, _runAction.runAction)(options, command);
|
|
19
21
|
}
|
|
20
22
|
}
|
|
@@ -4,14 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "createTargetGraph", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return createTargetGraph;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
+
const _targetgraph = require("@lage-run/target-graph");
|
|
12
|
+
const _getFilteredPackages = require("../../filter/getFilteredPackages.js");
|
|
11
13
|
function createTargetGraph(options) {
|
|
12
14
|
const { logger , root , dependencies , dependents , since , scope , repoWideChanges , ignore , pipeline , outputs , tasks , packageInfos } = options;
|
|
13
|
-
const builder = new
|
|
14
|
-
const packages = (0,
|
|
15
|
+
const builder = new _targetgraph.WorkspaceTargetGraphBuilder(root, packageInfos);
|
|
16
|
+
const packages = (0, _getFilteredPackages.getFilteredPackages)({
|
|
15
17
|
root,
|
|
16
18
|
logger,
|
|
17
19
|
packageInfos,
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "filterArgsForTasks", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return filterArgsForTasks;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
function filterArgsForTasks(args) {
|
|
10
12
|
const optionsPosition = args.findIndex((arg)=>arg.startsWith("-"));
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "filterPipelineDefinitions", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return filterPipelineDefinitions;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
function filterPipelineDefinitions(targets, pipeline) {
|
|
10
12
|
const tasksSet = new Set();
|
|
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "runCommand", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return runCommand;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _commander = require("commander");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const _action = require("./action.js");
|
|
13
|
+
const _addLoggerOptions = require("../addLoggerOptions.js");
|
|
14
|
+
const _isRunningFromCI = require("../isRunningFromCI.js");
|
|
15
|
+
const _addFilterOptions = require("../addFilterOptions.js");
|
|
14
16
|
const runCommand = new _commander.Command("run");
|
|
15
|
-
(0,
|
|
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)",
|
|
17
|
+
(0, _addFilterOptions.addFilterOptions)((0, _addLoggerOptions.addLoggerOptions)(runCommand)).action(_action.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
|
|
18
|
+
.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)", _isRunningFromCI.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").option("--allow-no-target-runs").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
19
|
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
20
|
|
|
19
21
|
Examples
|
|
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "infoAction", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return infoAction;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
+
const _createTargetGraph = require("./createTargetGraph.js");
|
|
12
|
+
const _filterArgsForTasks = require("./filterArgsForTasks.js");
|
|
11
13
|
const _config = require("@lage-run/config");
|
|
12
|
-
const
|
|
13
|
-
const _logger = /*#__PURE__*/
|
|
14
|
-
const
|
|
15
|
-
function
|
|
14
|
+
const _workspacetools = require("workspace-tools");
|
|
15
|
+
const _logger = /*#__PURE__*/ _interop_require_default(require("@lage-run/logger"));
|
|
16
|
+
const _targetgraph = require("@lage-run/target-graph");
|
|
17
|
+
function _interop_require_default(obj) {
|
|
16
18
|
return obj && obj.__esModule ? obj : {
|
|
17
19
|
default: obj
|
|
18
20
|
};
|
|
@@ -22,10 +24,10 @@ async function infoAction(options, command) {
|
|
|
22
24
|
const config = await (0, _config.getConfig)(cwd);
|
|
23
25
|
const logger = (0, _logger.default)();
|
|
24
26
|
// Build Target Graph
|
|
25
|
-
const root = (0,
|
|
26
|
-
const packageInfos = await (0,
|
|
27
|
-
const { tasks } = (0,
|
|
28
|
-
const targetGraph = (0,
|
|
27
|
+
const root = (0, _workspacetools.getWorkspaceRoot)(process.cwd());
|
|
28
|
+
const packageInfos = await (0, _workspacetools.getPackageInfosAsync)(root);
|
|
29
|
+
const { tasks } = (0, _filterArgsForTasks.filterArgsForTasks)(command.args);
|
|
30
|
+
const targetGraph = (0, _createTargetGraph.createTargetGraph)({
|
|
29
31
|
logger,
|
|
30
32
|
root,
|
|
31
33
|
dependencies: options.dependencies,
|
|
@@ -43,10 +45,10 @@ async function infoAction(options, command) {
|
|
|
43
45
|
config.cacheOptions.writeRemoteCache = false;
|
|
44
46
|
const { targets } = targetGraph;
|
|
45
47
|
for (const target of targets.values()){
|
|
46
|
-
if (target.id === (0,
|
|
48
|
+
if (target.id === (0, _targetgraph.getStartTargetId)()) {
|
|
47
49
|
continue;
|
|
48
50
|
}
|
|
49
|
-
const startIdIndex = target.dependencies.indexOf((0,
|
|
51
|
+
const startIdIndex = target.dependencies.indexOf((0, _targetgraph.getStartTargetId)());
|
|
50
52
|
target.dependencies.splice(startIdIndex, 1);
|
|
51
53
|
process.stdout.write(`${JSON.stringify(target)}\n`);
|
|
52
54
|
}
|
|
@@ -4,19 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "runAction", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return runAction;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const _createTargetGraph = require("./createTargetGraph.js");
|
|
12
|
+
const _filterArgsForTasks = require("./filterArgsForTasks.js");
|
|
13
|
+
const _filterPipelineDefinitions = require("./filterPipelineDefinitions.js");
|
|
14
|
+
const _findnpmclient = require("@lage-run/find-npm-client");
|
|
13
15
|
const _config = require("@lage-run/config");
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
+
const _workspacetools = require("workspace-tools");
|
|
17
|
+
const _initializeReporters = require("../initializeReporters.js");
|
|
16
18
|
const _scheduler = require("@lage-run/scheduler");
|
|
17
|
-
const _logger = /*#__PURE__*/
|
|
18
|
-
const
|
|
19
|
-
|
|
19
|
+
const _logger = /*#__PURE__*/ _interop_require_default(require("@lage-run/logger"));
|
|
20
|
+
const _errors = require("../../types/errors.js");
|
|
21
|
+
const _createCacheProvider = require("../../cache/createCacheProvider.js");
|
|
22
|
+
function _interop_require_default(obj) {
|
|
20
23
|
return obj && obj.__esModule ? obj : {
|
|
21
24
|
default: obj
|
|
22
25
|
};
|
|
@@ -29,15 +32,15 @@ async function runAction(options, command) {
|
|
|
29
32
|
const allowNoTargetRuns = options.allowNoTargetRuns || config.allowNoTargetRuns;
|
|
30
33
|
// Configure logger
|
|
31
34
|
const logger = (0, _logger.default)();
|
|
32
|
-
const reporters = (0,
|
|
35
|
+
const reporters = (0, _initializeReporters.initializeReporters)(logger, {
|
|
33
36
|
...options,
|
|
34
37
|
concurrency
|
|
35
38
|
});
|
|
36
39
|
// Build Target Graph
|
|
37
|
-
const root = (0,
|
|
38
|
-
const packageInfos = await (0,
|
|
39
|
-
const { tasks , taskArgs } = (0,
|
|
40
|
-
const targetGraph = (0,
|
|
40
|
+
const root = (0, _workspacetools.getWorkspaceRoot)(process.cwd());
|
|
41
|
+
const packageInfos = await (0, _workspacetools.getPackageInfosAsync)(root);
|
|
42
|
+
const { tasks , taskArgs } = (0, _filterArgsForTasks.filterArgsForTasks)(command.args);
|
|
43
|
+
const targetGraph = (0, _createTargetGraph.createTargetGraph)({
|
|
41
44
|
logger,
|
|
42
45
|
root,
|
|
43
46
|
dependencies: options.dependencies,
|
|
@@ -53,8 +56,15 @@ async function runAction(options, command) {
|
|
|
53
56
|
});
|
|
54
57
|
validateTargetGraph(targetGraph, allowNoTargetRuns);
|
|
55
58
|
logger.verbose(`Running with ${concurrency} workers`);
|
|
56
|
-
const filteredPipeline = (0,
|
|
59
|
+
const filteredPipeline = (0, _filterPipelineDefinitions.filterPipelineDefinitions)(targetGraph.targets.values(), config.pipeline);
|
|
57
60
|
const maxWorkersPerTaskMap = (0, _config.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
|
|
61
|
+
const { hasher } = await (0, _createCacheProvider.createCache)({
|
|
62
|
+
root,
|
|
63
|
+
logger,
|
|
64
|
+
cacheOptions: config.cacheOptions,
|
|
65
|
+
cliArgs: taskArgs,
|
|
66
|
+
skipLocalCache: options.skipLocalCache
|
|
67
|
+
});
|
|
58
68
|
const scheduler = new _scheduler.SimpleScheduler({
|
|
59
69
|
logger,
|
|
60
70
|
concurrency,
|
|
@@ -71,7 +81,7 @@ async function runAction(options, command) {
|
|
|
71
81
|
options: {
|
|
72
82
|
nodeArg: options.nodeArg,
|
|
73
83
|
taskArgs,
|
|
74
|
-
npmCmd: (0,
|
|
84
|
+
npmCmd: (0, _findnpmclient.findNpmClient)(config.npmClient)
|
|
75
85
|
}
|
|
76
86
|
},
|
|
77
87
|
worker: {
|
|
@@ -91,6 +101,7 @@ async function runAction(options, command) {
|
|
|
91
101
|
...(0, _config.getMaxWorkersPerTask)(filteredPipeline, concurrency),
|
|
92
102
|
...maxWorkersPerTaskMap
|
|
93
103
|
]),
|
|
104
|
+
hasher,
|
|
94
105
|
workerIdleMemoryLimit: config.workerIdleMemoryLimit
|
|
95
106
|
});
|
|
96
107
|
const summary = await scheduler.run(root, targetGraph);
|
|
@@ -111,6 +122,6 @@ function displaySummaryAndExit(summary, reporters) {
|
|
|
111
122
|
function validateTargetGraph(targetGraph, allowNoTargetRuns) {
|
|
112
123
|
const visibleTargets = Array.from(targetGraph.targets.values()).filter((target)=>!target.hidden);
|
|
113
124
|
if (visibleTargets.length === 0 && !allowNoTargetRuns) {
|
|
114
|
-
throw
|
|
125
|
+
throw _errors.NoTargetFoundError;
|
|
115
126
|
}
|
|
116
127
|
}
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "NoOpRunner", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _scheduler.NoOpRunner;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _scheduler = require("@lage-run/scheduler");
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "NpmScriptRunner", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _scheduler.NpmScriptRunner;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _scheduler = require("@lage-run/scheduler");
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "WorkerRunner", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _scheduler.WorkerRunner;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _scheduler = require("@lage-run/scheduler");
|
|
@@ -4,18 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "watchAction", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return watchAction;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
11
|
+
const _createTargetGraph = require("./createTargetGraph.js");
|
|
12
|
+
const _filterArgsForTasks = require("./filterArgsForTasks.js");
|
|
13
|
+
const _findnpmclient = require("@lage-run/find-npm-client");
|
|
12
14
|
const _config = require("@lage-run/config");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
+
const _workspacetools = require("workspace-tools");
|
|
16
|
+
const _filterPipelineDefinitions = require("./filterPipelineDefinitions.js");
|
|
15
17
|
const _reporters = require("@lage-run/reporters");
|
|
16
18
|
const _scheduler = require("@lage-run/scheduler");
|
|
17
|
-
const
|
|
18
|
-
const _logger = /*#__PURE__*/
|
|
19
|
+
const _watcher = require("./watcher.js");
|
|
20
|
+
const _logger = /*#__PURE__*/ _interop_require_wildcard(require("@lage-run/logger"));
|
|
21
|
+
const _createCacheProvider = require("../../cache/createCacheProvider.js");
|
|
19
22
|
function _getRequireWildcardCache(nodeInterop) {
|
|
20
23
|
if (typeof WeakMap !== "function") return null;
|
|
21
24
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -24,7 +27,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
24
27
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
25
28
|
})(nodeInterop);
|
|
26
29
|
}
|
|
27
|
-
function
|
|
30
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
28
31
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
29
32
|
return obj;
|
|
30
33
|
}
|
|
@@ -66,10 +69,10 @@ async function watchAction(options, command) {
|
|
|
66
69
|
});
|
|
67
70
|
logger.addReporter(reporter);
|
|
68
71
|
// Build Target Graph
|
|
69
|
-
const root = (0,
|
|
70
|
-
const packageInfos = await (0,
|
|
71
|
-
const { tasks , taskArgs } = (0,
|
|
72
|
-
const targetGraph = (0,
|
|
72
|
+
const root = (0, _workspacetools.getWorkspaceRoot)(process.cwd());
|
|
73
|
+
const packageInfos = await (0, _workspacetools.getPackageInfosAsync)(root);
|
|
74
|
+
const { tasks , taskArgs } = (0, _filterArgsForTasks.filterArgsForTasks)(command.args);
|
|
75
|
+
const targetGraph = (0, _createTargetGraph.createTargetGraph)({
|
|
73
76
|
logger,
|
|
74
77
|
root,
|
|
75
78
|
dependencies: options.dependencies,
|
|
@@ -85,8 +88,15 @@ async function watchAction(options, command) {
|
|
|
85
88
|
});
|
|
86
89
|
// Make sure we do not attempt writeRemoteCache in watch mode
|
|
87
90
|
config.cacheOptions.writeRemoteCache = false;
|
|
88
|
-
const filteredPipeline = (0,
|
|
91
|
+
const filteredPipeline = (0, _filterPipelineDefinitions.filterPipelineDefinitions)(targetGraph.targets.values(), config.pipeline);
|
|
89
92
|
const maxWorkersPerTaskMap = (0, _config.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
|
|
93
|
+
const { hasher } = await (0, _createCacheProvider.createCache)({
|
|
94
|
+
root,
|
|
95
|
+
logger,
|
|
96
|
+
cacheOptions: config.cacheOptions,
|
|
97
|
+
cliArgs: taskArgs,
|
|
98
|
+
skipLocalCache: options.skipLocalCache
|
|
99
|
+
});
|
|
90
100
|
const scheduler = new _scheduler.SimpleScheduler({
|
|
91
101
|
logger,
|
|
92
102
|
concurrency,
|
|
@@ -101,7 +111,7 @@ async function watchAction(options, command) {
|
|
|
101
111
|
options: {
|
|
102
112
|
nodeArg: options.nodeArg,
|
|
103
113
|
taskArgs,
|
|
104
|
-
npmCmd: (0,
|
|
114
|
+
npmCmd: (0, _findnpmclient.findNpmClient)(config.npmClient)
|
|
105
115
|
}
|
|
106
116
|
},
|
|
107
117
|
worker: {
|
|
@@ -123,6 +133,7 @@ async function watchAction(options, command) {
|
|
|
123
133
|
...(0, _config.getMaxWorkersPerTask)(filteredPipeline, concurrency),
|
|
124
134
|
...maxWorkersPerTaskMap
|
|
125
135
|
]),
|
|
136
|
+
hasher,
|
|
126
137
|
workerIdleMemoryLimit: config.workerIdleMemoryLimit
|
|
127
138
|
});
|
|
128
139
|
// Initial run
|
|
@@ -135,7 +146,7 @@ async function watchAction(options, command) {
|
|
|
135
146
|
targetRun.options.shouldCache = false;
|
|
136
147
|
}
|
|
137
148
|
// When initial run is done, disable fetching of caches on all targets, keep writing to the cache
|
|
138
|
-
const watcher = await (0,
|
|
149
|
+
const watcher = await (0, _watcher.watch)(root, packageInfos);
|
|
139
150
|
watcher.on("change", async (packageName)=>{
|
|
140
151
|
reporter.resetLogEntries();
|
|
141
152
|
const targets = new Map();
|
|
@@ -4,20 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "watch", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return watch;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _chokidar = /*#__PURE__*/
|
|
10
|
-
const _path = /*#__PURE__*/
|
|
11
|
-
const
|
|
12
|
-
const _events = /*#__PURE__*/
|
|
13
|
-
function
|
|
11
|
+
const _chokidar = /*#__PURE__*/ _interop_require_default(require("chokidar"));
|
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
const _workspacetools = require("workspace-tools");
|
|
14
|
+
const _events = /*#__PURE__*/ _interop_require_default(require("events"));
|
|
15
|
+
function _interop_require_default(obj) {
|
|
14
16
|
return obj && obj.__esModule ? obj : {
|
|
15
17
|
default: obj
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
20
|
function watch(cwd, packageInfos) {
|
|
19
21
|
const events = new _events.default();
|
|
20
|
-
const root = (0,
|
|
22
|
+
const root = (0, _workspacetools.getWorkspaceRoot)(cwd);
|
|
21
23
|
// generate a tree index of all the packages
|
|
22
24
|
const packageIndex = createPackageIndex(root, packageInfos);
|
|
23
25
|
const packagePaths = Object.values(packageInfos).map((pkg)=>_path.default.dirname(pkg.packageJsonPath));
|
|
@@ -9,11 +9,15 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getFilteredPackages: ()
|
|
13
|
-
|
|
12
|
+
getFilteredPackages: function() {
|
|
13
|
+
return getFilteredPackages;
|
|
14
|
+
},
|
|
15
|
+
filterPackages: function() {
|
|
16
|
+
return filterPackages;
|
|
17
|
+
}
|
|
14
18
|
});
|
|
15
|
-
const
|
|
16
|
-
const
|
|
19
|
+
const _workspacetools = require("workspace-tools");
|
|
20
|
+
const _fastglob = /*#__PURE__*/ _interop_require_wildcard(require("fast-glob"));
|
|
17
21
|
function _getRequireWildcardCache(nodeInterop) {
|
|
18
22
|
if (typeof WeakMap !== "function") return null;
|
|
19
23
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -22,7 +26,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
22
26
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
23
27
|
})(nodeInterop);
|
|
24
28
|
}
|
|
25
|
-
function
|
|
29
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
26
30
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
27
31
|
return obj;
|
|
28
32
|
}
|
|
@@ -63,7 +67,7 @@ function getFilteredPackages(options) {
|
|
|
63
67
|
const hasSince = typeof since !== "undefined";
|
|
64
68
|
// If scope is defined, get scoped packages and return
|
|
65
69
|
if (hasScopes) {
|
|
66
|
-
scopedPackages = (0,
|
|
70
|
+
scopedPackages = (0, _workspacetools.getScopedPackages)(scope, packageInfos);
|
|
67
71
|
// return filteredPackages;
|
|
68
72
|
return filterPackages({
|
|
69
73
|
logger,
|
|
@@ -75,7 +79,7 @@ function getFilteredPackages(options) {
|
|
|
75
79
|
});
|
|
76
80
|
} else if (hasSince) {
|
|
77
81
|
try {
|
|
78
|
-
changedPackages = (0,
|
|
82
|
+
changedPackages = (0, _workspacetools.getChangedPackages)(root, since, sinceIgnoreGlobs);
|
|
79
83
|
} catch (e) {
|
|
80
84
|
logger.warn(`An error in the git command has caused this scope run to include every package\n${e}`);
|
|
81
85
|
// if getChangedPackages throws, we will assume all have changed (using changedPackage = undefined)
|
|
@@ -104,8 +108,8 @@ function getFilteredPackages(options) {
|
|
|
104
108
|
}
|
|
105
109
|
function hasRepoChanged(since, root, environmentGlob, logger) {
|
|
106
110
|
try {
|
|
107
|
-
const changedFiles = (0,
|
|
108
|
-
const envFiles =
|
|
111
|
+
const changedFiles = (0, _workspacetools.getBranchChanges)(since, root);
|
|
112
|
+
const envFiles = _fastglob.sync(environmentGlob, {
|
|
109
113
|
cwd: root
|
|
110
114
|
});
|
|
111
115
|
let repoWideChanged = false;
|
|
@@ -132,7 +136,7 @@ function filterPackages(options) {
|
|
|
132
136
|
// If both scoped and since are specified, we have to merge two lists:
|
|
133
137
|
// 1. changed packages that ARE themselves the scoped packages
|
|
134
138
|
// 2. changed package consumers (package dependents) that are within the scoped subgraph
|
|
135
|
-
filtered = changedPackages.filter((pkg)=>scopedPackages.includes(pkg)).concat((0,
|
|
139
|
+
filtered = changedPackages.filter((pkg)=>scopedPackages.includes(pkg)).concat((0, _workspacetools.getTransitiveDependents)(changedPackages, packageInfos, scopedPackages));
|
|
136
140
|
logger.verbose(`filterPackages changed within scope: ${filtered.join(",")}`);
|
|
137
141
|
} else if (typeof changedPackages !== "undefined") {
|
|
138
142
|
filtered = [
|
|
@@ -150,12 +154,12 @@ function filterPackages(options) {
|
|
|
150
154
|
// adds dependents (consumers) of all filtered package thus far
|
|
151
155
|
if (includeDependents) {
|
|
152
156
|
logger.verbose(`filterPackages running with dependents`);
|
|
153
|
-
filtered = filtered.concat((0,
|
|
157
|
+
filtered = filtered.concat((0, _workspacetools.getTransitiveDependents)(filtered, packageInfos));
|
|
154
158
|
}
|
|
155
159
|
// adds dependencies of all filtered package thus far
|
|
156
160
|
if (includeDependencies) {
|
|
157
161
|
logger.verbose(`filterPackages running with dependencies`);
|
|
158
|
-
filtered = filtered.concat((0,
|
|
162
|
+
filtered = filtered.concat((0, _workspacetools.getTransitiveDependencies)(filtered, packageInfos));
|
|
159
163
|
}
|
|
160
164
|
const unique = new Set(filtered);
|
|
161
165
|
return [
|
package/lib/showHelp.js
CHANGED
package/lib/types/errors.js
CHANGED
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "NoTargetFoundError", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return NoTargetFoundError;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const NoTargetFoundError = new Error("No target found");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Command Line Interface for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,14 +20,15 @@
|
|
|
20
20
|
"lint": "monorepo-scripts lint"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@lage-run/cache": "^
|
|
24
|
-
"@lage-run/config": "^0.2.
|
|
23
|
+
"@lage-run/cache": "^1.1.1",
|
|
24
|
+
"@lage-run/config": "^0.2.1",
|
|
25
25
|
"@lage-run/find-npm-client": "^0.1.4",
|
|
26
|
+
"@lage-run/hasher": "^1.0.0",
|
|
26
27
|
"@lage-run/logger": "^1.3.0",
|
|
27
|
-
"@lage-run/reporters": "^1.2.
|
|
28
|
-
"@lage-run/scheduler": "^0.
|
|
29
|
-
"@lage-run/scheduler-types": "^0.3.
|
|
30
|
-
"@lage-run/target-graph": "^0.8.
|
|
28
|
+
"@lage-run/reporters": "^1.2.2",
|
|
29
|
+
"@lage-run/scheduler": "^1.0.0",
|
|
30
|
+
"@lage-run/scheduler-types": "^0.3.9",
|
|
31
|
+
"@lage-run/target-graph": "^0.8.6",
|
|
31
32
|
"chokidar": "3.5.3",
|
|
32
33
|
"commander": "^9.4.0",
|
|
33
34
|
"execa": "5.1.1",
|