@lage-run/cli 0.16.5 → 0.16.7

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,49 @@
2
2
  "name": "@lage-run/cli",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 21 Dec 2023 09:48:33 GMT",
5
+ "date": "Fri, 15 Mar 2024 04:34:52 GMT",
6
+ "version": "0.16.7",
7
+ "tag": "@lage-run/cli_v0.16.7",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/cli",
13
+ "commit": "71283d4af8888454c953e5228c97bfbb471c15ba",
14
+ "comment": "perf optimizations"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@lage-run/cli",
19
+ "comment": "Bump @lage-run/hasher to v1.1.0",
20
+ "commit": "not available"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@lage-run/cli",
25
+ "comment": "Bump @lage-run/scheduler to v1.1.13",
26
+ "commit": "not available"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Mon, 26 Feb 2024 16:18:50 GMT",
33
+ "version": "0.16.6",
34
+ "tag": "@lage-run/cli_v0.16.6",
35
+ "comments": {
36
+ "patch": [
37
+ {
38
+ "author": "sverre.johansen@gmail.com",
39
+ "package": "@lage-run/cli",
40
+ "commit": "9346c9d5b06973485c23cd3269228f91b0d79cbb",
41
+ "comment": "Fix undefined dependencies in info output"
42
+ }
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ "date": "Thu, 21 Dec 2023 09:49:09 GMT",
6
48
  "version": "0.16.5",
7
49
  "tag": "@lage-run/cli_v0.16.5",
8
50
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @lage-run/cli
2
2
 
3
- This log was last generated on Thu, 21 Dec 2023 09:48:33 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 15 Mar 2024 04:34:52 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.16.7
8
+
9
+ Fri, 15 Mar 2024 04:34:52 GMT
10
+
11
+ ### Patches
12
+
13
+ - perf optimizations (kchau@microsoft.com)
14
+ - Bump @lage-run/hasher to v1.1.0
15
+ - Bump @lage-run/scheduler to v1.1.13
16
+
17
+ ## 0.16.6
18
+
19
+ Mon, 26 Feb 2024 16:18:50 GMT
20
+
21
+ ### Patches
22
+
23
+ - Fix undefined dependencies in info output (sverre.johansen@gmail.com)
24
+
7
25
  ## 0.16.5
8
26
 
9
- Thu, 21 Dec 2023 09:48:33 GMT
27
+ Thu, 21 Dec 2023 09:49:09 GMT
10
28
 
11
29
  ### Patches
12
30
 
@@ -30,7 +30,7 @@ async function infoAction(options, command) {
30
30
  options.reporter = options.reporter ?? "json";
31
31
  (0, _initializeReporters.initializeReporters)(logger, options);
32
32
  const root = (0, _workspacetools.getWorkspaceRoot)(cwd);
33
- const packageInfos = await (0, _workspacetools.getPackageInfosAsync)(root);
33
+ const packageInfos = (0, _workspacetools.getPackageInfos)(root);
34
34
  const targetGraph = prepareAndCreateTargetGraph(config, logger, root, options, packageInfos, command);
35
35
  const scope = prepareAndGetFilteredPackages(config, logger, root, options, packageInfos);
36
36
  const packageTasks = processTargets(targetGraph.targets, packageInfos, config);
@@ -76,13 +76,12 @@ function prepareAndGetFilteredPackages(config, logger, root, options, packageInf
76
76
  }
77
77
  function processTargets(targets, packageInfos, config) {
78
78
  const packageTasks = new Map(); // Initialize the map with the correct type
79
+ const dependenciesCache = new Map();
79
80
  for (const target of targets.values()){
80
81
  if (shouldSkipTarget(target, packageInfos)) {
81
82
  continue;
82
83
  }
83
- const startIdIndex = target.dependencies.indexOf((0, _targetgraph.getStartTargetId)());
84
- target.dependencies.splice(startIdIndex, 1);
85
- const packageTask = generatePackageTask(target, config);
84
+ const packageTask = generatePackageTask(target, targets, packageInfos, dependenciesCache, config);
86
85
  if (packageTask) {
87
86
  // Check if the packageTask is defined before accessing its properties
88
87
  const packageName = packageTask.package;
@@ -94,22 +93,48 @@ function processTargets(targets, packageInfos, config) {
94
93
  }
95
94
  return packageTasks;
96
95
  }
96
+ function isTargetNoop(target, packageInfos) {
97
+ return !packageInfos[target.packageName]?.scripts?.[target.task];
98
+ }
97
99
  function shouldSkipTarget(target, packageInfos) {
98
- return target.id === (0, _targetgraph.getStartTargetId)() || !packageInfos[target.packageName ?? ""]?.scripts?.[target.task];
100
+ return target.id === (0, _targetgraph.getStartTargetId)() || isTargetNoop(target, packageInfos);
99
101
  }
100
- function generatePackageTask(target, config) {
102
+ function generatePackageTask(target, targets, packageInfos, dependenciesCache, config) {
101
103
  const command = generateCommand(target, config);
102
104
  const workingDirectory = getWorkingDirectory(target);
105
+ const dependenciesSet = resolveDependencies(target.dependencies, targets, packageInfos, dependenciesCache);
103
106
  const packageTask = {
104
107
  id: target.id,
105
108
  command,
106
- dependencies: target.dependencies,
109
+ dependencies: [
110
+ ...dependenciesSet
111
+ ],
107
112
  workingDirectory,
108
113
  package: target.packageName,
109
114
  task: target.task
110
115
  };
111
116
  return packageTask;
112
117
  }
118
+ function resolveDependencies(dependencies, targets, packageInfos, dependenciesCache) {
119
+ const result = new Set();
120
+ for (const dependency of dependencies){
121
+ if (dependency === (0, _targetgraph.getStartTargetId)()) {
122
+ continue;
123
+ }
124
+ if (!dependenciesCache.has(dependency)) {
125
+ const dependencyTarget = targets.get(dependency);
126
+ if (isTargetNoop(dependencyTarget, packageInfos)) {
127
+ dependenciesCache.set(dependency, resolveDependencies(dependencyTarget.dependencies, targets, packageInfos, dependenciesCache));
128
+ } else {
129
+ dependenciesCache.set(dependency, new Set([
130
+ dependency
131
+ ]));
132
+ }
133
+ }
134
+ dependenciesCache.get(dependency)?.forEach((dependency)=>result.add(dependency));
135
+ }
136
+ return result;
137
+ }
113
138
  function generateCommand(target, config) {
114
139
  const npmClient = config.npmClient ?? "npm";
115
140
  const command = [
@@ -38,7 +38,7 @@ async function runAction(options, command) {
38
38
  });
39
39
  // Build Target Graph
40
40
  const root = (0, _workspacetools.getWorkspaceRoot)(process.cwd());
41
- const packageInfos = await (0, _workspacetools.getPackageInfosAsync)(root);
41
+ const packageInfos = (0, _workspacetools.getPackageInfos)(root);
42
42
  const { tasks , taskArgs } = (0, _filterArgsForTasks.filterArgsForTasks)(command.args);
43
43
  const targetGraph = (0, _createTargetGraph.createTargetGraph)({
44
44
  logger,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/cli",
3
- "version": "0.16.5",
3
+ "version": "0.16.7",
4
4
  "description": "Command Line Interface for Lage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,10 +23,10 @@
23
23
  "@lage-run/cache": "^1.1.5",
24
24
  "@lage-run/config": "^0.3.5",
25
25
  "@lage-run/find-npm-client": "^0.1.4",
26
- "@lage-run/hasher": "^1.0.7",
26
+ "@lage-run/hasher": "^1.1.0",
27
27
  "@lage-run/logger": "^1.3.0",
28
28
  "@lage-run/reporters": "^1.2.7",
29
- "@lage-run/scheduler": "^1.1.12",
29
+ "@lage-run/scheduler": "^1.1.13",
30
30
  "@lage-run/scheduler-types": "^0.3.13",
31
31
  "@lage-run/target-graph": "^0.8.9",
32
32
  "chokidar": "3.5.3",