@lage-run/cli 0.34.0 → 0.35.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/lib/commands/createReporter.d.ts +23 -1
- package/lib/commands/createReporter.js +51 -27
- package/lib/commands/createReporter.js.map +1 -1
- package/lib/commands/exec/action.js +6 -1
- package/lib/commands/exec/action.js.map +1 -1
- package/lib/commands/exec/executeRemotely.js +6 -3
- package/lib/commands/exec/executeRemotely.js.map +1 -1
- package/lib/commands/exec/simulateFileAccess.d.ts +1 -1
- package/lib/commands/exec/simulateFileAccess.js +1 -1
- package/lib/commands/exec/simulateFileAccess.js.map +1 -1
- package/lib/commands/info/action.d.ts +7 -1
- package/lib/commands/info/action.js +13 -9
- package/lib/commands/info/action.js.map +1 -1
- package/lib/commands/initializeReporters.d.ts +2 -1
- package/lib/commands/initializeReporters.js +3 -3
- package/lib/commands/initializeReporters.js.map +1 -1
- package/lib/commands/launchServerInBackground.js +1 -1
- package/lib/commands/launchServerInBackground.js.map +1 -1
- package/lib/commands/run/createTargetGraph.d.ts +2 -2
- package/lib/commands/run/createTargetGraph.js +28 -10
- package/lib/commands/run/createTargetGraph.js.map +1 -1
- package/lib/commands/run/index.js +2 -2
- package/lib/commands/run/index.js.map +1 -1
- package/lib/commands/run/runAction.js +5 -2
- package/lib/commands/run/runAction.js.map +1 -1
- package/lib/commands/run/watchAction.js +6 -4
- package/lib/commands/run/watchAction.js.map +1 -1
- package/lib/commands/server/action.js +8 -3
- package/lib/commands/server/action.js.map +1 -1
- package/lib/commands/server/getOutputFiles.js +2 -1
- package/lib/commands/server/getOutputFiles.js.map +1 -1
- package/lib/commands/server/lageService.d.ts +1 -1
- package/lib/commands/server/lageService.js +2 -1
- package/lib/commands/server/lageService.js.map +1 -1
- package/lib/commands/server/singleTargetWorker.js +17 -19
- package/lib/commands/server/singleTargetWorker.js.map +1 -1
- package/lib/filter/getFilteredPackages.js +11 -2
- package/lib/filter/getFilteredPackages.js.map +1 -1
- package/lib/filter/hasRepoChanged.d.ts +13 -1
- package/lib/filter/hasRepoChanged.js +14 -12
- package/lib/filter/hasRepoChanged.js.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/internal.d.ts +1 -0
- package/lib/internal.js +4 -0
- package/lib/internal.js.map +1 -0
- package/lib/optimizeTargetGraph.js +1 -1
- package/lib/optimizeTargetGraph.js.map +1 -1
- package/lib/types/ReporterInitOptions.d.ts +4 -0
- package/lib/types/ReporterInitOptions.js.map +1 -1
- package/package.json +14 -14
- package/lib/cache/isRunningFromCI.d.ts +0 -1
- package/lib/cache/isRunningFromCI.js +0 -11
- package/lib/cache/isRunningFromCI.js.map +0 -1
- package/lib/commands/isRunningFromCI.d.ts +0 -1
- package/lib/commands/isRunningFromCI.js +0 -11
- package/lib/commands/isRunningFromCI.js.map +0 -1
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
const _workerthreadspool = require("@lage-run/worker-threads-pool");
|
|
6
6
|
const _runners = require("@lage-run/runners");
|
|
7
7
|
const _worker_threads = require("worker_threads");
|
|
8
|
-
|
|
8
|
+
function setup(options) {
|
|
9
9
|
const { runners } = options;
|
|
10
10
|
const runnerPicker = new _runners.TargetRunnerPicker(runners);
|
|
11
11
|
return {
|
|
@@ -13,21 +13,19 @@ async function setup(options) {
|
|
|
13
13
|
runnerPicker
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
(0, _workerthreadspool.registerWorker)(run);
|
|
33
|
-
})();
|
|
16
|
+
const { runnerPicker } = setup(_worker_threads.workerData);
|
|
17
|
+
async function run(data, abortSignal) {
|
|
18
|
+
let value = undefined;
|
|
19
|
+
const runner = await runnerPicker.pick(data.target);
|
|
20
|
+
value = await runner.run({
|
|
21
|
+
target: data.target,
|
|
22
|
+
weight: 0,
|
|
23
|
+
abortSignal
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
skipped: false,
|
|
27
|
+
hash: undefined,
|
|
28
|
+
value
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
(0, _workerthreadspool.registerWorker)(run);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/server/singleTargetWorker.ts"],"sourcesContent":["import { registerWorker } from \"@lage-run/worker-threads-pool\";\nimport { TargetRunnerPicker } from \"@lage-run/runners\";\nimport type { TargetRunnerPickerOptions } from \"@lage-run/runners\";\nimport type { Target } from \"@lage-run/target-graph\";\nimport { workerData } from \"worker_threads\";\n\ninterface SimpleTargetWorkerDataOptions {\n runners: TargetRunnerPickerOptions;\n}\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/server/singleTargetWorker.ts"],"sourcesContent":["import { registerWorker } from \"@lage-run/worker-threads-pool\";\nimport { TargetRunnerPicker } from \"@lage-run/runners\";\nimport type { TargetRunnerPickerOptions } from \"@lage-run/runners\";\nimport type { Target } from \"@lage-run/target-graph\";\nimport { workerData } from \"worker_threads\";\n\ninterface SimpleTargetWorkerDataOptions {\n runners: TargetRunnerPickerOptions;\n}\n\nfunction setup(options: SimpleTargetWorkerDataOptions) {\n const { runners } = options;\n const runnerPicker = new TargetRunnerPicker(runners);\n\n return {\n options,\n runnerPicker,\n };\n}\n\nconst { runnerPicker } = setup(workerData);\n\nasync function run(data: { target: Target }, abortSignal?: AbortSignal) {\n let value: unknown = undefined;\n const runner = await runnerPicker.pick(data.target);\n\n value = await runner.run({\n target: data.target,\n weight: 0,\n abortSignal,\n });\n\n return {\n skipped: false,\n hash: undefined,\n value,\n };\n}\n\nregisterWorker(run);\n"],"names":["setup","options","runners","runnerPicker","TargetRunnerPicker","workerData","run","data","abortSignal","value","undefined","runner","pick","target","weight","skipped","hash","registerWorker"],"mappings":";;;;mCAA+B;yBACI;gCAGR;AAM3B,SAASA,MAAMC,OAAsC;IACnD,MAAM,EAAEC,OAAO,EAAE,GAAGD;IACpB,MAAME,eAAe,IAAIC,2BAAkB,CAACF;IAE5C,OAAO;QACLD;QACAE;IACF;AACF;AAEA,MAAM,EAAEA,YAAY,EAAE,GAAGH,MAAMK,0BAAU;AAEzC,eAAeC,IAAIC,IAAwB,EAAEC,WAAyB;IACpE,IAAIC,QAAiBC;IACrB,MAAMC,SAAS,MAAMR,aAAaS,IAAI,CAACL,KAAKM,MAAM;IAElDJ,QAAQ,MAAME,OAAOL,GAAG,CAAC;QACvBO,QAAQN,KAAKM,MAAM;QACnBC,QAAQ;QACRN;IACF;IAEA,OAAO;QACLO,SAAS;QACTC,MAAMN;QACND;IACF;AACF;AAEAQ,IAAAA,iCAAc,EAACX"}
|
|
@@ -40,7 +40,11 @@ function getFilteredPackages(options) {
|
|
|
40
40
|
});
|
|
41
41
|
} else if (hasSince) {
|
|
42
42
|
try {
|
|
43
|
-
changedPackages = (0, _workspacetools.getChangedPackages)(
|
|
43
|
+
changedPackages = (0, _workspacetools.getChangedPackages)({
|
|
44
|
+
cwd: root,
|
|
45
|
+
target: since,
|
|
46
|
+
ignoreGlobs: sinceIgnoreGlobs
|
|
47
|
+
});
|
|
44
48
|
} catch (e) {
|
|
45
49
|
logger.warn(`An error in the git command has caused this scope run to include every package\n${e}`);
|
|
46
50
|
// if getChangedPackages throws, we will assume all have changed (using changedPackage = undefined)
|
|
@@ -55,7 +59,12 @@ function getFilteredPackages(options) {
|
|
|
55
59
|
});
|
|
56
60
|
// If the defined repo-wide changes are detected the get all packages and append to the filtered packages.
|
|
57
61
|
// This alo ensures that the modified packages are always run first.
|
|
58
|
-
if ((0, _hasRepoChanged.hasRepoChanged)(
|
|
62
|
+
if ((0, _hasRepoChanged.hasRepoChanged)({
|
|
63
|
+
since,
|
|
64
|
+
root,
|
|
65
|
+
environmentGlob: repoWideChanges,
|
|
66
|
+
logger
|
|
67
|
+
})) {
|
|
59
68
|
logger.verbose(`Repo-wide changes detected, running all packages. The following changed packages and their deps (if specified) will be run first: ${filteredPackages.join(",")}`);
|
|
60
69
|
filteredPackages = [
|
|
61
70
|
...new Set(filteredPackages.concat(Object.keys(packageInfos)))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filter/getFilteredPackages.ts"],"sourcesContent":["import type { PackageInfos } from \"workspace-tools\";\nimport { getScopedPackages, getChangedPackages, getTransitiveDependents, getTransitiveDependencies } from \"workspace-tools\";\n\nimport type { Logger } from \"@lage-run/logger\";\nimport { hasRepoChanged } from \"./hasRepoChanged.js\";\n\nexport function getFilteredPackages(options: {\n root: string;\n packageInfos: PackageInfos;\n logger: Logger;\n scope: string[] | undefined;\n since: string | undefined;\n sinceIgnoreGlobs: string[] | undefined;\n repoWideChanges: string[];\n includeDependents: boolean;\n includeDependencies: boolean;\n}): string[] {\n const { scope, since, sinceIgnoreGlobs, repoWideChanges, includeDependents, includeDependencies, logger, packageInfos, root } = options;\n\n // If scoped is defined, get scoped packages\n const hasScopes = Array.isArray(scope) && scope.length > 0;\n let scopedPackages: string[] | undefined = undefined;\n let filteredPackages: string[] | undefined = undefined;\n let changedPackages: string[] | undefined = undefined;\n const hasSince = typeof since !== \"undefined\";\n\n // If scope is defined, get scoped packages and return\n if (hasScopes) {\n scopedPackages = getScopedPackages(scope!, packageInfos);\n // return filteredPackages;\n return filterPackages({\n logger,\n packageInfos,\n scopedPackages,\n changedPackages,\n includeDependencies,\n includeDependents,\n });\n }\n // If since is defined, get changed packages.\n else if (hasSince) {\n try {\n changedPackages = getChangedPackages(root
|
|
1
|
+
{"version":3,"sources":["../../src/filter/getFilteredPackages.ts"],"sourcesContent":["import type { PackageInfos } from \"workspace-tools\";\nimport { getScopedPackages, getChangedPackages, getTransitiveDependents, getTransitiveDependencies } from \"workspace-tools\";\n\nimport type { Logger } from \"@lage-run/logger\";\nimport { hasRepoChanged } from \"./hasRepoChanged.js\";\n\nexport function getFilteredPackages(options: {\n root: string;\n packageInfos: PackageInfos;\n logger: Logger;\n scope: string[] | undefined;\n since: string | undefined;\n sinceIgnoreGlobs: string[] | undefined;\n repoWideChanges: string[];\n includeDependents: boolean;\n includeDependencies: boolean;\n}): string[] {\n const { scope, since, sinceIgnoreGlobs, repoWideChanges, includeDependents, includeDependencies, logger, packageInfos, root } = options;\n\n // If scoped is defined, get scoped packages\n const hasScopes = Array.isArray(scope) && scope.length > 0;\n let scopedPackages: string[] | undefined = undefined;\n let filteredPackages: string[] | undefined = undefined;\n let changedPackages: string[] | undefined = undefined;\n const hasSince = typeof since !== \"undefined\";\n\n // If scope is defined, get scoped packages and return\n if (hasScopes) {\n scopedPackages = getScopedPackages(scope!, packageInfos);\n // return filteredPackages;\n return filterPackages({\n logger,\n packageInfos,\n scopedPackages,\n changedPackages,\n includeDependencies,\n includeDependents,\n });\n }\n // If since is defined, get changed packages.\n else if (hasSince) {\n try {\n changedPackages = getChangedPackages({\n cwd: root,\n target: since,\n ignoreGlobs: sinceIgnoreGlobs,\n });\n } catch (e) {\n logger.warn(`An error in the git command has caused this scope run to include every package\\n${e}`);\n // if getChangedPackages throws, we will assume all have changed (using changedPackage = undefined)\n }\n filteredPackages = filterPackages({\n logger,\n packageInfos,\n scopedPackages,\n changedPackages,\n includeDependencies,\n includeDependents,\n });\n\n // If the defined repo-wide changes are detected the get all packages and append to the filtered packages.\n // This alo ensures that the modified packages are always run first.\n if (hasRepoChanged({ since, root, environmentGlob: repoWideChanges, logger })) {\n logger.verbose(\n `Repo-wide changes detected, running all packages. The following changed packages and their deps (if specified) will be run first: ${filteredPackages.join(\n \",\"\n )}`\n );\n filteredPackages = [...new Set(filteredPackages.concat(Object.keys(packageInfos)))];\n }\n return filteredPackages;\n } else {\n // If neither scope or since is defined, return all packages\n return Object.keys(packageInfos);\n }\n}\n\nexport function filterPackages(options: {\n logger: Logger;\n packageInfos: PackageInfos;\n includeDependents: boolean;\n includeDependencies: boolean;\n scopedPackages: string[] | undefined;\n changedPackages: string[] | undefined;\n}): string[] {\n const { scopedPackages, changedPackages, packageInfos, includeDependents, includeDependencies, logger } = options;\n\n let filtered: string[] = [];\n\n // If scope is defined, use the transitive providers of the since packages up to the scope\n if (typeof scopedPackages !== \"undefined\" && typeof changedPackages !== \"undefined\") {\n // If both scoped and since are specified, we have to merge two lists:\n // 1. changed packages that ARE themselves the scoped packages\n // 2. changed package consumers (package dependents) that are within the scoped subgraph\n filtered = changedPackages\n .filter((pkg) => scopedPackages.includes(pkg))\n .concat(getTransitiveDependents(changedPackages, packageInfos, scopedPackages));\n\n logger.verbose(`filterPackages changed within scope: ${filtered.join(\",\")}`);\n } else if (typeof changedPackages !== \"undefined\") {\n filtered = [...changedPackages];\n logger.verbose(`filterPackages changed: ${changedPackages.join(\",\")}`);\n } else if (typeof scopedPackages !== \"undefined\") {\n filtered = [...scopedPackages];\n logger.verbose(`filterPackages scope: ${scopedPackages.join(\",\")}`);\n } else {\n filtered = Object.keys(packageInfos);\n }\n\n // adds dependents (consumers) of all filtered package thus far\n if (includeDependents) {\n logger.verbose(`filterPackages running with dependents`);\n filtered = filtered.concat(getTransitiveDependents(filtered, packageInfos));\n }\n\n // adds dependencies of all filtered package thus far\n if (includeDependencies) {\n logger.verbose(`filterPackages running with dependencies`);\n filtered = filtered.concat(getTransitiveDependencies(filtered, packageInfos));\n }\n\n const unique = new Set(filtered);\n\n return [...unique];\n}\n"],"names":["filterPackages","getFilteredPackages","options","scope","since","sinceIgnoreGlobs","repoWideChanges","includeDependents","includeDependencies","logger","packageInfos","root","hasScopes","Array","isArray","length","scopedPackages","undefined","filteredPackages","changedPackages","hasSince","getScopedPackages","getChangedPackages","cwd","target","ignoreGlobs","e","warn","hasRepoChanged","environmentGlob","verbose","join","Set","concat","Object","keys","filtered","filter","pkg","includes","getTransitiveDependents","getTransitiveDependencies","unique"],"mappings":";;;;;;;;;;;QA6EgBA;eA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@@
|
|
|
1
1
|
import type { Logger } from "@lage-run/logger";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Check whether any `environmentGlob` files have changed since the `--since` ref.
|
|
4
|
+
* If `environmentGlob` is empty, it returns false.
|
|
5
|
+
*/
|
|
6
|
+
export declare function hasRepoChanged(params: {
|
|
7
|
+
/** `--since` CLI arg */
|
|
8
|
+
since: string;
|
|
9
|
+
/** Absolute path to monorepo root */
|
|
10
|
+
root: string;
|
|
11
|
+
/** `environmentGlob` from cache config */
|
|
12
|
+
environmentGlob: string[];
|
|
13
|
+
logger: Logger;
|
|
14
|
+
}): boolean;
|
|
@@ -51,22 +51,24 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
51
51
|
}
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
|
-
function hasRepoChanged(
|
|
54
|
+
function hasRepoChanged(params) {
|
|
55
|
+
const { since, root, environmentGlob, logger } = params;
|
|
56
|
+
if (!environmentGlob.length) {
|
|
57
|
+
// Following old logic: if no environmentGlob, it hasn't changed
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
55
60
|
try {
|
|
56
|
-
const changedFiles = (0, _workspacetools.getBranchChanges)(
|
|
57
|
-
|
|
61
|
+
const changedFiles = (0, _workspacetools.getBranchChanges)({
|
|
62
|
+
branch: since,
|
|
58
63
|
cwd: root
|
|
59
64
|
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
for (const change of changedFiles){
|
|
63
|
-
if (envFiles.includes(change)) {
|
|
64
|
-
repoWideChanged = true;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
65
|
+
if (!changedFiles.length) {
|
|
66
|
+
return false;
|
|
68
67
|
}
|
|
69
|
-
|
|
68
|
+
const envFiles = _fastglob.sync(environmentGlob, {
|
|
69
|
+
cwd: root
|
|
70
|
+
});
|
|
71
|
+
return envFiles.some((envFile)=>changedFiles.includes(envFile));
|
|
70
72
|
} catch (e) {
|
|
71
73
|
// if this fails, let's assume repo has changed
|
|
72
74
|
logger.warn(`An error in the git command has caused this to consider the repo has changed\n${e}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/filter/hasRepoChanged.ts"],"sourcesContent":["import { getBranchChanges } from \"workspace-tools\";\nimport * as fg from \"fast-glob\";\nimport type { Logger } from \"@lage-run/logger\";\n\nexport function hasRepoChanged(since: string
|
|
1
|
+
{"version":3,"sources":["../../src/filter/hasRepoChanged.ts"],"sourcesContent":["import { getBranchChanges } from \"workspace-tools\";\nimport * as fg from \"fast-glob\";\nimport type { Logger } from \"@lage-run/logger\";\n\n/**\n * Check whether any `environmentGlob` files have changed since the `--since` ref.\n * If `environmentGlob` is empty, it returns false.\n */\nexport function hasRepoChanged(params: {\n /** `--since` CLI arg */\n since: string;\n /** Absolute path to monorepo root */\n root: string;\n /** `environmentGlob` from cache config */\n environmentGlob: string[];\n logger: Logger;\n}): boolean {\n const { since, root, environmentGlob, logger } = params;\n\n if (!environmentGlob.length) {\n // Following old logic: if no environmentGlob, it hasn't changed\n return false;\n }\n\n try {\n const changedFiles = getBranchChanges({\n branch: since,\n cwd: root,\n });\n if (!changedFiles.length) {\n return false;\n }\n\n const envFiles = fg.sync(environmentGlob, { cwd: root });\n\n return envFiles.some((envFile) => changedFiles.includes(envFile));\n } catch (e) {\n // if this fails, let's assume repo has changed\n logger.warn(`An error in the git command has caused this to consider the repo has changed\\n${e}`);\n return true;\n }\n}\n"],"names":["hasRepoChanged","params","since","root","environmentGlob","logger","length","changedFiles","getBranchChanges","branch","cwd","envFiles","fg","sync","some","envFile","includes","e","warn"],"mappings":";;;;+BAQgBA;;;eAAAA;;;gCARiB;kEACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOb,SAASA,eAAeC,MAQ9B;IACC,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,eAAe,EAAEC,MAAM,EAAE,GAAGJ;IAEjD,IAAI,CAACG,gBAAgBE,MAAM,EAAE;QAC3B,gEAAgE;QAChE,OAAO;IACT;IAEA,IAAI;QACF,MAAMC,eAAeC,IAAAA,gCAAgB,EAAC;YACpCC,QAAQP;YACRQ,KAAKP;QACP;QACA,IAAI,CAACI,aAAaD,MAAM,EAAE;YACxB,OAAO;QACT;QAEA,MAAMK,WAAWC,UAAGC,IAAI,CAACT,iBAAiB;YAAEM,KAAKP;QAAK;QAEtD,OAAOQ,SAASG,IAAI,CAAC,CAACC,UAAYR,aAAaS,QAAQ,CAACD;IAC1D,EAAE,OAAOE,GAAG;QACV,+CAA+C;QAC/CZ,OAAOa,IAAI,CAAC,CAAC,8EAA8E,EAAED,GAAG;QAChG,OAAO;IACT;AACF"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export type { CacheOptions, ConfigFileOptions, ConfigOptions, LoggerOptions, PipelineDefinition
|
|
1
|
+
export type { CacheOptions, ConfigFileOptions, ConfigOptions, LoggerOptions, PipelineDefinition } from "@lage-run/config";
|
|
2
|
+
export type { Reporter, LogLevel, LogEntry, LogStructuredData } from "@lage-run/logger";
|
|
2
3
|
export type { NpmScriptRunnerOptions, NpmScriptTargetOptions, TargetRunnerPickerOptions, TargetRunOptions, TargetRunResult, WorkerRunnerFunction, WorkerRunnerFunctionOptions, WorkerRunnerOptions, WorkerTargetOptions, } from "@lage-run/runners";
|
|
3
|
-
export type { Target, TargetConfig } from "@lage-run/target-graph";
|
|
4
|
+
export type { Priority, Target, TargetConfig } from "@lage-run/target-graph";
|
|
5
|
+
export type { ReporterInitOptions } from "./types/ReporterInitOptions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { InfoResult } from "./commands/info/action.js";
|
package/lib/internal.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -13,7 +13,7 @@ async function optimizeTargetGraph(graph, runnerPicker, createBackCompatGraph) {
|
|
|
13
13
|
const targetMinimizedNodes = await (0, _targetgraph.removeNodes)([
|
|
14
14
|
...graph.targets.values()
|
|
15
15
|
], async (target)=>{
|
|
16
|
-
if (target.type ===
|
|
16
|
+
if (target.type === _targetgraph.builtInTargetTypes.noop) {
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
19
19
|
if (target.id === (0, _targetgraph.getStartTargetId)()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/optimizeTargetGraph.ts"],"sourcesContent":["import type { TargetRunnerPicker } from \"@lage-run/runners\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/optimizeTargetGraph.ts"],"sourcesContent":["import type { TargetRunnerPicker } from \"@lage-run/runners\";\nimport {\n type TargetGraph,\n removeNodes,\n transitiveReduction,\n getStartTargetId,\n type Target,\n builtInTargetTypes,\n} from \"@lage-run/target-graph\";\n\nexport async function optimizeTargetGraph(\n graph: TargetGraph,\n runnerPicker: TargetRunnerPicker,\n createBackCompatGraph: boolean\n): Promise<Target[]> {\n const targetMinimizedNodes = await removeNodes([...graph.targets.values()], async (target) => {\n if (target.type === builtInTargetTypes.noop) {\n return true;\n }\n\n if (target.id === getStartTargetId()) {\n return createBackCompatGraph;\n }\n\n const runner = await runnerPicker.pick(target);\n if (await runner.shouldRun(target)) {\n return false;\n }\n\n return true;\n });\n\n if (createBackCompatGraph) {\n return targetMinimizedNodes;\n }\n\n const reduced = transitiveReduction(targetMinimizedNodes);\n\n // Update the dependents of nodes based on the new set of dependencies\n // first build up a dependency map for quick lookup\n const dependencyMap = new Map<string, Set<string>>();\n for (const node of reduced) {\n for (const depId of node.dependencies) {\n if (!dependencyMap.has(depId)) {\n dependencyMap.set(depId, new Set<string>());\n }\n dependencyMap.get(depId)!.add(node.id);\n }\n }\n\n // update the dependents of each node\n for (const node of reduced) {\n const dependents = new Set<string>();\n if (dependencyMap.has(node.id)) {\n dependencyMap.get(node.id)!.forEach((dependentId) => dependents.add(dependentId));\n }\n\n node.dependents = Array.from(dependents);\n }\n\n return reduced;\n}\n"],"names":["optimizeTargetGraph","graph","runnerPicker","createBackCompatGraph","targetMinimizedNodes","removeNodes","targets","values","target","type","builtInTargetTypes","noop","id","getStartTargetId","runner","pick","shouldRun","reduced","transitiveReduction","dependencyMap","Map","node","depId","dependencies","has","set","Set","get","add","dependents","forEach","dependentId","Array","from"],"mappings":";;;;+BAUsBA;;;eAAAA;;;6BAFf;AAEA,eAAeA,oBACpBC,KAAkB,EAClBC,YAAgC,EAChCC,qBAA8B;IAE9B,MAAMC,uBAAuB,MAAMC,IAAAA,wBAAW,EAAC;WAAIJ,MAAMK,OAAO,CAACC,MAAM;KAAG,EAAE,OAAOC;QACjF,IAAIA,OAAOC,IAAI,KAAKC,+BAAkB,CAACC,IAAI,EAAE;YAC3C,OAAO;QACT;QAEA,IAAIH,OAAOI,EAAE,KAAKC,IAAAA,6BAAgB,KAAI;YACpC,OAAOV;QACT;QAEA,MAAMW,SAAS,MAAMZ,aAAaa,IAAI,CAACP;QACvC,IAAI,MAAMM,OAAOE,SAAS,CAACR,SAAS;YAClC,OAAO;QACT;QAEA,OAAO;IACT;IAEA,IAAIL,uBAAuB;QACzB,OAAOC;IACT;IAEA,MAAMa,UAAUC,IAAAA,gCAAmB,EAACd;IAEpC,sEAAsE;IACtE,mDAAmD;IACnD,MAAMe,gBAAgB,IAAIC;IAC1B,KAAK,MAAMC,QAAQJ,QAAS;QAC1B,KAAK,MAAMK,SAASD,KAAKE,YAAY,CAAE;YACrC,IAAI,CAACJ,cAAcK,GAAG,CAACF,QAAQ;gBAC7BH,cAAcM,GAAG,CAACH,OAAO,IAAII;YAC/B;YACAP,cAAcQ,GAAG,CAACL,OAAQM,GAAG,CAACP,KAAKT,EAAE;QACvC;IACF;IAEA,qCAAqC;IACrC,KAAK,MAAMS,QAAQJ,QAAS;QAC1B,MAAMY,aAAa,IAAIH;QACvB,IAAIP,cAAcK,GAAG,CAACH,KAAKT,EAAE,GAAG;YAC9BO,cAAcQ,GAAG,CAACN,KAAKT,EAAE,EAAGkB,OAAO,CAAC,CAACC,cAAgBF,WAAWD,GAAG,CAACG;QACtE;QAEAV,KAAKQ,UAAU,GAAGG,MAAMC,IAAI,CAACJ;IAC/B;IAEA,OAAOZ;AACT"}
|
|
@@ -7,6 +7,10 @@ export type ReporterName = BuiltInReporterName | string;
|
|
|
7
7
|
export declare const builtInReporterNames: string[];
|
|
8
8
|
/** Built-in reporter names that should be listed in doc output */
|
|
9
9
|
export declare const logBuiltInReporterNames: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Options for initializing reporters.
|
|
12
|
+
* This is also passed to the constructor of a custom reporter class.
|
|
13
|
+
*/
|
|
10
14
|
export interface ReporterInitOptions {
|
|
11
15
|
reporter: ReporterName[] | ReporterName | undefined;
|
|
12
16
|
progress: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/ReporterInitOptions.ts"],"sourcesContent":["import type { LogLevel } from \"@lage-run/logger\";\n\n/** All the built-in reporter names */\nexport type BuiltInReporterName =\n | \"default\"\n | \"profile\"\n | \"json\"\n | \"azureDevops\"\n | \"adoLog\"\n | \"githubActions\"\n | \"gha\"\n | \"npmLog\"\n | \"old\"\n | \"verboseFileLog\"\n | \"vfl\"\n | \"fancy\";\n/** Built-in or custom reporter name */\nexport type ReporterName = BuiltInReporterName | string;\n\n/** Whether each built-in reporter name should be listed in doc output */\nconst shouldListBuiltInReporters: Record<BuiltInReporterName, boolean> = {\n json: true,\n azureDevops: true,\n npmLog: true,\n verboseFileLog: true,\n vfl: true,\n adoLog: true,\n githubActions: true,\n gha: true,\n fancy: true,\n default: true,\n // Not encouraged\n old: false,\n // Intended to be set via --profile\n profile: false,\n};\n\n/** All the built-in reporter names */\nexport const builtInReporterNames: string[] = Object.keys(shouldListBuiltInReporters);\n\n/** Built-in reporter names that should be listed in doc output */\nexport const logBuiltInReporterNames: string[] = builtInReporterNames.filter(\n (name) => shouldListBuiltInReporters[name as BuiltInReporterName]\n);\n\nexport interface ReporterInitOptions {\n reporter: ReporterName[] | ReporterName | undefined;\n progress: boolean;\n verbose: boolean;\n grouped: boolean;\n concurrency: number;\n logLevel: keyof typeof LogLevel;\n profile?: boolean | string;\n logFile?: string;\n indented?: boolean;\n}\n"],"names":["builtInReporterNames","logBuiltInReporterNames","shouldListBuiltInReporters","json","azureDevops","npmLog","verboseFileLog","vfl","adoLog","githubActions","gha","fancy","default","old","profile","Object","keys","filter","name"],"mappings":";;;;;;;;;;;QAsCaA;eAAAA;;QAGAC;eAAAA;;;AAtBb,uEAAuE,GACvE,MAAMC,6BAAmE;IACvEC,MAAM;IACNC,aAAa;IACbC,QAAQ;IACRC,gBAAgB;IAChBC,KAAK;IACLC,QAAQ;IACRC,eAAe;IACfC,KAAK;IACLC,OAAO;IACPC,SAAS;IACT,iBAAiB;IACjBC,KAAK;IACL,mCAAmC;IACnCC,SAAS;AACX;AAGO,MAAMd,uBAAiCe,OAAOC,IAAI,CAACd;AAGnD,MAAMD,0BAAoCD,qBAAqBiB,MAAM,CAC1E,CAACC,OAAShB,0BAA0B,CAACgB,KAA4B"}
|
|
1
|
+
{"version":3,"sources":["../../src/types/ReporterInitOptions.ts"],"sourcesContent":["import type { LogLevel } from \"@lage-run/logger\";\n\n/** All the built-in reporter names */\nexport type BuiltInReporterName =\n | \"default\"\n | \"profile\"\n | \"json\"\n | \"azureDevops\"\n | \"adoLog\"\n | \"githubActions\"\n | \"gha\"\n | \"npmLog\"\n | \"old\"\n | \"verboseFileLog\"\n | \"vfl\"\n | \"fancy\";\n/** Built-in or custom reporter name */\nexport type ReporterName = BuiltInReporterName | string;\n\n/** Whether each built-in reporter name should be listed in doc output */\nconst shouldListBuiltInReporters: Record<BuiltInReporterName, boolean> = {\n json: true,\n azureDevops: true,\n npmLog: true,\n verboseFileLog: true,\n vfl: true,\n adoLog: true,\n githubActions: true,\n gha: true,\n fancy: true,\n default: true,\n // Not encouraged\n old: false,\n // Intended to be set via --profile\n profile: false,\n};\n\n/** All the built-in reporter names */\nexport const builtInReporterNames: string[] = Object.keys(shouldListBuiltInReporters);\n\n/** Built-in reporter names that should be listed in doc output */\nexport const logBuiltInReporterNames: string[] = builtInReporterNames.filter(\n (name) => shouldListBuiltInReporters[name as BuiltInReporterName]\n);\n\n/**\n * Options for initializing reporters.\n * This is also passed to the constructor of a custom reporter class.\n */\nexport interface ReporterInitOptions {\n reporter: ReporterName[] | ReporterName | undefined;\n progress: boolean;\n verbose: boolean;\n grouped: boolean;\n concurrency: number;\n logLevel: keyof typeof LogLevel;\n profile?: boolean | string;\n logFile?: string;\n indented?: boolean;\n}\n"],"names":["builtInReporterNames","logBuiltInReporterNames","shouldListBuiltInReporters","json","azureDevops","npmLog","verboseFileLog","vfl","adoLog","githubActions","gha","fancy","default","old","profile","Object","keys","filter","name"],"mappings":";;;;;;;;;;;QAsCaA;eAAAA;;QAGAC;eAAAA;;;AAtBb,uEAAuE,GACvE,MAAMC,6BAAmE;IACvEC,MAAM;IACNC,aAAa;IACbC,QAAQ;IACRC,gBAAgB;IAChBC,KAAK;IACLC,QAAQ;IACRC,eAAe;IACfC,KAAK;IACLC,OAAO;IACPC,SAAS;IACT,iBAAiB;IACjBC,KAAK;IACL,mCAAmC;IACnCC,SAAS;AACX;AAGO,MAAMd,uBAAiCe,OAAOC,IAAI,CAACd;AAGnD,MAAMD,0BAAoCD,qBAAqBiB,MAAM,CAC1E,CAACC,OAAShB,0BAA0B,CAACgB,KAA4B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Command Line Interface for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,19 +22,19 @@
|
|
|
22
22
|
"lint": "monorepo-scripts lint"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@lage-run/cache": "^1.4.
|
|
26
|
-
"@lage-run/config": "^0.9.
|
|
27
|
-
"@lage-run/format-hrtime": "^0.1.
|
|
25
|
+
"@lage-run/cache": "^1.4.9",
|
|
26
|
+
"@lage-run/config": "^0.9.2",
|
|
27
|
+
"@lage-run/format-hrtime": "^0.1.9",
|
|
28
28
|
"@lage-run/globby": "^13.0.1",
|
|
29
|
-
"@lage-run/hasher": "^1.9.
|
|
29
|
+
"@lage-run/hasher": "^1.9.6",
|
|
30
30
|
"@lage-run/logger": "^1.3.3",
|
|
31
|
-
"@lage-run/reporters": "^1.
|
|
32
|
-
"@lage-run/rpc": "^1.4.
|
|
33
|
-
"@lage-run/runners": "^1.
|
|
34
|
-
"@lage-run/scheduler": "^1.5.
|
|
35
|
-
"@lage-run/scheduler-types": "^0.3.
|
|
36
|
-
"@lage-run/target-graph": "^0.
|
|
37
|
-
"@lage-run/worker-threads-pool": "^0.9.
|
|
31
|
+
"@lage-run/reporters": "^1.5.1",
|
|
32
|
+
"@lage-run/rpc": "^1.4.4",
|
|
33
|
+
"@lage-run/runners": "^1.4.1",
|
|
34
|
+
"@lage-run/scheduler": "^1.5.21",
|
|
35
|
+
"@lage-run/scheduler-types": "^0.3.32",
|
|
36
|
+
"@lage-run/target-graph": "^0.14.1",
|
|
37
|
+
"@lage-run/worker-threads-pool": "^0.9.4",
|
|
38
38
|
"chokidar": "^3.6.0",
|
|
39
39
|
"commander": "^9.5.0",
|
|
40
40
|
"execa": "^5.1.1",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"is-interactive": "^1.0.0",
|
|
43
43
|
"proper-lockfile": "^4.1.2",
|
|
44
44
|
"shell-quote": "^1.8.3",
|
|
45
|
-
"workspace-tools": "^0.41.
|
|
45
|
+
"workspace-tools": "^0.41.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@lage-run/monorepo-fixture": "^0.1.0",
|
|
49
48
|
"@lage-run/monorepo-scripts": "^1.0.0",
|
|
49
|
+
"@lage-run/test-utilities": "^0.1.0",
|
|
50
50
|
"@types/proper-lockfile": "^4.1.4",
|
|
51
51
|
"@types/shell-quote": "^1.7.5"
|
|
52
52
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isRunningFromCI: boolean;
|
|
@@ -1,11 +0,0 @@
|
|
|
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);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cache/isRunningFromCI.ts"],"sourcesContent":["export const isRunningFromCI: boolean = process.env.NODE_ENV !== \"test\" && (!!process.env.CI || !!process.env.TF_BUILD);\n"],"names":["isRunningFromCI","process","env","NODE_ENV","CI","TF_BUILD"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,kBAA2BC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAW,CAAA,CAAC,CAACF,QAAQC,GAAG,CAACE,EAAE,IAAI,CAAC,CAACH,QAAQC,GAAG,CAACG,QAAQ,AAAD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isRunningFromCI: boolean;
|
|
@@ -1,11 +0,0 @@
|
|
|
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);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/isRunningFromCI.ts"],"sourcesContent":["export const isRunningFromCI: boolean = process.env.NODE_ENV !== \"test\" && (!!process.env.CI || !!process.env.TF_BUILD);\n"],"names":["isRunningFromCI","process","env","NODE_ENV","CI","TF_BUILD"],"mappings":";;;;+BAAaA;;;eAAAA;;;AAAN,MAAMA,kBAA2BC,QAAQC,GAAG,CAACC,QAAQ,KAAK,UAAW,CAAA,CAAC,CAACF,QAAQC,GAAG,CAACE,EAAE,IAAI,CAAC,CAACH,QAAQC,GAAG,CAACG,QAAQ,AAAD"}
|