@lage-run/cli 0.11.3 → 0.12.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 CHANGED
@@ -2,7 +2,67 @@
2
2
  "name": "@lage-run/cli",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 29 Mar 2023 20:02:22 GMT",
5
+ "date": "Thu, 30 Mar 2023 23:46:39 GMT",
6
+ "tag": "@lage-run/cli_v0.12.0",
7
+ "version": "0.12.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/cli",
13
+ "commit": "41360ccbd7433afe537342c4c815b1e02bc9c9b8",
14
+ "comment": "moved caching to happen inside workers"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@lage-run/cli",
19
+ "comment": "Bump @lage-run/scheduler to v0.11.0",
20
+ "commit": "41360ccbd7433afe537342c4c815b1e02bc9c9b8"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Wed, 29 Mar 2023 22:41:49 GMT",
27
+ "tag": "@lage-run/cli_v0.11.4",
28
+ "version": "0.11.4",
29
+ "comments": {
30
+ "patch": [
31
+ {
32
+ "author": "kchau@microsoft.com",
33
+ "package": "@lage-run/cli",
34
+ "commit": "ec458f83e5adb784019efaa06f902ec75f85990c",
35
+ "comment": "moving config to its own package"
36
+ },
37
+ {
38
+ "author": "beachball",
39
+ "package": "@lage-run/cli",
40
+ "comment": "Bump @lage-run/config to v0.1.1",
41
+ "commit": "ec458f83e5adb784019efaa06f902ec75f85990c"
42
+ },
43
+ {
44
+ "author": "beachball",
45
+ "package": "@lage-run/cli",
46
+ "comment": "Bump @lage-run/scheduler to v0.10.5",
47
+ "commit": "ec458f83e5adb784019efaa06f902ec75f85990c"
48
+ },
49
+ {
50
+ "author": "beachball",
51
+ "package": "@lage-run/cli",
52
+ "comment": "Bump @lage-run/scheduler-types to v0.3.5",
53
+ "commit": "ec458f83e5adb784019efaa06f902ec75f85990c"
54
+ },
55
+ {
56
+ "author": "beachball",
57
+ "package": "@lage-run/cli",
58
+ "comment": "Bump @lage-run/reporters to v1.0.7",
59
+ "commit": "ec458f83e5adb784019efaa06f902ec75f85990c"
60
+ }
61
+ ]
62
+ }
63
+ },
64
+ {
65
+ "date": "Wed, 29 Mar 2023 20:02:40 GMT",
6
66
  "tag": "@lage-run/cli_v0.11.3",
7
67
  "version": "0.11.3",
8
68
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,33 @@
1
1
  # Change Log - @lage-run/cli
2
2
 
3
- This log was last generated on Wed, 29 Mar 2023 20:02:22 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 30 Mar 2023 23:46:39 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.12.0
8
+
9
+ Thu, 30 Mar 2023 23:46:39 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - moved caching to happen inside workers (kchau@microsoft.com)
14
+ - Bump @lage-run/scheduler to v0.11.0
15
+
16
+ ## 0.11.4
17
+
18
+ Wed, 29 Mar 2023 22:41:49 GMT
19
+
20
+ ### Patches
21
+
22
+ - moving config to its own package (kchau@microsoft.com)
23
+ - Bump @lage-run/config to v0.1.1
24
+ - Bump @lage-run/scheduler to v0.10.5
25
+ - Bump @lage-run/scheduler-types to v0.3.5
26
+ - Bump @lage-run/reporters to v1.0.7
27
+
7
28
  ## 0.11.3
8
29
 
9
- Wed, 29 Mar 2023 20:02:22 GMT
30
+ Wed, 29 Mar 2023 20:02:40 GMT
10
31
 
11
32
  ### Patches
12
33
 
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "affectedAction", {
8
8
  });
9
9
  const _logger = /*#__PURE__*/ _interopRequireDefault(require("@lage-run/logger"));
10
10
  const _workspaceTools = require("workspace-tools");
11
- const _getConfigJs = require("../../config/getConfig.js");
11
+ const _config = require("@lage-run/config");
12
12
  const _getFilteredPackagesJs = require("../../filter/getFilteredPackages.js");
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule ? obj : {
@@ -18,7 +18,7 @@ function _interopRequireDefault(obj) {
18
18
  async function affectedAction(options) {
19
19
  const { dependencies , dependents , since , scope , ignore , outputFormat } = options;
20
20
  const cwd = process.cwd();
21
- const config = await (0, _getConfigJs.getConfig)(cwd);
21
+ const config = await (0, _config.getConfig)(cwd);
22
22
  const logger = (0, _logger.default)();
23
23
  const root = (0, _workspaceTools.getWorkspaceRoot)(cwd);
24
24
  const packageInfos = (0, _workspaceTools.getPackageInfos)(root);
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "cacheAction", {
7
7
  get: ()=>cacheAction
8
8
  });
9
9
  const _clearCacheJs = require("./clearCache.js");
10
- const _getConfigJs = require("../../config/getConfig.js");
10
+ const _config = require("@lage-run/config");
11
11
  const _pruneCacheJs = require("./pruneCache.js");
12
12
  const _logger = /*#__PURE__*/ _interopRequireDefault(require("@lage-run/logger"));
13
13
  function _interopRequireDefault(obj) {
@@ -17,7 +17,7 @@ function _interopRequireDefault(obj) {
17
17
  }
18
18
  async function cacheAction(options, command) {
19
19
  const cwd = process.cwd();
20
- const config = await (0, _getConfigJs.getConfig)(cwd);
20
+ const config = await (0, _config.getConfig)(cwd);
21
21
  const logger = (0, _logger.default)();
22
22
  if (options.clear) {
23
23
  return await (0, _clearCacheJs.clearCache)({
@@ -6,15 +6,14 @@ Object.defineProperty(exports, "clearCache", {
6
6
  enumerable: true,
7
7
  get: ()=>clearCache
8
8
  });
9
- const _getConfigJs = require("../../config/getConfig.js");
9
+ const _config = require("@lage-run/config");
10
10
  const _workspaceTools = require("workspace-tools");
11
- const _getConcurrencyJs = require("../../config/getConcurrency.js");
12
11
  const _cache = require("@lage-run/cache");
13
12
  async function clearCache(options) {
14
13
  const { logger , cwd } = options;
15
- const config = await (0, _getConfigJs.getConfig)(cwd);
14
+ const config = await (0, _config.getConfig)(cwd);
16
15
  const workspaceRoot = (0, _workspaceTools.getWorkspaceRoot)(cwd);
17
- const concurrency = (0, _getConcurrencyJs.getConcurrency)(options.concurrency, config.concurrency);
16
+ const concurrency = (0, _config.getConcurrency)(options.concurrency, config.concurrency);
18
17
  if (!workspaceRoot) {
19
18
  return;
20
19
  }
@@ -7,14 +7,13 @@ Object.defineProperty(exports, "pruneCache", {
7
7
  get: ()=>pruneCache
8
8
  });
9
9
  const _workspaceTools = require("workspace-tools");
10
- const _getConfigJs = require("../../config/getConfig.js");
11
- const _getConcurrencyJs = require("../../config/getConcurrency.js");
10
+ const _config = require("@lage-run/config");
12
11
  const _cache = require("@lage-run/cache");
13
12
  async function pruneCache(options) {
14
13
  const { logger , cwd , pruneDays } = options;
15
- const config = await (0, _getConfigJs.getConfig)(cwd);
14
+ const config = await (0, _config.getConfig)(cwd);
16
15
  const workspaceRoot = (0, _workspaceTools.getWorkspaceRoot)(cwd);
17
- const concurrency = (0, _getConcurrencyJs.getConcurrency)(options.concurrency, config.concurrency);
16
+ const concurrency = (0, _config.getConcurrency)(options.concurrency, config.concurrency);
18
17
  if (!workspaceRoot) {
19
18
  return;
20
19
  }
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from "@lage-run/logger";
2
2
  import type { PackageInfos } from "workspace-tools";
3
- import type { PipelineDefinition } from "../../types/PipelineDefinition.js";
3
+ import type { PipelineDefinition } from "@lage-run/config";
4
4
  interface CreateTargetGraphOptions {
5
5
  logger: Logger;
6
6
  root: string;
@@ -1,3 +1,3 @@
1
1
  import type { Target } from "@lage-run/target-graph";
2
- import type { PipelineDefinition } from "../../types/PipelineDefinition.js";
2
+ import type { PipelineDefinition } from "@lage-run/config";
3
3
  export declare function filterPipelineDefinitions(targets: IterableIterator<Target>, pipeline: PipelineDefinition): PipelineDefinition;
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "infoAction", {
6
6
  enumerable: true,
7
7
  get: ()=>infoAction
8
8
  });
9
- const _createCacheProviderJs = require("./createCacheProvider.js");
10
9
  const _createTargetGraphJs = require("./createTargetGraph.js");
11
10
  const _filterArgsForTasksJs = require("./filterArgsForTasks.js");
12
- const _getConfigJs = require("../../config/getConfig.js");
11
+ const _config = require("@lage-run/config");
13
12
  const _workspaceTools = require("workspace-tools");
14
13
  const _logger = /*#__PURE__*/ _interopRequireDefault(require("@lage-run/logger"));
15
14
  const _targetGraph = require("@lage-run/target-graph");
@@ -20,12 +19,12 @@ function _interopRequireDefault(obj) {
20
19
  }
21
20
  async function infoAction(options, command) {
22
21
  const cwd = process.cwd();
23
- const config = await (0, _getConfigJs.getConfig)(cwd);
22
+ const config = await (0, _config.getConfig)(cwd);
24
23
  const logger = (0, _logger.default)();
25
24
  // Build Target Graph
26
25
  const root = (0, _workspaceTools.getWorkspaceRoot)(process.cwd());
27
26
  const packageInfos = (0, _workspaceTools.getPackageInfos)(root);
28
- const { tasks , taskArgs } = (0, _filterArgsForTasksJs.filterArgsForTasks)(command.args);
27
+ const { tasks } = (0, _filterArgsForTasksJs.filterArgsForTasks)(command.args);
29
28
  const targetGraph = (0, _createTargetGraphJs.createTargetGraph)({
30
29
  logger,
31
30
  root,
@@ -42,13 +41,6 @@ async function infoAction(options, command) {
42
41
  });
43
42
  // Make sure we do not attempt writeRemoteCache in info mode
44
43
  config.cacheOptions.writeRemoteCache = false;
45
- const { hasher } = (0, _createCacheProviderJs.createCache)({
46
- root,
47
- logger,
48
- cacheOptions: config.cacheOptions,
49
- skipLocalCache: false,
50
- cliArgs: taskArgs
51
- });
52
44
  const { targets } = targetGraph;
53
45
  for (const target of targets.values()){
54
46
  if (target.id === (0, _targetGraph.getStartTargetId)()) {
@@ -56,9 +48,6 @@ async function infoAction(options, command) {
56
48
  }
57
49
  const startIdIndex = target.dependencies.indexOf((0, _targetGraph.getStartTargetId)());
58
50
  target.dependencies.splice(startIdIndex, 1);
59
- process.stdout.write(`${JSON.stringify({
60
- ...target,
61
- hash: await hasher.hash(target)
62
- })}\n`);
51
+ process.stdout.write(`${JSON.stringify(target)}\n`);
63
52
  }
64
53
  }
@@ -6,18 +6,15 @@ Object.defineProperty(exports, "runAction", {
6
6
  enumerable: true,
7
7
  get: ()=>runAction
8
8
  });
9
- const _createCacheProviderJs = require("./createCacheProvider.js");
10
9
  const _createTargetGraphJs = require("./createTargetGraph.js");
11
10
  const _filterArgsForTasksJs = require("./filterArgsForTasks.js");
12
11
  const _filterPipelineDefinitionsJs = require("./filterPipelineDefinitions.js");
13
12
  const _findNpmClient = require("@lage-run/find-npm-client");
14
- const _getConfigJs = require("../../config/getConfig.js");
15
- const _getMaxWorkersPerTaskJs = require("../../config/getMaxWorkersPerTask.js");
13
+ const _config = require("@lage-run/config");
16
14
  const _workspaceTools = require("workspace-tools");
17
15
  const _initializeReportersJs = require("../initializeReporters.js");
18
16
  const _scheduler = require("@lage-run/scheduler");
19
17
  const _logger = /*#__PURE__*/ _interopRequireDefault(require("@lage-run/logger"));
20
- const _getConcurrencyJs = require("../../config/getConcurrency.js");
21
18
  const _errorsJs = require("../../types/errors.js");
22
19
  function _interopRequireDefault(obj) {
23
20
  return obj && obj.__esModule ? obj : {
@@ -26,9 +23,9 @@ function _interopRequireDefault(obj) {
26
23
  }
27
24
  async function runAction(options, command) {
28
25
  const cwd = process.cwd();
29
- const config = await (0, _getConfigJs.getConfig)(cwd);
26
+ const config = await (0, _config.getConfig)(cwd);
30
27
  // Merged options
31
- const concurrency = (0, _getConcurrencyJs.getConcurrency)(options.concurrency, config.concurrency);
28
+ const concurrency = (0, _config.getConcurrency)(options.concurrency, config.concurrency);
32
29
  const allowNoTargetRuns = options.allowNoTargetRuns || config.allowNoTargetRuns;
33
30
  // Configure logger
34
31
  const logger = (0, _logger.default)();
@@ -55,49 +52,45 @@ async function runAction(options, command) {
55
52
  packageInfos
56
53
  });
57
54
  validateTargetGraph(targetGraph, allowNoTargetRuns);
58
- const { cacheProvider , hasher } = (0, _createCacheProviderJs.createCache)({
59
- root,
60
- logger,
61
- cacheOptions: config.cacheOptions,
62
- skipLocalCache: options.skipLocalCache,
63
- cliArgs: taskArgs
64
- });
65
55
  logger.verbose(`Running with ${concurrency} workers`);
66
56
  const filteredPipeline = (0, _filterPipelineDefinitionsJs.filterPipelineDefinitions)(targetGraph.targets.values(), config.pipeline);
67
- const maxWorkersPerTaskMap = (0, _getMaxWorkersPerTaskJs.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
57
+ const maxWorkersPerTaskMap = (0, _config.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
68
58
  const scheduler = new _scheduler.SimpleScheduler({
69
59
  logger,
70
60
  concurrency,
71
- cacheProvider,
72
- hasher,
73
61
  continueOnError: options.continue,
74
62
  shouldCache: options.cache,
75
63
  shouldResetCache: options.resetCache,
64
+ workerData: {
65
+ root,
66
+ taskArgs,
67
+ skipLocalCache: options.skipLocalCache,
68
+ runners: {
69
+ npmScript: {
70
+ script: require.resolve("./runners/NpmScriptRunner.js"),
71
+ options: {
72
+ nodeArg: options.nodeArg,
73
+ taskArgs,
74
+ npmCmd: (0, _findNpmClient.findNpmClient)(config.npmClient)
75
+ }
76
+ },
77
+ worker: {
78
+ script: require.resolve("./runners/WorkerRunner.js"),
79
+ options: {
80
+ taskArgs
81
+ }
82
+ },
83
+ noop: {
84
+ script: require.resolve("./runners/NoOpRunner.js"),
85
+ options: {}
86
+ },
87
+ ...config.runners
88
+ }
89
+ },
76
90
  maxWorkersPerTask: new Map([
77
- ...(0, _getMaxWorkersPerTaskJs.getMaxWorkersPerTask)(filteredPipeline, concurrency),
91
+ ...(0, _config.getMaxWorkersPerTask)(filteredPipeline, concurrency),
78
92
  ...maxWorkersPerTaskMap
79
93
  ]),
80
- runners: {
81
- npmScript: {
82
- script: require.resolve("./runners/NpmScriptRunner.js"),
83
- options: {
84
- nodeArg: options.nodeArg,
85
- taskArgs,
86
- npmCmd: (0, _findNpmClient.findNpmClient)(config.npmClient)
87
- }
88
- },
89
- worker: {
90
- script: require.resolve("./runners/WorkerRunner.js"),
91
- options: {
92
- taskArgs
93
- }
94
- },
95
- noop: {
96
- script: require.resolve("./runners/NoOpRunner.js"),
97
- options: {}
98
- },
99
- ...config.runners
100
- },
101
94
  workerIdleMemoryLimit: config.workerIdleMemoryLimit
102
95
  });
103
96
  const summary = await scheduler.run(root, targetGraph);
@@ -6,19 +6,16 @@ Object.defineProperty(exports, "watchAction", {
6
6
  enumerable: true,
7
7
  get: ()=>watchAction
8
8
  });
9
- const _createCacheProviderJs = require("./createCacheProvider.js");
10
9
  const _createTargetGraphJs = require("./createTargetGraph.js");
11
10
  const _filterArgsForTasksJs = require("./filterArgsForTasks.js");
12
11
  const _findNpmClient = require("@lage-run/find-npm-client");
13
- const _getConfigJs = require("../../config/getConfig.js");
14
- const _getMaxWorkersPerTaskJs = require("../../config/getMaxWorkersPerTask.js");
12
+ const _config = require("@lage-run/config");
15
13
  const _workspaceTools = require("workspace-tools");
16
14
  const _filterPipelineDefinitionsJs = require("./filterPipelineDefinitions.js");
17
15
  const _reporters = require("@lage-run/reporters");
18
16
  const _scheduler = require("@lage-run/scheduler");
19
17
  const _watcherJs = require("./watcher.js");
20
18
  const _logger = /*#__PURE__*/ _interopRequireWildcard(require("@lage-run/logger"));
21
- const _getConcurrencyJs = require("../../config/getConcurrency.js");
22
19
  function _getRequireWildcardCache(nodeInterop) {
23
20
  if (typeof WeakMap !== "function") return null;
24
21
  var cacheBabelInterop = new WeakMap();
@@ -60,8 +57,8 @@ function _interopRequireWildcard(obj, nodeInterop) {
60
57
  }
61
58
  async function watchAction(options, command) {
62
59
  const cwd = process.cwd();
63
- const config = await (0, _getConfigJs.getConfig)(cwd);
64
- const concurrency = (0, _getConcurrencyJs.getConcurrency)(options.concurrency, config.concurrency);
60
+ const config = await (0, _config.getConfig)(cwd);
61
+ const concurrency = (0, _config.getConcurrency)(options.concurrency, config.concurrency);
65
62
  // Configure logger
66
63
  const logger = (0, _logger.default)();
67
64
  const reporter = new _reporters.LogReporter({
@@ -88,48 +85,44 @@ async function watchAction(options, command) {
88
85
  });
89
86
  // Make sure we do not attempt writeRemoteCache in watch mode
90
87
  config.cacheOptions.writeRemoteCache = false;
91
- const { cacheProvider , hasher } = (0, _createCacheProviderJs.createCache)({
92
- root,
93
- logger,
94
- cacheOptions: config.cacheOptions,
95
- skipLocalCache: false,
96
- cliArgs: taskArgs
97
- });
98
88
  const filteredPipeline = (0, _filterPipelineDefinitionsJs.filterPipelineDefinitions)(targetGraph.targets.values(), config.pipeline);
99
- const maxWorkersPerTaskMap = (0, _getMaxWorkersPerTaskJs.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
89
+ const maxWorkersPerTaskMap = (0, _config.getMaxWorkersPerTaskFromOptions)(options.maxWorkersPerTask);
100
90
  const scheduler = new _scheduler.SimpleScheduler({
101
91
  logger,
102
92
  concurrency,
103
- cacheProvider,
104
- hasher,
105
93
  continueOnError: true,
94
+ workerData: {
95
+ root,
96
+ taskArgs,
97
+ skipLocalCache: options.skipLocalCache,
98
+ runners: {
99
+ npmScript: {
100
+ script: require.resolve("./runners/NpmScriptRunner.js"),
101
+ options: {
102
+ nodeArg: options.nodeArg,
103
+ taskArgs,
104
+ npmCmd: (0, _findNpmClient.findNpmClient)(config.npmClient)
105
+ }
106
+ },
107
+ worker: {
108
+ script: require.resolve("./runners/WorkerRunner.js"),
109
+ options: {
110
+ taskArgs
111
+ }
112
+ },
113
+ noop: {
114
+ script: require.resolve("./runners/NoOpRunner.js"),
115
+ options: {}
116
+ },
117
+ ...config.runners
118
+ }
119
+ },
106
120
  shouldCache: options.cache,
107
121
  shouldResetCache: options.resetCache,
108
122
  maxWorkersPerTask: new Map([
109
- ...(0, _getMaxWorkersPerTaskJs.getMaxWorkersPerTask)(filteredPipeline, concurrency),
123
+ ...(0, _config.getMaxWorkersPerTask)(filteredPipeline, concurrency),
110
124
  ...maxWorkersPerTaskMap
111
125
  ]),
112
- runners: {
113
- npmScript: {
114
- script: require.resolve("./runners/NpmScriptRunner.js"),
115
- options: {
116
- nodeArg: options.nodeArg,
117
- taskArgs,
118
- npmCmd: (0, _findNpmClient.findNpmClient)(config.npmClient)
119
- }
120
- },
121
- worker: {
122
- script: require.resolve("./runners/WorkerRunner.js"),
123
- options: {
124
- taskArgs
125
- }
126
- },
127
- noop: {
128
- script: require.resolve("./runners/NoOpRunner.js"),
129
- options: {}
130
- },
131
- ...config.runners
132
- },
133
126
  workerIdleMemoryLimit: config.workerIdleMemoryLimit
134
127
  });
135
128
  // Initial run
@@ -139,8 +132,6 @@ async function watchAction(options, command) {
139
132
  // Disables cache for subsequent runs
140
133
  // TODO: support updating hasher + write-only local cacheProvider for subsequent runs
141
134
  for (const targetRun of scheduler.targetRuns.values()){
142
- targetRun.options.cacheProvider = undefined;
143
- targetRun.options.hasher = undefined;
144
135
  targetRun.options.shouldCache = false;
145
136
  }
146
137
  // When initial run is done, disable fetching of caches on all targets, keep writing to the cache
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export type { CacheOptions } from "./types/CacheOptions.js";
2
- export type { ConfigOptions } from "./types/ConfigOptions.js";
3
- export type { Priority } from "./types/Priority.js";
4
- export type { PipelineDefinition } from "./types/PipelineDefinition.js";
5
- export type { LoggerOptions } from "./types/LoggerOptions.js";
6
- export type { TargetRunnerPickerOptions } from "@lage-run/scheduler";
1
+ export type { CacheOptions } from "@lage-run/config";
2
+ export type { ConfigOptions } from "@lage-run/config";
3
+ export type { Priority } from "@lage-run/config";
4
+ export type { PipelineDefinition } from "@lage-run/config";
5
+ export type { LoggerOptions } from "@lage-run/config";
6
+ export type { TargetRunnerPickerOptions } from "@lage-run/scheduler-types";
7
7
  export type { TargetConfig } from "@lage-run/target-graph";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/cli",
3
- "version": "0.11.3",
3
+ "version": "0.12.0",
4
4
  "description": "Command Line Interface for Lage",
5
5
  "repository": {
6
6
  "url": "https://github.com/microsoft/lage"
@@ -18,23 +18,22 @@
18
18
  "lint": "monorepo-scripts lint"
19
19
  },
20
20
  "dependencies": {
21
+ "@lage-run/config": "^0.1.1",
21
22
  "@lage-run/find-npm-client": "^0.1.4",
22
23
  "@lage-run/logger": "^1.2.2",
23
- "@lage-run/scheduler": "^0.10.4",
24
- "@lage-run/scheduler-types": "^0.3.4",
24
+ "@lage-run/scheduler": "^0.11.0",
25
+ "@lage-run/scheduler-types": "^0.3.5",
25
26
  "@lage-run/target-graph": "^0.8.1",
26
27
  "@lage-run/cache": "^0.5.1",
27
- "@lage-run/reporters": "^1.0.6",
28
+ "@lage-run/reporters": "^1.0.7",
28
29
  "commander": "^9.4.0",
29
30
  "workspace-tools": "^0.30.0",
30
31
  "chokidar": "3.5.3",
31
- "fast-glob": "^3.2.11",
32
- "cosmiconfig": "^7.0.0"
32
+ "fast-glob": "^3.2.11"
33
33
  },
34
34
  "devDependencies": {
35
35
  "monorepo-scripts": "*",
36
- "@lage-run/monorepo-fixture": "*",
37
- "backfill-config": "6.3.1"
36
+ "@lage-run/monorepo-fixture": "*"
38
37
  },
39
38
  "publishConfig": {
40
39
  "access": "public"
@@ -1,15 +0,0 @@
1
- import type { CacheOptions } from "@lage-run/cache";
2
- import { RemoteFallbackCacheProvider, TargetHasher } from "@lage-run/cache";
3
- import type { Logger } from "@lage-run/logger";
4
- interface CreateCacheOptions {
5
- cacheOptions?: CacheOptions;
6
- logger: Logger;
7
- root: string;
8
- skipLocalCache: boolean;
9
- cliArgs: string[];
10
- }
11
- export declare function createCache(options: CreateCacheOptions): {
12
- cacheProvider: RemoteFallbackCacheProvider;
13
- hasher: TargetHasher;
14
- };
15
- export {};
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createCache", {
6
- enumerable: true,
7
- get: ()=>createCache
8
- });
9
- const _cache = require("@lage-run/cache");
10
- const _isRunningFromCIJs = require("../isRunningFromCI.js");
11
- function createCache(options) {
12
- const { cacheOptions , logger , root , skipLocalCache , cliArgs } = options;
13
- const hasRemoteCacheConfig = !!cacheOptions?.cacheStorageConfig || !!process.env.BACKFILL_CACHE_PROVIDER || !!process.env.BACKFILL_CACHE_PROVIDER_OPTIONS;
14
- // Create Cache Provider
15
- const cacheProvider = new _cache.RemoteFallbackCacheProvider({
16
- root,
17
- logger,
18
- localCacheProvider: skipLocalCache === true ? undefined : new _cache.BackfillCacheProvider({
19
- logger,
20
- root,
21
- cacheOptions: {
22
- outputGlob: cacheOptions?.outputGlob,
23
- ...cacheOptions?.internalCacheFolder && {
24
- internalCacheFolder: cacheOptions.internalCacheFolder
25
- },
26
- ...cacheOptions?.incrementalCaching && {
27
- incrementalCaching: cacheOptions.incrementalCaching
28
- }
29
- }
30
- }),
31
- remoteCacheProvider: hasRemoteCacheConfig ? new _cache.BackfillCacheProvider({
32
- logger,
33
- root,
34
- cacheOptions: cacheOptions ?? {}
35
- }) : undefined,
36
- writeRemoteCache: cacheOptions?.writeRemoteCache === true || String(process.env.LAGE_WRITE_CACHE).toLowerCase() === "true" || _isRunningFromCIJs.isRunningFromCI
37
- });
38
- const hasher = new _cache.TargetHasher({
39
- root,
40
- environmentGlob: cacheOptions?.environmentGlob ?? [],
41
- cacheKey: cacheOptions?.cacheKey,
42
- cliArgs
43
- });
44
- return {
45
- cacheProvider,
46
- hasher
47
- };
48
- }
@@ -1 +0,0 @@
1
- export declare function getConcurrency(optionsConcurrency: number | undefined, configConcurrency: number | undefined): number;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getConcurrency", {
6
- enumerable: true,
7
- get: ()=>getConcurrency
8
- });
9
- const _os = /*#__PURE__*/ _interopRequireDefault(require("os"));
10
- function _interopRequireDefault(obj) {
11
- return obj && obj.__esModule ? obj : {
12
- default: obj
13
- };
14
- }
15
- function getConcurrency(optionsConcurrency, configConcurrency) {
16
- return optionsConcurrency || configConcurrency || _os.default.cpus().length - 1;
17
- }
@@ -1,2 +0,0 @@
1
- import type { ConfigOptions } from "../types/ConfigOptions.js";
2
- export declare function getConfig(cwd: string): Promise<ConfigOptions>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getConfig", {
6
- enumerable: true,
7
- get: ()=>getConfig
8
- });
9
- const _os = /*#__PURE__*/ _interopRequireDefault(require("os"));
10
- const _cosmiconfig = require("cosmiconfig");
11
- const _workspaceTools = require("workspace-tools");
12
- function _interopRequireDefault(obj) {
13
- return obj && obj.__esModule ? obj : {
14
- default: obj
15
- };
16
- }
17
- async function getConfig(cwd) {
18
- // Verify presence of git
19
- const root = (0, _workspaceTools.getWorkspaceRoot)(cwd);
20
- if (!root) {
21
- throw new Error("This must be called inside a codebase that is part of a JavaScript workspace.");
22
- }
23
- // Search for lage.config.js file
24
- const ConfigModuleName = "lage";
25
- const configExplorer = await (0, _cosmiconfig.cosmiconfig)(ConfigModuleName);
26
- const results = await configExplorer.search(root ?? cwd);
27
- const config = results?.config;
28
- return {
29
- cacheOptions: config?.cacheOptions ?? {},
30
- ignore: config?.ignore ?? [],
31
- npmClient: config?.npmClient ?? "npm",
32
- pipeline: config?.pipeline ?? {},
33
- priorities: config?.priorities ?? [],
34
- repoWideChanges: config?.repoWideChanges ?? [
35
- "lage.config.js",
36
- "package-lock.json",
37
- "yarn.lock",
38
- "pnpm-lock.yaml",
39
- "lerna.json",
40
- "rush.json"
41
- ],
42
- loggerOptions: config?.loggerOptions ?? {},
43
- runners: config?.runners ?? {},
44
- workerIdleMemoryLimit: config?.workerIdleMemoryLimit ?? _os.default.totalmem(),
45
- concurrency: config?.concurrency ?? _os.default.cpus().length - 1,
46
- allowNoTargetRuns: config?.allowNoTargetRuns ?? false
47
- };
48
- }
@@ -1,3 +0,0 @@
1
- import type { ConfigOptions } from "../types/ConfigOptions.js";
2
- export declare function getMaxWorkersPerTask(pipelineConfig: ConfigOptions["pipeline"], concurrency: number): Map<string, number>;
3
- export declare function getMaxWorkersPerTaskFromOptions(maxWorkersPerTask: string[]): Map<string, number>;
@@ -1,68 +0,0 @@
1
- "use strict";
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
- getMaxWorkersPerTask: ()=>getMaxWorkersPerTask,
13
- getMaxWorkersPerTaskFromOptions: ()=>getMaxWorkersPerTaskFromOptions
14
- });
15
- function getMaxWorkersPerTask(pipelineConfig, concurrency) {
16
- const maxWorkersPerTask = new Map();
17
- let generalPoolCount = 0;
18
- let generatelPoolMaxWorkers = 0;
19
- let dedicatedPoolCount = 0;
20
- let dedicatedPoolMaxWorkers = 0;
21
- for (const [task, taskConfig] of Object.entries(pipelineConfig)){
22
- if (!Array.isArray(taskConfig) && !task.includes("#")) {
23
- const maxWorkerOption = taskConfig.maxWorkers ?? taskConfig.options?.maxWorkers;
24
- if (typeof maxWorkerOption === "undefined") {
25
- generalPoolCount++;
26
- continue;
27
- }
28
- let maxWorkers = 0;
29
- if (typeof maxWorkerOption !== "number") {
30
- throw new Error(`Invalid maxWorkers value: ${maxWorkerOption}`);
31
- } else {
32
- maxWorkers = maxWorkerOption;
33
- }
34
- maxWorkersPerTask.set(task, maxWorkers);
35
- dedicatedPoolCount++;
36
- dedicatedPoolMaxWorkers += maxWorkers;
37
- }
38
- }
39
- if (dedicatedPoolCount > 0 && generalPoolCount > 0) {
40
- const avgMaxWorkers = dedicatedPoolMaxWorkers / dedicatedPoolCount;
41
- generatelPoolMaxWorkers = Math.max(1, Math.floor(avgMaxWorkers * generalPoolCount));
42
- }
43
- const grandTotal = dedicatedPoolMaxWorkers + generatelPoolMaxWorkers;
44
- // try to adjust the maxWorkersPerTask to fit the concurrency
45
- if (grandTotal > concurrency) {
46
- let newTotal = 0;
47
- for (const [task, maxWorkers] of maxWorkersPerTask.entries()){
48
- const newMaxWorkers = Math.max(1, Math.floor(maxWorkers / grandTotal * concurrency));
49
- newTotal += newMaxWorkers;
50
- maxWorkersPerTask.set(task, newMaxWorkers);
51
- }
52
- if (newTotal > concurrency) {
53
- throw new Error("Could not adjust maxWorkers per task to fit the concurrency, try reducing the maxWorkers, or increasing the --concurrency CLI argument, or separate the tasks to be run");
54
- }
55
- }
56
- return maxWorkersPerTask;
57
- }
58
- function getMaxWorkersPerTaskFromOptions(maxWorkersPerTask) {
59
- return new Map([
60
- ...maxWorkersPerTask.map((setting)=>{
61
- const [task, maxWorkers] = setting.split(/[=:]/);
62
- return [
63
- task,
64
- parseInt(maxWorkers, 10)
65
- ];
66
- })
67
- ]);
68
- }
@@ -1,7 +0,0 @@
1
- import type { Config as BackfillCacheOptions } from "backfill-config";
2
- export type CacheOptions = BackfillCacheOptions & {
3
- environmentGlob: string[];
4
- cacheKey: string;
5
- writeRemoteCache: boolean;
6
- skipLocalCache: boolean;
7
- };
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
@@ -1,56 +0,0 @@
1
- import type { CacheOptions } from "./CacheOptions.js";
2
- import type { Priority } from "./Priority.js";
3
- import type { PipelineDefinition } from "./PipelineDefinition.js";
4
- import type { LoggerOptions } from "./LoggerOptions.js";
5
- import type { TargetRunnerPickerOptions } from "@lage-run/scheduler";
6
- export type NpmClient = "npm" | "yarn" | "pnpm";
7
- export interface ConfigOptions {
8
- /**
9
- * Defines the task pipeline, prefix with "^" character to denote a direct topological dependency,
10
- * prefix with ^^ to denote a transitive topological dependency.
11
- *
12
- * Example:
13
- *
14
- * ```
15
- * {
16
- * build: ["^build"],
17
- * test: ["build"],
18
- * lint: []
19
- * bundle: ["^^transpile"],
20
- * transpile: [],
21
- * }
22
- * ```
23
- */
24
- pipeline: PipelineDefinition;
25
- /** Backfill cache options */
26
- cacheOptions: CacheOptions;
27
- /** Which files to ignore when calculating scopes with --since */
28
- ignore: string[];
29
- /** disables --since flag when any of this list of files changed */
30
- repoWideChanges: string[];
31
- /** Which NPM Client to use when running npm lifecycle scripts */
32
- npmClient: NpmClient;
33
- /** Optional priority to set on tasks in a package to make the scheduler give priority to tasks on the critical path for high priority tasks */
34
- priorities: Priority[];
35
- /**
36
- * Options that will be sent to all log reporters.
37
- */
38
- loggerOptions: LoggerOptions;
39
- /**
40
- * Custom runners for tasks in the pipeline. The key is the task name, and the value is a configuration describing what would be
41
- * passed to the runner constructor.
42
- */
43
- runners: TargetRunnerPickerOptions;
44
- /**
45
- * Maximum worker idle memory, this would cause workers to restart if they exceed this limit. This is useful to prevent memory leaks.
46
- */
47
- workerIdleMemoryLimit: number;
48
- /**
49
- * Maximum number of concurrent tasks to run
50
- */
51
- concurrency: number;
52
- /**
53
- * Allows for no targets run
54
- */
55
- allowNoTargetRuns: boolean;
56
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
@@ -1,15 +0,0 @@
1
- import type { LogLevel } from "@lage-run/logger";
2
- export interface LoggerOptions {
3
- disp?: {
4
- [level: string]: string;
5
- };
6
- style?: {
7
- [level: string]: {
8
- fg?: string;
9
- bg?: string;
10
- };
11
- };
12
- levels?: {
13
- [level: string]: LogLevel;
14
- };
15
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
@@ -1,12 +0,0 @@
1
- import type { TargetConfig } from "@lage-run/target-graph";
2
- import type { ConfigOptions } from "./ConfigOptions.js";
3
- export interface FactoryArgs {
4
- cwd: string;
5
- config: ConfigOptions;
6
- }
7
- export interface TargetConfigFactory {
8
- (args: FactoryArgs): TargetConfig | TargetConfig[];
9
- }
10
- export interface PipelineDefinition {
11
- [task: string]: string[] | TargetConfig;
12
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
@@ -1,8 +0,0 @@
1
- export interface Priority {
2
- /** package name, as in package.json */
3
- package?: string;
4
- /** task name, as listed in the `scripts` section of package.json */
5
- task: string;
6
- /** priority, the higher the more priority; undefined priority means lowest priority*/
7
- priority: number;
8
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });