@lage-run/config 0.7.3 → 0.9.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/getConfig.js
CHANGED
|
@@ -26,6 +26,8 @@ async function getConfig(cwd) {
|
|
|
26
26
|
priorities: config?.priorities ?? [],
|
|
27
27
|
repoWideChanges: config?.repoWideChanges ?? [
|
|
28
28
|
"lage.config.js",
|
|
29
|
+
"lage.config.mjs",
|
|
30
|
+
"lage.config.cjs",
|
|
29
31
|
"package-lock.json",
|
|
30
32
|
"yarn.lock",
|
|
31
33
|
"pnpm-lock.yaml",
|
|
@@ -38,6 +40,7 @@ async function getConfig(cwd) {
|
|
|
38
40
|
concurrency: config?.concurrency ?? availableParallelism,
|
|
39
41
|
allowNoTargetRuns: config?.allowNoTargetRuns ?? false,
|
|
40
42
|
enableTargetConfigMerging: config?.enableTargetConfigMerging ?? false,
|
|
43
|
+
enablePhantomTargetOptimization: config?.enablePhantomTargetOptimization ?? false,
|
|
41
44
|
reporters: config?.reporters ?? {}
|
|
42
45
|
};
|
|
43
46
|
}
|
package/lib/getConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/getConfig.ts"],"sourcesContent":["import os from \"os\";\nimport { readConfigFile } from \"./readConfigFile.js\";\nimport type { ConfigOptions } from \"./types/ConfigOptions.js\";\nimport type { CacheOptions } from \"./types/CacheOptions.js\";\n\n/**\n * Get the lage config with defaults.\n */\nexport async function getConfig(cwd: string): Promise<ConfigOptions> {\n const config = (await readConfigFile(cwd)) || ({} as Partial<ConfigOptions>);\n const availableParallelism = \"availableParallelism\" in os ? (os as any)[\"availableParallelism\"]() : os.cpus().length - 1;\n return {\n cacheOptions: config?.cacheOptions ?? ({} as CacheOptions),\n ignore: config?.ignore ?? [],\n npmClient: config?.npmClient ?? \"npm\",\n pipeline: config?.pipeline ?? {},\n priorities: config?.priorities ?? [],\n repoWideChanges: config?.repoWideChanges ?? [\n \"lage.config.js\",\n \"package-lock.json\",\n \"yarn.lock\",\n \"pnpm-lock.yaml\",\n \"lerna.json\",\n \"rush.json\",\n ],\n loggerOptions: config?.loggerOptions ?? {},\n runners: config?.runners ?? {},\n workerIdleMemoryLimit: config?.workerIdleMemoryLimit ?? os.totalmem(), // 0 means no limit,\n concurrency: config?.concurrency ?? availableParallelism,\n allowNoTargetRuns: config?.allowNoTargetRuns ?? false,\n enableTargetConfigMerging: config?.enableTargetConfigMerging ?? false,\n reporters: config?.reporters ?? {},\n };\n}\n"],"names":["getConfig","cwd","config","readConfigFile","availableParallelism","os","cpus","length","cacheOptions","ignore","npmClient","pipeline","priorities","repoWideChanges","loggerOptions","runners","workerIdleMemoryLimit","totalmem","concurrency","allowNoTargetRuns","enableTargetConfigMerging","reporters"],"mappings":";;;;+BAQsBA;;;eAAAA;;;2DARP;gCACgB;;;;;;AAOxB,eAAeA,UAAUC,GAAW;IACzC,MAAMC,SAAS,AAAC,MAAMC,IAAAA,8BAAc,EAACF,QAAU,CAAC;IAChD,MAAMG,uBAAuB,0BAA0BC,WAAE,GAAG,AAACA,WAAE,AAAQ,CAAC,uBAAuB,KAAKA,WAAE,CAACC,IAAI,GAAGC,MAAM,GAAG;IACvH,OAAO;QACLC,cAAcN,QAAQM,gBAAiB,CAAC;QACxCC,QAAQP,QAAQO,UAAU,EAAE;QAC5BC,WAAWR,QAAQQ,aAAa;QAChCC,UAAUT,QAAQS,YAAY,CAAC;QAC/BC,YAAYV,QAAQU,cAAc,EAAE;QACpCC,iBAAiBX,QAAQW,mBAAmB;YAC1C;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,eAAeZ,QAAQY,iBAAiB,CAAC;QACzCC,SAASb,QAAQa,WAAW,CAAC;QAC7BC,uBAAuBd,QAAQc,yBAAyBX,WAAE,CAACY,QAAQ;QACnEC,aAAahB,QAAQgB,eAAed;QACpCe,mBAAmBjB,QAAQiB,qBAAqB;QAChDC,2BAA2BlB,QAAQkB,6BAA6B;QAChEC,
|
|
1
|
+
{"version":3,"sources":["../src/getConfig.ts"],"sourcesContent":["import os from \"os\";\nimport { readConfigFile } from \"./readConfigFile.js\";\nimport type { ConfigOptions } from \"./types/ConfigOptions.js\";\nimport type { CacheOptions } from \"./types/CacheOptions.js\";\n\n/**\n * Get the lage config with defaults.\n */\nexport async function getConfig(cwd: string): Promise<ConfigOptions> {\n const config = (await readConfigFile(cwd)) || ({} as Partial<ConfigOptions>);\n const availableParallelism = \"availableParallelism\" in os ? (os as any)[\"availableParallelism\"]() : os.cpus().length - 1;\n return {\n cacheOptions: config?.cacheOptions ?? ({} as CacheOptions),\n ignore: config?.ignore ?? [],\n npmClient: config?.npmClient ?? \"npm\",\n pipeline: config?.pipeline ?? {},\n priorities: config?.priorities ?? [],\n repoWideChanges: config?.repoWideChanges ?? [\n \"lage.config.js\",\n \"lage.config.mjs\",\n \"lage.config.cjs\",\n \"package-lock.json\",\n \"yarn.lock\",\n \"pnpm-lock.yaml\",\n \"lerna.json\",\n \"rush.json\",\n ],\n loggerOptions: config?.loggerOptions ?? {},\n runners: config?.runners ?? {},\n workerIdleMemoryLimit: config?.workerIdleMemoryLimit ?? os.totalmem(), // 0 means no limit,\n concurrency: config?.concurrency ?? availableParallelism,\n allowNoTargetRuns: config?.allowNoTargetRuns ?? false,\n enableTargetConfigMerging: config?.enableTargetConfigMerging ?? false,\n enablePhantomTargetOptimization: config?.enablePhantomTargetOptimization ?? false,\n reporters: config?.reporters ?? {},\n };\n}\n"],"names":["getConfig","cwd","config","readConfigFile","availableParallelism","os","cpus","length","cacheOptions","ignore","npmClient","pipeline","priorities","repoWideChanges","loggerOptions","runners","workerIdleMemoryLimit","totalmem","concurrency","allowNoTargetRuns","enableTargetConfigMerging","enablePhantomTargetOptimization","reporters"],"mappings":";;;;+BAQsBA;;;eAAAA;;;2DARP;gCACgB;;;;;;AAOxB,eAAeA,UAAUC,GAAW;IACzC,MAAMC,SAAS,AAAC,MAAMC,IAAAA,8BAAc,EAACF,QAAU,CAAC;IAChD,MAAMG,uBAAuB,0BAA0BC,WAAE,GAAG,AAACA,WAAE,AAAQ,CAAC,uBAAuB,KAAKA,WAAE,CAACC,IAAI,GAAGC,MAAM,GAAG;IACvH,OAAO;QACLC,cAAcN,QAAQM,gBAAiB,CAAC;QACxCC,QAAQP,QAAQO,UAAU,EAAE;QAC5BC,WAAWR,QAAQQ,aAAa;QAChCC,UAAUT,QAAQS,YAAY,CAAC;QAC/BC,YAAYV,QAAQU,cAAc,EAAE;QACpCC,iBAAiBX,QAAQW,mBAAmB;YAC1C;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACD;QACDC,eAAeZ,QAAQY,iBAAiB,CAAC;QACzCC,SAASb,QAAQa,WAAW,CAAC;QAC7BC,uBAAuBd,QAAQc,yBAAyBX,WAAE,CAACY,QAAQ;QACnEC,aAAahB,QAAQgB,eAAed;QACpCe,mBAAmBjB,QAAQiB,qBAAqB;QAChDC,2BAA2BlB,QAAQkB,6BAA6B;QAChEC,iCAAiCnB,QAAQmB,mCAAmC;QAC5EC,WAAWpB,QAAQoB,aAAa,CAAC;IACnC;AACF"}
|
|
@@ -24,7 +24,8 @@ function getMaxWorkersPerTask(pipelineConfig, concurrency) {
|
|
|
24
24
|
let dedicatedPoolMaxWorkers = 0;
|
|
25
25
|
for (const [task, taskConfig] of Object.entries(pipelineConfig)){
|
|
26
26
|
if (!Array.isArray(taskConfig) && !task.includes("#")) {
|
|
27
|
-
const maxWorkerOption = taskConfig.maxWorkers ??
|
|
27
|
+
const maxWorkerOption = taskConfig.maxWorkers ?? // deprecated usage--a "worker" target's options should only include WorkerTargetOptions props.
|
|
28
|
+
taskConfig.options?.maxWorkers;
|
|
28
29
|
if (typeof maxWorkerOption === "undefined") {
|
|
29
30
|
generalPoolCount++;
|
|
30
31
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/getMaxWorkersPerTask.ts"],"sourcesContent":["import type { ConfigOptions } from \"./types/ConfigOptions.js\";\n\nexport function getMaxWorkersPerTask(pipelineConfig: ConfigOptions[\"pipeline\"], concurrency: number): Map<string, number> {\n const maxWorkersPerTask = new Map<string, number>();\n\n let generalPoolCount = 0;\n let generatelPoolMaxWorkers = 0;\n\n let dedicatedPoolCount = 0;\n let dedicatedPoolMaxWorkers = 0;\n\n for (const [task, taskConfig] of Object.entries(pipelineConfig)) {\n if (!Array.isArray(taskConfig) && !task.includes(\"#\")) {\n const maxWorkerOption: number | undefined
|
|
1
|
+
{"version":3,"sources":["../src/getMaxWorkersPerTask.ts"],"sourcesContent":["import type { ConfigOptions } from \"./types/ConfigOptions.js\";\n\nexport function getMaxWorkersPerTask(pipelineConfig: ConfigOptions[\"pipeline\"], concurrency: number): Map<string, number> {\n const maxWorkersPerTask = new Map<string, number>();\n\n let generalPoolCount = 0;\n let generatelPoolMaxWorkers = 0;\n\n let dedicatedPoolCount = 0;\n let dedicatedPoolMaxWorkers = 0;\n\n for (const [task, taskConfig] of Object.entries(pipelineConfig)) {\n if (!Array.isArray(taskConfig) && !task.includes(\"#\")) {\n const maxWorkerOption: number | undefined =\n taskConfig.maxWorkers ??\n // deprecated usage--a \"worker\" target's options should only include WorkerTargetOptions props.\n taskConfig.options?.maxWorkers;\n\n if (typeof maxWorkerOption === \"undefined\") {\n generalPoolCount++;\n continue;\n }\n\n let maxWorkers = 0;\n\n if (typeof maxWorkerOption !== \"number\") {\n throw new Error(`Invalid maxWorkers value: ${maxWorkerOption}`);\n } else {\n maxWorkers = maxWorkerOption;\n }\n\n maxWorkersPerTask.set(task, maxWorkers);\n dedicatedPoolCount++;\n dedicatedPoolMaxWorkers += maxWorkers;\n }\n }\n\n if (dedicatedPoolCount > 0 && generalPoolCount > 0) {\n const avgMaxWorkers = dedicatedPoolMaxWorkers / dedicatedPoolCount;\n generatelPoolMaxWorkers = Math.max(1, Math.floor(avgMaxWorkers * generalPoolCount));\n }\n\n const grandTotal = dedicatedPoolMaxWorkers + generatelPoolMaxWorkers;\n\n // try to adjust the maxWorkersPerTask to fit the concurrency\n if (grandTotal > concurrency) {\n let newTotal = 0;\n for (const [task, maxWorkers] of maxWorkersPerTask.entries()) {\n const newMaxWorkers = Math.max(1, Math.floor((maxWorkers / grandTotal) * concurrency));\n newTotal += newMaxWorkers;\n maxWorkersPerTask.set(task, newMaxWorkers);\n }\n\n if (newTotal > concurrency) {\n throw new Error(\n \"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\"\n );\n }\n }\n\n return maxWorkersPerTask;\n}\n\nexport function getMaxWorkersPerTaskFromOptions(maxWorkersPerTask: string[]): Map<string, number> {\n return new Map([\n ...maxWorkersPerTask.map((setting) => {\n const [task, maxWorkers] = setting.split(/[=:]/);\n return [task, parseInt(maxWorkers, 10)] as [string, number];\n }),\n ]);\n}\n"],"names":["getMaxWorkersPerTask","getMaxWorkersPerTaskFromOptions","pipelineConfig","concurrency","maxWorkersPerTask","Map","generalPoolCount","generatelPoolMaxWorkers","dedicatedPoolCount","dedicatedPoolMaxWorkers","task","taskConfig","Object","entries","Array","isArray","includes","maxWorkerOption","maxWorkers","options","Error","set","avgMaxWorkers","Math","max","floor","grandTotal","newTotal","newMaxWorkers","map","setting","split","parseInt"],"mappings":";;;;;;;;;;;QAEgBA;eAAAA;;QA6DAC;eAAAA;;;AA7DT,SAASD,qBAAqBE,cAAyC,EAAEC,WAAmB;IACjG,MAAMC,oBAAoB,IAAIC;IAE9B,IAAIC,mBAAmB;IACvB,IAAIC,0BAA0B;IAE9B,IAAIC,qBAAqB;IACzB,IAAIC,0BAA0B;IAE9B,KAAK,MAAM,CAACC,MAAMC,WAAW,IAAIC,OAAOC,OAAO,CAACX,gBAAiB;QAC/D,IAAI,CAACY,MAAMC,OAAO,CAACJ,eAAe,CAACD,KAAKM,QAAQ,CAAC,MAAM;YACrD,MAAMC,kBACJN,WAAWO,UAAU,IACrB,+FAA+F;YAC/FP,WAAWQ,OAAO,EAAED;YAEtB,IAAI,OAAOD,oBAAoB,aAAa;gBAC1CX;gBACA;YACF;YAEA,IAAIY,aAAa;YAEjB,IAAI,OAAOD,oBAAoB,UAAU;gBACvC,MAAM,IAAIG,MAAM,CAAC,0BAA0B,EAAEH,iBAAiB;YAChE,OAAO;gBACLC,aAAaD;YACf;YAEAb,kBAAkBiB,GAAG,CAACX,MAAMQ;YAC5BV;YACAC,2BAA2BS;QAC7B;IACF;IAEA,IAAIV,qBAAqB,KAAKF,mBAAmB,GAAG;QAClD,MAAMgB,gBAAgBb,0BAA0BD;QAChDD,0BAA0BgB,KAAKC,GAAG,CAAC,GAAGD,KAAKE,KAAK,CAACH,gBAAgBhB;IACnE;IAEA,MAAMoB,aAAajB,0BAA0BF;IAE7C,6DAA6D;IAC7D,IAAImB,aAAavB,aAAa;QAC5B,IAAIwB,WAAW;QACf,KAAK,MAAM,CAACjB,MAAMQ,WAAW,IAAId,kBAAkBS,OAAO,GAAI;YAC5D,MAAMe,gBAAgBL,KAAKC,GAAG,CAAC,GAAGD,KAAKE,KAAK,CAAC,AAACP,aAAaQ,aAAcvB;YACzEwB,YAAYC;YACZxB,kBAAkBiB,GAAG,CAACX,MAAMkB;QAC9B;QAEA,IAAID,WAAWxB,aAAa;YAC1B,MAAM,IAAIiB,MACR;QAEJ;IACF;IAEA,OAAOhB;AACT;AAEO,SAASH,gCAAgCG,iBAA2B;IACzE,OAAO,IAAIC,IAAI;WACVD,kBAAkByB,GAAG,CAAC,CAACC;YACxB,MAAM,CAACpB,MAAMQ,WAAW,GAAGY,QAAQC,KAAK,CAAC;YACzC,OAAO;gBAACrB;gBAAMsB,SAASd,YAAY;aAAI;QACzC;KACD;AACH"}
|
|
@@ -70,6 +70,12 @@ export interface ConfigOptions {
|
|
|
70
70
|
* Enables the merging of target config files, rather than simply replace it when multiple matches are encoutered
|
|
71
71
|
*/
|
|
72
72
|
enableTargetConfigMerging: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Enables phantom target optimization. When enabled, targets created for packages that don't actually define
|
|
75
|
+
* the corresponding npm script are excluded from transitive (`^^`) dependency expansion.
|
|
76
|
+
* This prevents unwanted cross-package dependency chains when phantom targets are later removed.
|
|
77
|
+
*/
|
|
78
|
+
enablePhantomTargetOptimization: boolean;
|
|
73
79
|
/**
|
|
74
80
|
* Custom reporters that can be referenced by name in the --reporter CLI flag.
|
|
75
81
|
* The key is the reporter name, and the value is the path to the reporter module.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Config management for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@lage-run/logger": "^1.3.3",
|
|
22
|
-
"@lage-run/runners": "^1.
|
|
23
|
-
"@lage-run/target-graph": "^0.
|
|
22
|
+
"@lage-run/runners": "^1.3.1",
|
|
23
|
+
"@lage-run/target-graph": "^0.13.0",
|
|
24
24
|
"backfill-config": "^6.7.1",
|
|
25
|
-
"cosmiconfig": "^
|
|
25
|
+
"cosmiconfig": "^9.0.1",
|
|
26
26
|
"workspace-tools": "^0.41.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|