@lage-run/cli 0.4.33 → 0.4.35
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 +100 -1
- package/CHANGELOG.md +27 -2
- package/lib/cli.js +12 -9
- package/lib/commands/addLoggerOptions.js +15 -9
- package/lib/commands/cache/action.js +23 -19
- package/lib/commands/cache/cacheDir.js +26 -15
- package/lib/commands/cache/clearCache.js +32 -24
- package/lib/commands/cache/index.js +12 -12
- package/lib/commands/cache/pruneCache.js +31 -23
- package/lib/commands/isRunningFromCI.js +8 -4
- package/lib/commands/run/action.js +12 -10
- package/lib/commands/run/createCacheProvider.js +35 -23
- package/lib/commands/run/createProfileReporter.js +11 -8
- package/lib/commands/run/createTargetGraph.d.ts +0 -1
- package/lib/commands/run/createTargetGraph.js +17 -15
- package/lib/commands/run/filterArgsForTasks.js +9 -6
- package/lib/commands/run/filterPipelineDefinitions.js +9 -6
- package/lib/commands/run/index.js +25 -41
- package/lib/commands/run/runAction.js +49 -41
- package/lib/commands/run/runners/NpmScriptRunner.js +8 -5
- package/lib/commands/run/runners/WorkerRunner.js +8 -5
- package/lib/commands/run/watchAction.js +86 -64
- package/lib/commands/run/watcher.js +33 -23
- package/lib/config/getConfig.js +19 -14
- package/lib/config/getMaxWorkersPerTask.js +24 -14
- package/lib/filter/getFilteredPackages.js +87 -63
- package/lib/index.js +3 -2
- package/lib/showHelp.js +8 -6
- package/lib/types/CacheOptions.js +3 -2
- package/lib/types/ConfigOptions.js +3 -2
- package/lib/types/LoggerOptions.js +3 -2
- package/lib/types/PipelineDefinition.js +3 -2
- package/lib/types/Priority.js +3 -2
- package/package.json +7 -7
- package/lib/cli.js.map +0 -1
- package/lib/commands/addLoggerOptions.js.map +0 -1
- package/lib/commands/cache/action.js.map +0 -1
- package/lib/commands/cache/cacheDir.js.map +0 -1
- package/lib/commands/cache/clearCache.js.map +0 -1
- package/lib/commands/cache/index.js.map +0 -1
- package/lib/commands/cache/pruneCache.js.map +0 -1
- package/lib/commands/isRunningFromCI.js.map +0 -1
- package/lib/commands/run/action.js.map +0 -1
- package/lib/commands/run/createCacheProvider.js.map +0 -1
- package/lib/commands/run/createProfileReporter.js.map +0 -1
- package/lib/commands/run/createTargetGraph.js.map +0 -1
- package/lib/commands/run/filterArgsForTasks.js.map +0 -1
- package/lib/commands/run/filterPipelineDefinitions.js.map +0 -1
- package/lib/commands/run/index.js.map +0 -1
- package/lib/commands/run/runAction.js.map +0 -1
- package/lib/commands/run/runners/NpmScriptRunner.js.map +0 -1
- package/lib/commands/run/runners/WorkerRunner.js.map +0 -1
- package/lib/commands/run/watchAction.js.map +0 -1
- package/lib/commands/run/watcher.js.map +0 -1
- package/lib/config/getConfig.js.map +0 -1
- package/lib/config/getMaxWorkersPerTask.js.map +0 -1
- package/lib/filter/getFilteredPackages.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/showHelp.js.map +0 -1
- package/lib/types/CacheOptions.js.map +0 -1
- package/lib/types/ConfigOptions.js.map +0 -1
- package/lib/types/LoggerOptions.js.map +0 -1
- package/lib/types/PipelineDefinition.js.map +0 -1
- package/lib/types/Priority.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,106 @@
|
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Fri,
|
|
5
|
+
"date": "Fri, 11 Nov 2022 07:29:32 GMT",
|
|
6
|
+
"tag": "@lage-run/cli_v0.4.35",
|
|
7
|
+
"version": "0.4.35",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@lage-run/cli",
|
|
13
|
+
"comment": "Bump @lage-run/scheduler to v0.5.12",
|
|
14
|
+
"commit": "459d25088a3a391f8b7f02db4f21eb425795ca12"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/cli",
|
|
19
|
+
"comment": "Bump @lage-run/scheduler-types to v0.2.8",
|
|
20
|
+
"commit": "459d25088a3a391f8b7f02db4f21eb425795ca12"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@lage-run/cli",
|
|
25
|
+
"comment": "Bump @lage-run/target-graph to v0.6.1",
|
|
26
|
+
"commit": "459d25088a3a391f8b7f02db4f21eb425795ca12"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@lage-run/cli",
|
|
31
|
+
"comment": "Bump @lage-run/cache to v0.2.2",
|
|
32
|
+
"commit": "459d25088a3a391f8b7f02db4f21eb425795ca12"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@lage-run/cli",
|
|
37
|
+
"comment": "Bump @lage-run/reporters to v0.2.39",
|
|
38
|
+
"commit": "459d25088a3a391f8b7f02db4f21eb425795ca12"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"date": "Thu, 10 Nov 2022 22:52:47 GMT",
|
|
45
|
+
"tag": "@lage-run/cli_v0.4.34",
|
|
46
|
+
"version": "0.4.34",
|
|
47
|
+
"comments": {
|
|
48
|
+
"none": [
|
|
49
|
+
{
|
|
50
|
+
"author": "email not defined",
|
|
51
|
+
"package": "@lage-run/cli",
|
|
52
|
+
"commit": "64afbef3c57c999e631604cfa2761e0fb85b85b4",
|
|
53
|
+
"comment": "Pin devDependencies"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"date": "Thu, 10 Nov 2022 20:20:45 GMT",
|
|
60
|
+
"tag": "@lage-run/cli_v0.4.34",
|
|
61
|
+
"version": "0.4.34",
|
|
62
|
+
"comments": {
|
|
63
|
+
"patch": [
|
|
64
|
+
{
|
|
65
|
+
"author": "kchau@microsoft.com",
|
|
66
|
+
"package": "@lage-run/cli",
|
|
67
|
+
"commit": "b1a42cb963a5fc680e4c59b1e705acbc964f0804",
|
|
68
|
+
"comment": "update api from targetgraphbuilder"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"author": "beachball",
|
|
72
|
+
"package": "@lage-run/cli",
|
|
73
|
+
"comment": "Bump @lage-run/scheduler to v0.5.11",
|
|
74
|
+
"commit": "b1a42cb963a5fc680e4c59b1e705acbc964f0804"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"author": "beachball",
|
|
78
|
+
"package": "@lage-run/cli",
|
|
79
|
+
"comment": "Bump @lage-run/scheduler-types to v0.2.7",
|
|
80
|
+
"commit": "b1a42cb963a5fc680e4c59b1e705acbc964f0804"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"author": "beachball",
|
|
84
|
+
"package": "@lage-run/cli",
|
|
85
|
+
"comment": "Bump @lage-run/target-graph to v0.6.0",
|
|
86
|
+
"commit": "b1a42cb963a5fc680e4c59b1e705acbc964f0804"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"author": "beachball",
|
|
90
|
+
"package": "@lage-run/cli",
|
|
91
|
+
"comment": "Bump @lage-run/cache to v0.2.1",
|
|
92
|
+
"commit": "b1a42cb963a5fc680e4c59b1e705acbc964f0804"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"author": "beachball",
|
|
96
|
+
"package": "@lage-run/cli",
|
|
97
|
+
"comment": "Bump @lage-run/reporters to v0.2.38",
|
|
98
|
+
"commit": "b1a42cb963a5fc680e4c59b1e705acbc964f0804"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"date": "Fri, 04 Nov 2022 21:14:01 GMT",
|
|
6
105
|
"tag": "@lage-run/cli_v0.4.33",
|
|
7
106
|
"version": "0.4.33",
|
|
8
107
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
# Change Log - @lage-run/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
3
|
+
This log was last generated on Fri, 11 Nov 2022 07:29:32 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.4.35
|
|
8
|
+
|
|
9
|
+
Fri, 11 Nov 2022 07:29:32 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @lage-run/scheduler to v0.5.12
|
|
14
|
+
- Bump @lage-run/scheduler-types to v0.2.8
|
|
15
|
+
- Bump @lage-run/target-graph to v0.6.1
|
|
16
|
+
- Bump @lage-run/cache to v0.2.2
|
|
17
|
+
- Bump @lage-run/reporters to v0.2.39
|
|
18
|
+
|
|
19
|
+
## 0.4.34
|
|
20
|
+
|
|
21
|
+
Thu, 10 Nov 2022 20:20:45 GMT
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- update api from targetgraphbuilder (kchau@microsoft.com)
|
|
26
|
+
- Bump @lage-run/scheduler to v0.5.11
|
|
27
|
+
- Bump @lage-run/scheduler-types to v0.2.7
|
|
28
|
+
- Bump @lage-run/target-graph to v0.6.0
|
|
29
|
+
- Bump @lage-run/cache to v0.2.1
|
|
30
|
+
- Bump @lage-run/reporters to v0.2.38
|
|
31
|
+
|
|
7
32
|
## 0.4.33
|
|
8
33
|
|
|
9
|
-
Fri, 04 Nov 2022 21:
|
|
34
|
+
Fri, 04 Nov 2022 21:14:01 GMT
|
|
10
35
|
|
|
11
36
|
### Patches
|
|
12
37
|
|
package/lib/cli.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _commander = require("commander");
|
|
6
|
+
const _run = require("./commands/run");
|
|
7
|
+
const _cache = require("./commands/cache");
|
|
6
8
|
async function main() {
|
|
7
|
-
const program = new
|
|
8
|
-
program.addCommand(
|
|
9
|
-
|
|
9
|
+
const program = new _commander.Command();
|
|
10
|
+
program.addCommand(_run.runCommand, {
|
|
11
|
+
isDefault: true
|
|
12
|
+
});
|
|
13
|
+
program.addCommand(_cache.cacheCommand);
|
|
10
14
|
await program.parseAsync(process.argv);
|
|
11
15
|
}
|
|
12
|
-
main().catch((err)
|
|
16
|
+
main().catch((err)=>{
|
|
13
17
|
// eslint-disable-next-line no-console
|
|
14
18
|
console.error(err);
|
|
15
19
|
process.exitCode = 1;
|
|
16
20
|
});
|
|
17
|
-
//# sourceMappingURL=cli.js.map
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "addLoggerOptions", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>addLoggerOptions
|
|
8
|
+
});
|
|
9
|
+
const _commander = require("commander");
|
|
5
10
|
function addLoggerOptions(program) {
|
|
6
|
-
return program
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
return program.option("--reporter <reporter...>", "reporter", "npmLog").addOption(new _commander.Option("--log-level <level>", "log level").choices([
|
|
12
|
+
"info",
|
|
13
|
+
"warn",
|
|
14
|
+
"error",
|
|
15
|
+
"verbose",
|
|
16
|
+
"silly"
|
|
17
|
+
]).conflicts("--verbose")).option("--verbose", "verbose output");
|
|
10
18
|
}
|
|
11
|
-
exports.addLoggerOptions = addLoggerOptions;
|
|
12
|
-
//# sourceMappingURL=addLoggerOptions.js.map
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "cacheAction", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>cacheAction
|
|
8
|
+
});
|
|
9
|
+
const _clearCacheJs = require("./clearCache.js");
|
|
10
|
+
const _getConfigJs = require("../../config/getConfig.js");
|
|
11
|
+
const _pruneCacheJs = require("./pruneCache.js");
|
|
12
|
+
const _logger = /*#__PURE__*/ _interopRequireDefault(require("@lage-run/logger"));
|
|
13
|
+
const _reporters = require("@lage-run/reporters");
|
|
14
|
+
function _interopRequireDefault(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
12
19
|
async function cacheAction(options, command) {
|
|
13
20
|
const cwd = process.cwd();
|
|
14
|
-
const config = await (0,
|
|
15
|
-
const logger = (0,
|
|
16
|
-
(0,
|
|
21
|
+
const config = await (0, _getConfigJs.getConfig)(cwd);
|
|
22
|
+
const logger = (0, _logger.default)();
|
|
23
|
+
(0, _reporters.initializeReporters)(logger, options);
|
|
17
24
|
if (options.clear) {
|
|
18
|
-
return await (0,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return await (0, pruneCache_js_1.pruneCache)(options.prune, process.cwd(), config.cacheOptions.internalCacheFolder, logger);
|
|
25
|
+
return await (0, _clearCacheJs.clearCache)(process.cwd(), config.cacheOptions.internalCacheFolder, logger);
|
|
26
|
+
} else if (options.prune) {
|
|
27
|
+
return await (0, _pruneCacheJs.pruneCache)(options.prune, process.cwd(), config.cacheOptions.internalCacheFolder, logger);
|
|
22
28
|
}
|
|
23
29
|
command.help();
|
|
24
30
|
}
|
|
25
|
-
exports.cacheAction = cacheAction;
|
|
26
|
-
//# sourceMappingURL=action.js.map
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
getCacheDir: ()=>getCacheDir,
|
|
13
|
+
removeCacheEntry: ()=>removeCacheEntry
|
|
14
|
+
});
|
|
15
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
16
|
+
const _promises = require("fs/promises");
|
|
17
|
+
function _interopRequireDefault(obj) {
|
|
18
|
+
return obj && obj.__esModule ? obj : {
|
|
19
|
+
default: obj
|
|
20
|
+
};
|
|
21
|
+
}
|
|
9
22
|
function getCacheDir(workspace, internalCacheFolder) {
|
|
10
23
|
const cacheFolder = !internalCacheFolder ? undefined : internalCacheFolder;
|
|
11
|
-
return
|
|
24
|
+
return _path.default.join(workspace, cacheFolder ?? "node_modules/.cache/backfill");
|
|
12
25
|
}
|
|
13
|
-
exports.getCacheDir = getCacheDir;
|
|
14
26
|
async function removeCacheEntry(entryPath, entryStat) {
|
|
15
27
|
if (entryStat.isDirectory()) {
|
|
16
|
-
(0,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
(0, _promises.rm)(entryPath, {
|
|
29
|
+
recursive: true
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
(0, _promises.unlink)(entryPath);
|
|
20
33
|
}
|
|
21
34
|
}
|
|
22
|
-
exports.removeCacheEntry = removeCacheEntry;
|
|
23
|
-
//# sourceMappingURL=cacheDir.js.map
|
|
@@ -1,36 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "clearCache", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>clearCache
|
|
8
|
+
});
|
|
9
|
+
const _cacheDirJs = require("./cacheDir.js");
|
|
10
|
+
const _workspaceTools = require("workspace-tools");
|
|
11
|
+
const _promises = require("fs/promises");
|
|
12
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
13
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
14
|
+
function _interopRequireDefault(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
12
19
|
async function clearCache(cwd, internalCacheFolder, logger) {
|
|
13
|
-
const workspaceRoot = (0,
|
|
20
|
+
const workspaceRoot = (0, _workspaceTools.getWorkspaceRoot)(cwd);
|
|
14
21
|
if (!workspaceRoot) {
|
|
15
22
|
return;
|
|
16
23
|
}
|
|
17
|
-
const workspaces = (0,
|
|
18
|
-
for (const workspace of workspaces)
|
|
24
|
+
const workspaces = (0, _workspaceTools.getWorkspaces)(workspaceRoot);
|
|
25
|
+
for (const workspace of workspaces){
|
|
19
26
|
logger.info(`clear cache for ${workspace.name}`);
|
|
20
|
-
const cachePath = (0,
|
|
21
|
-
const logOutputCachePath =
|
|
22
|
-
await Promise.all([
|
|
27
|
+
const cachePath = (0, _cacheDirJs.getCacheDir)(workspace.path, internalCacheFolder);
|
|
28
|
+
const logOutputCachePath = _path.default.join(workspace.path, "node_modules/.cache/lage/output/");
|
|
29
|
+
await Promise.all([
|
|
30
|
+
clearPath(cachePath),
|
|
31
|
+
clearPath(logOutputCachePath)
|
|
32
|
+
]);
|
|
23
33
|
}
|
|
24
34
|
}
|
|
25
|
-
exports.clearCache = clearCache;
|
|
26
35
|
async function clearPath(cachePath) {
|
|
27
|
-
if (
|
|
28
|
-
const entries =
|
|
29
|
-
for (const entry of entries)
|
|
30
|
-
const entryPath =
|
|
31
|
-
const entryStat = await (0,
|
|
32
|
-
await (0,
|
|
36
|
+
if (_fs.default.existsSync(cachePath)) {
|
|
37
|
+
const entries = _fs.default.readdirSync(cachePath);
|
|
38
|
+
for (const entry of entries){
|
|
39
|
+
const entryPath = _path.default.join(cachePath, entry);
|
|
40
|
+
const entryStat = await (0, _promises.stat)(entryPath);
|
|
41
|
+
await (0, _cacheDirJs.removeCacheEntry)(entryPath, entryStat);
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
|
-
//# sourceMappingURL=clearCache.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "cacheCommand", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>cacheCommand
|
|
8
|
+
});
|
|
9
|
+
const _commander = require("commander");
|
|
10
|
+
const _addLoggerOptionsJs = require("../addLoggerOptions.js");
|
|
11
|
+
const _actionJs = require("./action.js");
|
|
12
|
+
const cacheCommand = new _commander.Command("cache");
|
|
13
|
+
(0, _addLoggerOptionsJs.addLoggerOptions)(cacheCommand).action(_actionJs.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");
|
|
@@ -1,37 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "pruneCache", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>pruneCache
|
|
8
|
+
});
|
|
9
|
+
const _promises = require("fs/promises");
|
|
10
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
11
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
12
|
+
const _cacheDirJs = require("./cacheDir.js");
|
|
13
|
+
const _workspaceTools = require("workspace-tools");
|
|
14
|
+
function _interopRequireDefault(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
12
19
|
const MS_IN_A_DAY = 1000 * 60 * 60 * 24;
|
|
13
20
|
async function pruneCache(pruneDays, cwd, internalCacheFolder, logger) {
|
|
14
21
|
const prunePeriod = pruneDays || 30;
|
|
15
22
|
const now = new Date().getTime();
|
|
16
|
-
const workspaces = (0,
|
|
17
|
-
for (const workspace of workspaces)
|
|
23
|
+
const workspaces = (0, _workspaceTools.getWorkspaces)(cwd);
|
|
24
|
+
for (const workspace of workspaces){
|
|
18
25
|
logger.info(`prune cache for ${workspace.name} older than ${prunePeriod} days`);
|
|
19
|
-
const cachePath = (0,
|
|
20
|
-
const logOutputCachePath =
|
|
21
|
-
await Promise.all([
|
|
26
|
+
const cachePath = (0, _cacheDirJs.getCacheDir)(workspace.path, internalCacheFolder);
|
|
27
|
+
const logOutputCachePath = _path.default.join(workspace.path, "node_modules/.cache/lage/output/");
|
|
28
|
+
await Promise.all([
|
|
29
|
+
prunePath(cachePath, prunePeriod, now),
|
|
30
|
+
prunePath(logOutputCachePath, prunePeriod, now)
|
|
31
|
+
]);
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
|
-
exports.pruneCache = pruneCache;
|
|
25
34
|
async function prunePath(cachePath, days, now) {
|
|
26
|
-
if (
|
|
27
|
-
const entries =
|
|
28
|
-
for (const entry of entries)
|
|
29
|
-
const entryPath =
|
|
30
|
-
const entryStat = await (0,
|
|
35
|
+
if (_fs.default.existsSync(cachePath)) {
|
|
36
|
+
const entries = _fs.default.readdirSync(cachePath);
|
|
37
|
+
for (const entry of entries){
|
|
38
|
+
const entryPath = _path.default.join(cachePath, entry);
|
|
39
|
+
const entryStat = await (0, _promises.stat)(entryPath);
|
|
31
40
|
if (now - entryStat.mtime.getTime() > days * MS_IN_A_DAY) {
|
|
32
|
-
await (0,
|
|
41
|
+
await (0, _cacheDirJs.removeCacheEntry)(entryPath, entryStat);
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
45
|
}
|
|
37
|
-
//# sourceMappingURL=pruneCache.js.map
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "isRunningFromCI", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>isRunningFromCI
|
|
8
|
+
});
|
|
9
|
+
const isRunningFromCI = process.env.NODE_ENV !== "test" && (!!process.env.CI || !!process.env.TF_BUILD);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "action", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>action
|
|
8
|
+
});
|
|
9
|
+
const _runActionJs = require("./runAction.js");
|
|
10
|
+
const _watchActionJs = require("./watchAction.js");
|
|
6
11
|
async function action(options, command) {
|
|
7
12
|
if (options.unstableWatch) {
|
|
8
|
-
return (0,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return (0, runAction_js_1.runAction)(options, command);
|
|
13
|
+
return (0, _watchActionJs.watchAction)(options, command);
|
|
14
|
+
} else {
|
|
15
|
+
return (0, _runActionJs.runAction)(options, command);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
|
-
exports.action = action;
|
|
15
|
-
//# sourceMappingURL=action.js.map
|
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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");
|
|
6
11
|
function createCache(options) {
|
|
7
|
-
const { cacheOptions, logger, root, skipLocalCache
|
|
12
|
+
const { cacheOptions , logger , root , skipLocalCache } = options;
|
|
8
13
|
const hasRemoteCacheConfig = !!cacheOptions?.cacheStorageConfig || !!process.env.BACKFILL_CACHE_PROVIDER || !!process.env.BACKFILL_CACHE_PROVIDER_OPTIONS;
|
|
9
14
|
// Create Cache Provider
|
|
10
|
-
const cacheProvider = new
|
|
15
|
+
const cacheProvider = new _cache.RemoteFallbackCacheProvider({
|
|
11
16
|
root,
|
|
12
17
|
logger,
|
|
13
|
-
localCacheProvider: skipLocalCache === true
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
cacheOptions
|
|
19
|
-
|
|
20
|
-
...(cacheOptions?.internalCacheFolder && { internalCacheFolder: cacheOptions.internalCacheFolder }),
|
|
21
|
-
...(cacheOptions?.incrementalCaching && { incrementalCaching: cacheOptions.incrementalCaching }),
|
|
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
|
|
22
25
|
},
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
26
37
|
});
|
|
27
|
-
const hasher = new
|
|
38
|
+
const hasher = new _cache.TargetHasher({
|
|
28
39
|
root,
|
|
29
40
|
environmentGlob: cacheOptions?.environmentGlob ?? [],
|
|
30
|
-
cacheKey: cacheOptions?.cacheKey
|
|
41
|
+
cacheKey: cacheOptions?.cacheKey
|
|
31
42
|
});
|
|
32
|
-
return {
|
|
43
|
+
return {
|
|
44
|
+
cacheProvider,
|
|
45
|
+
hasher
|
|
46
|
+
};
|
|
33
47
|
}
|
|
34
|
-
exports.createCache = createCache;
|
|
35
|
-
//# sourceMappingURL=createCacheProvider.js.map
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createProfileReporter", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>createProfileReporter
|
|
8
|
+
});
|
|
9
|
+
const _reporters = require("@lage-run/reporters");
|
|
5
10
|
function createProfileReporter(options) {
|
|
6
|
-
const { concurrency, profile
|
|
7
|
-
return new
|
|
11
|
+
const { concurrency , profile } = options;
|
|
12
|
+
return new _reporters.ChromeTraceEventsReporter({
|
|
8
13
|
concurrency: concurrency,
|
|
9
|
-
outputFile: typeof profile === "string" ? profile : undefined
|
|
14
|
+
outputFile: typeof profile === "string" ? profile : undefined
|
|
10
15
|
});
|
|
11
16
|
}
|
|
12
|
-
exports.createProfileReporter = createProfileReporter;
|
|
13
|
-
//# sourceMappingURL=createProfileReporter.js.map
|