@lage-run/cli 0.8.6 → 0.9.1
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 +67 -1
- package/CHANGELOG.md +24 -2
- package/lib/commands/cache/action.js +0 -2
- package/lib/commands/cache/clearCache.js +11 -53
- package/lib/commands/cache/pruneCache.js +11 -56
- package/lib/commands/createReporter.d.ts +1 -1
- package/lib/commands/createReporter.js +7 -1
- package/package.json +6 -6
- package/lib/commands/cache/cacheDir.d.ts +0 -1
- package/lib/commands/cache/cacheDir.js +0 -18
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,73 @@
|
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 08 Mar 2023 00:05:07 GMT",
|
|
6
|
+
"tag": "@lage-run/cli_v0.9.1",
|
|
7
|
+
"version": "0.9.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@lage-run/cli",
|
|
13
|
+
"comment": "Bump @lage-run/scheduler to v0.9.1",
|
|
14
|
+
"commit": "e2eb2c00d1b23e2c65943e9c64134c14e04f985f"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/cli",
|
|
19
|
+
"comment": "Bump @lage-run/scheduler-types to v0.3.2",
|
|
20
|
+
"commit": "e2eb2c00d1b23e2c65943e9c64134c14e04f985f"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@lage-run/cli",
|
|
25
|
+
"comment": "Bump @lage-run/target-graph to v0.7.0",
|
|
26
|
+
"commit": "e2eb2c00d1b23e2c65943e9c64134c14e04f985f"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@lage-run/cli",
|
|
31
|
+
"comment": "Bump @lage-run/cache to v0.4.0",
|
|
32
|
+
"commit": "e2eb2c00d1b23e2c65943e9c64134c14e04f985f"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@lage-run/cli",
|
|
37
|
+
"comment": "Bump @lage-run/reporters to v1.0.4",
|
|
38
|
+
"commit": "e2eb2c00d1b23e2c65943e9c64134c14e04f985f"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"date": "Tue, 21 Feb 2023 21:30:37 GMT",
|
|
45
|
+
"tag": "@lage-run/cli_v0.9.0",
|
|
46
|
+
"version": "0.9.0",
|
|
47
|
+
"comments": {
|
|
48
|
+
"minor": [
|
|
49
|
+
{
|
|
50
|
+
"author": "kchau@microsoft.com",
|
|
51
|
+
"package": "@lage-run/cli",
|
|
52
|
+
"commit": "d7a8a3fa2bcf434c59bea26d5964dd7235998ad2",
|
|
53
|
+
"comment": "cache directory to be centralized"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@lage-run/cli",
|
|
58
|
+
"comment": "Bump @lage-run/scheduler to v0.9.0",
|
|
59
|
+
"commit": "d7a8a3fa2bcf434c59bea26d5964dd7235998ad2"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"author": "beachball",
|
|
63
|
+
"package": "@lage-run/cli",
|
|
64
|
+
"comment": "Bump @lage-run/cache to v0.3.0",
|
|
65
|
+
"commit": "d7a8a3fa2bcf434c59bea26d5964dd7235998ad2"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"date": "Sat, 18 Feb 2023 00:43:33 GMT",
|
|
6
72
|
"tag": "@lage-run/cli_v0.8.6",
|
|
7
73
|
"version": "0.8.6",
|
|
8
74
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
# Change Log - @lage-run/cli
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 08 Mar 2023 00:05:07 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.9.1
|
|
8
|
+
|
|
9
|
+
Wed, 08 Mar 2023 00:05:07 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @lage-run/scheduler to v0.9.1
|
|
14
|
+
- Bump @lage-run/scheduler-types to v0.3.2
|
|
15
|
+
- Bump @lage-run/target-graph to v0.7.0
|
|
16
|
+
- Bump @lage-run/cache to v0.4.0
|
|
17
|
+
- Bump @lage-run/reporters to v1.0.4
|
|
18
|
+
|
|
19
|
+
## 0.9.0
|
|
20
|
+
|
|
21
|
+
Tue, 21 Feb 2023 21:30:37 GMT
|
|
22
|
+
|
|
23
|
+
### Minor changes
|
|
24
|
+
|
|
25
|
+
- cache directory to be centralized (kchau@microsoft.com)
|
|
26
|
+
- Bump @lage-run/scheduler to v0.9.0
|
|
27
|
+
- Bump @lage-run/cache to v0.3.0
|
|
28
|
+
|
|
7
29
|
## 0.8.6
|
|
8
30
|
|
|
9
|
-
Sat, 18 Feb 2023 00:43:
|
|
31
|
+
Sat, 18 Feb 2023 00:43:33 GMT
|
|
10
32
|
|
|
11
33
|
### Patches
|
|
12
34
|
|
|
@@ -10,7 +10,6 @@ const _clearCacheJs = require("./clearCache.js");
|
|
|
10
10
|
const _getConfigJs = require("../../config/getConfig.js");
|
|
11
11
|
const _pruneCacheJs = require("./pruneCache.js");
|
|
12
12
|
const _logger = /*#__PURE__*/ _interopRequireDefault(require("@lage-run/logger"));
|
|
13
|
-
const _initializeReportersJs = require("../initializeReporters.js");
|
|
14
13
|
function _interopRequireDefault(obj) {
|
|
15
14
|
return obj && obj.__esModule ? obj : {
|
|
16
15
|
default: obj
|
|
@@ -20,7 +19,6 @@ async function cacheAction(options, command) {
|
|
|
20
19
|
const cwd = process.cwd();
|
|
21
20
|
const config = await (0, _getConfigJs.getConfig)(cwd);
|
|
22
21
|
const logger = (0, _logger.default)();
|
|
23
|
-
(0, _initializeReportersJs.initializeReporters)(logger, options);
|
|
24
22
|
if (options.clear) {
|
|
25
23
|
return await (0, _clearCacheJs.clearCache)({
|
|
26
24
|
cwd: process.cwd(),
|
|
@@ -6,68 +6,26 @@ Object.defineProperty(exports, "clearCache", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>clearCache
|
|
8
8
|
});
|
|
9
|
-
const _cacheDirJs = require("./cacheDir.js");
|
|
10
9
|
const _getConfigJs = require("../../config/getConfig.js");
|
|
11
10
|
const _workspaceTools = require("workspace-tools");
|
|
12
|
-
const _scheduler = require("@lage-run/scheduler");
|
|
13
|
-
const _targetGraph = require("@lage-run/target-graph");
|
|
14
|
-
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
15
11
|
const _getConcurrencyJs = require("../../config/getConcurrency.js");
|
|
16
|
-
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
12
|
+
const _cache = require("@lage-run/cache");
|
|
21
13
|
async function clearCache(options) {
|
|
22
|
-
const { logger , cwd
|
|
14
|
+
const { logger , cwd } = options;
|
|
23
15
|
const config = await (0, _getConfigJs.getConfig)(cwd);
|
|
24
16
|
const workspaceRoot = (0, _workspaceTools.getWorkspaceRoot)(cwd);
|
|
25
17
|
const concurrency = (0, _getConcurrencyJs.getConcurrency)(options.concurrency, config.concurrency);
|
|
26
18
|
if (!workspaceRoot) {
|
|
27
19
|
return;
|
|
28
20
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const logOutputCachePath = _path.default.join(workspace.path, "node_modules/.cache/lage/output/");
|
|
34
|
-
graphBuilder.addTarget({
|
|
35
|
-
packageName: workspace.name,
|
|
36
|
-
cwd: workspace.path,
|
|
37
|
-
dependencies: [],
|
|
38
|
-
dependents: [],
|
|
39
|
-
id: `${workspace.name}#clearCache`,
|
|
40
|
-
label: `Clearing Cache for ${workspace.name}`,
|
|
41
|
-
task: "clearCache",
|
|
42
|
-
type: "worker",
|
|
43
|
-
depSpecs: [],
|
|
44
|
-
options: {
|
|
45
|
-
clearPaths: [
|
|
46
|
-
cachePath,
|
|
47
|
-
logOutputCachePath
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const graph = graphBuilder.build();
|
|
53
|
-
const scheduler = new _scheduler.SimpleScheduler({
|
|
54
|
-
logger,
|
|
55
|
-
concurrency,
|
|
56
|
-
continueOnError: true,
|
|
57
|
-
shouldCache: false,
|
|
58
|
-
shouldResetCache: false,
|
|
59
|
-
maxWorkersPerTask: new Map(),
|
|
60
|
-
runners: {
|
|
61
|
-
worker: {
|
|
62
|
-
script: require.resolve("./runners/ClearCacheRunner.js"),
|
|
63
|
-
options: {}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
workerIdleMemoryLimit: config.workerIdleMemoryLimit
|
|
67
|
-
});
|
|
68
|
-
const summary = await scheduler.run(workspaceRoot, graph);
|
|
69
|
-
await scheduler.cleanup();
|
|
70
|
-
logger.reporters.forEach((reporter)=>{
|
|
71
|
-
reporter.summarize(summary);
|
|
21
|
+
const cacheProvider = new _cache.BackfillCacheProvider({
|
|
22
|
+
root: cwd,
|
|
23
|
+
cacheOptions: config.cacheOptions,
|
|
24
|
+
logger
|
|
72
25
|
});
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.log("Clearing Cache");
|
|
28
|
+
cacheProvider.clear(concurrency);
|
|
29
|
+
// eslint-disable-next-line no-console
|
|
30
|
+
console.log("Cache Cleared");
|
|
73
31
|
}
|
|
@@ -6,72 +6,27 @@ Object.defineProperty(exports, "pruneCache", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>pruneCache
|
|
8
8
|
});
|
|
9
|
-
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
10
|
-
const _cacheDirJs = require("./cacheDir.js");
|
|
11
9
|
const _workspaceTools = require("workspace-tools");
|
|
12
10
|
const _getConfigJs = require("../../config/getConfig.js");
|
|
13
11
|
const _getConcurrencyJs = require("../../config/getConcurrency.js");
|
|
14
|
-
const
|
|
15
|
-
const _scheduler = require("@lage-run/scheduler");
|
|
16
|
-
function _interopRequireDefault(obj) {
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
12
|
+
const _cache = require("@lage-run/cache");
|
|
21
13
|
async function pruneCache(options) {
|
|
22
|
-
const { logger , cwd , pruneDays
|
|
14
|
+
const { logger , cwd , pruneDays } = options;
|
|
23
15
|
const config = await (0, _getConfigJs.getConfig)(cwd);
|
|
24
16
|
const workspaceRoot = (0, _workspaceTools.getWorkspaceRoot)(cwd);
|
|
25
17
|
const concurrency = (0, _getConcurrencyJs.getConcurrency)(options.concurrency, config.concurrency);
|
|
26
18
|
if (!workspaceRoot) {
|
|
27
19
|
return;
|
|
28
20
|
}
|
|
29
|
-
const graphBuilder = new _targetGraph.TargetGraphBuilder();
|
|
30
|
-
const workspaces = (0, _workspaceTools.getWorkspaces)(workspaceRoot);
|
|
31
21
|
const prunePeriod = pruneDays || 30;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
graphBuilder.addTarget({
|
|
37
|
-
packageName: workspace.name,
|
|
38
|
-
cwd: workspace.path,
|
|
39
|
-
dependencies: [],
|
|
40
|
-
dependents: [],
|
|
41
|
-
id: `${workspace.name}#pruneCache`,
|
|
42
|
-
label: `Pruning Cache for ${workspace.name}`,
|
|
43
|
-
task: "pruneCache",
|
|
44
|
-
type: "worker",
|
|
45
|
-
depSpecs: [],
|
|
46
|
-
options: {
|
|
47
|
-
clearPaths: [
|
|
48
|
-
cachePath,
|
|
49
|
-
logOutputCachePath
|
|
50
|
-
],
|
|
51
|
-
now,
|
|
52
|
-
prunePeriod
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
const graph = graphBuilder.build();
|
|
57
|
-
const scheduler = new _scheduler.SimpleScheduler({
|
|
58
|
-
logger,
|
|
59
|
-
concurrency,
|
|
60
|
-
continueOnError: true,
|
|
61
|
-
shouldCache: false,
|
|
62
|
-
shouldResetCache: false,
|
|
63
|
-
maxWorkersPerTask: new Map(),
|
|
64
|
-
runners: {
|
|
65
|
-
worker: {
|
|
66
|
-
script: require.resolve("./runners/PruneCacheRunner.js"),
|
|
67
|
-
options: {}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
workerIdleMemoryLimit: config.workerIdleMemoryLimit
|
|
71
|
-
});
|
|
72
|
-
const summary = await scheduler.run(workspaceRoot, graph);
|
|
73
|
-
await scheduler.cleanup();
|
|
74
|
-
logger.reporters.forEach((reporter)=>{
|
|
75
|
-
reporter.summarize(summary);
|
|
22
|
+
const cacheProvider = new _cache.BackfillCacheProvider({
|
|
23
|
+
root: cwd,
|
|
24
|
+
cacheOptions: config.cacheOptions,
|
|
25
|
+
logger
|
|
76
26
|
});
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.log("Clearing Cache");
|
|
29
|
+
cacheProvider.purge(prunePeriod, concurrency);
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.log("Cache Cleared");
|
|
77
32
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { JsonReporter, AdoReporter, LogReporter, ProgressReporter, ChromeTraceEventsReporter } from "@lage-run/reporters";
|
|
2
2
|
import type { ReporterInitOptions } from "../types/ReporterInitOptions.js";
|
|
3
|
-
export declare function createReporter(reporter: string, options: ReporterInitOptions): ChromeTraceEventsReporter | JsonReporter | AdoReporter |
|
|
3
|
+
export declare function createReporter(reporter: string, options: ReporterInitOptions): ChromeTraceEventsReporter | JsonReporter | AdoReporter | LogReporter | ProgressReporter;
|
|
@@ -27,8 +27,14 @@ function createReporter(reporter, options) {
|
|
|
27
27
|
grouped,
|
|
28
28
|
logLevel: verbose ? _logger.LogLevel.verbose : logLevel
|
|
29
29
|
});
|
|
30
|
+
case "npmLog":
|
|
31
|
+
case "old":
|
|
32
|
+
return new _reporters.LogReporter({
|
|
33
|
+
grouped,
|
|
34
|
+
logLevel: verbose ? _logger.LogLevel.verbose : logLevel
|
|
35
|
+
});
|
|
30
36
|
default:
|
|
31
|
-
if (progress && !(verbose || grouped)) {
|
|
37
|
+
if (progress && !(logLevel >= _logger.LogLevel.verbose || verbose || grouped)) {
|
|
32
38
|
return new _reporters.ProgressReporter({
|
|
33
39
|
concurrency
|
|
34
40
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Command Line Interface for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/microsoft/lage"
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@lage-run/find-npm-client": "^0.1.4",
|
|
22
22
|
"@lage-run/logger": "^1.2.2",
|
|
23
|
-
"@lage-run/scheduler": "^0.
|
|
24
|
-
"@lage-run/scheduler-types": "^0.3.
|
|
25
|
-
"@lage-run/target-graph": "^0.
|
|
26
|
-
"@lage-run/cache": "^0.
|
|
27
|
-
"@lage-run/reporters": "^1.0.
|
|
23
|
+
"@lage-run/scheduler": "^0.9.1",
|
|
24
|
+
"@lage-run/scheduler-types": "^0.3.2",
|
|
25
|
+
"@lage-run/target-graph": "^0.7.0",
|
|
26
|
+
"@lage-run/cache": "^0.4.0",
|
|
27
|
+
"@lage-run/reporters": "^1.0.4",
|
|
28
28
|
"commander": "^9.4.0",
|
|
29
29
|
"workspace-tools": "^0.30.0",
|
|
30
30
|
"chokidar": "3.5.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getCacheDir(workspace: string, internalCacheFolder: string): string;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "getCacheDir", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: ()=>getCacheDir
|
|
8
|
-
});
|
|
9
|
-
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
10
|
-
function _interopRequireDefault(obj) {
|
|
11
|
-
return obj && obj.__esModule ? obj : {
|
|
12
|
-
default: obj
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function getCacheDir(workspace, internalCacheFolder) {
|
|
16
|
-
const cacheFolder = !internalCacheFolder ? undefined : internalCacheFolder;
|
|
17
|
-
return _path.default.join(workspace, cacheFolder ?? "node_modules/.cache/backfill");
|
|
18
|
-
}
|