@lage-run/config 0.4.7 → 0.4.8
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 +22 -1
- package/CHANGELOG.md +11 -2
- package/lib/getConcurrency.js.map +1 -0
- package/lib/getConfig.js.map +1 -0
- package/lib/getMaxWorkersPerTask.js.map +1 -0
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -0
- package/lib/readConfigFile.js.map +1 -0
- package/lib/types/CacheOptions.js.map +1 -0
- package/lib/types/ConfigOptions.js.map +1 -0
- package/lib/types/LoggerOptions.js.map +1 -0
- package/lib/types/PipelineDefinition.js.map +1 -0
- package/lib/types/Priority.js.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "@lage-run/config",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Fri,
|
|
5
|
+
"date": "Fri, 08 Nov 2024 19:44:39 GMT",
|
|
6
|
+
"version": "0.4.8",
|
|
7
|
+
"tag": "@lage-run/config_v0.4.8",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@lage-run/config",
|
|
13
|
+
"comment": "Bump @lage-run/runners to v1.1.0",
|
|
14
|
+
"commit": "not available"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/config",
|
|
19
|
+
"comment": "Bump @lage-run/target-graph to v0.10.0",
|
|
20
|
+
"commit": "not available"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Fri, 01 Nov 2024 08:07:38 GMT",
|
|
6
27
|
"version": "0.4.7",
|
|
7
28
|
"tag": "@lage-run/config_v0.4.7",
|
|
8
29
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @lage-run/config
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on Fri,
|
|
3
|
+
<!-- This log was last generated on Fri, 08 Nov 2024 19:44:39 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.4.8
|
|
8
|
+
|
|
9
|
+
Fri, 08 Nov 2024 19:44:39 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @lage-run/runners to v1.1.0
|
|
14
|
+
- Bump @lage-run/target-graph to v0.10.0
|
|
15
|
+
|
|
7
16
|
## 0.4.7
|
|
8
17
|
|
|
9
|
-
Fri, 01 Nov 2024 08:07:
|
|
18
|
+
Fri, 01 Nov 2024 08:07:38 GMT
|
|
10
19
|
|
|
11
20
|
### Patches
|
|
12
21
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/getConcurrency.ts"],"sourcesContent":["import os from \"os\";\n\nexport function getConcurrency(optionsConcurrency: number | undefined, configConcurrency: number | undefined): number {\n return optionsConcurrency || configConcurrency || os.cpus().length - 1;\n}\n"],"names":["getConcurrency","optionsConcurrency","configConcurrency","os","cpus","length"],"mappings":";;;;+BAEgBA;;;eAAAA;;;2DAFD;;;;;;AAER,SAASA,eAAeC,kBAAsC,EAAEC,iBAAqC;IAC1G,OAAOD,sBAAsBC,qBAAqBC,WAAE,CAACC,IAAI,GAAGC,MAAM,GAAG;AACvE"}
|
|
@@ -0,0 +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 };\n}\n"],"names":["getConfig","cwd","config","readConfigFile","availableParallelism","os","cpus","length","cacheOptions","ignore","npmClient","pipeline","priorities","repoWideChanges","loggerOptions","runners","workerIdleMemoryLimit","totalmem","concurrency","allowNoTargetRuns"],"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;IAClD;AACF"}
|
|
@@ -0,0 +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) {\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 = taskConfig.maxWorkers ?? 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[]) {\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":";;;;;;;;;;;IAEgBA,oBAAoB;eAApBA;;IA0DAC,+BAA+B;eAA/BA;;;AA1DT,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,kBAAsCN,WAAWO,UAAU,IAAIP,WAAWQ,OAAO,EAAED;YAEzF,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"}
|
package/lib/index.js
CHANGED
|
@@ -9,12 +9,12 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
getConfig: function() {
|
|
13
|
-
return _getConfig.getConfig;
|
|
14
|
-
},
|
|
15
12
|
getConcurrency: function() {
|
|
16
13
|
return _getConcurrency.getConcurrency;
|
|
17
14
|
},
|
|
15
|
+
getConfig: function() {
|
|
16
|
+
return _getConfig.getConfig;
|
|
17
|
+
},
|
|
18
18
|
getMaxWorkersPerTask: function() {
|
|
19
19
|
return _getMaxWorkersPerTask.getMaxWorkersPerTask;
|
|
20
20
|
},
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { getConfig } from \"./getConfig.js\";\nexport { getConcurrency } from \"./getConcurrency.js\";\nexport { getMaxWorkersPerTask, getMaxWorkersPerTaskFromOptions } from \"./getMaxWorkersPerTask.js\";\nexport { readConfigFile } from \"./readConfigFile.js\";\nexport type { PipelineDefinition } from \"./types/PipelineDefinition.js\";\nexport type { ConfigOptions } from \"./types/ConfigOptions.js\";\nexport type { CacheOptions } from \"./types/CacheOptions.js\";\nexport type { LoggerOptions } from \"./types/LoggerOptions.js\";\nexport type { Priority } from \"./types/Priority.js\";\n"],"names":["getConcurrency","getConfig","getMaxWorkersPerTask","getMaxWorkersPerTaskFromOptions","readConfigFile"],"mappings":";;;;;;;;;;;IACSA,cAAc;eAAdA,8BAAc;;IADdC,SAAS;eAATA,oBAAS;;IAETC,oBAAoB;eAApBA,0CAAoB;;IAAEC,+BAA+B;eAA/BA,qDAA+B;;IACrDC,cAAc;eAAdA,8BAAc;;;2BAHG;gCACK;sCACuC;gCACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/readConfigFile.ts"],"sourcesContent":["import { cosmiconfig } from \"cosmiconfig\";\nimport { getWorkspaceRoot } from \"workspace-tools\";\nimport type { ConfigOptions } from \"./types/ConfigOptions.js\";\n\nconst ConfigModuleName = \"lage\";\n\n/**\n * Read the lage config file if it exists, without filling in defaults.\n */\nexport async function readConfigFile(cwd: string): Promise<ConfigOptions | undefined> {\n // Verify presence of git\n const root = getWorkspaceRoot(cwd);\n if (!root) {\n throw new Error(\"This must be called inside a codebase that is part of a JavaScript workspace.\");\n }\n\n // Search for lage.config.js file\n const configExplorer = await cosmiconfig(ConfigModuleName);\n const results = await configExplorer.search(root ?? cwd);\n return results?.config || undefined;\n}\n"],"names":["readConfigFile","ConfigModuleName","cwd","root","getWorkspaceRoot","Error","configExplorer","cosmiconfig","results","search","config","undefined"],"mappings":";;;;+BASsBA;;;eAAAA;;;6BATM;gCACK;AAGjC,MAAMC,mBAAmB;AAKlB,eAAeD,eAAeE,GAAW;IAC9C,yBAAyB;IACzB,MAAMC,OAAOC,IAAAA,gCAAgB,EAACF;IAC9B,IAAI,CAACC,MAAM;QACT,MAAM,IAAIE,MAAM;IAClB;IAEA,iCAAiC;IACjC,MAAMC,iBAAiB,MAAMC,IAAAA,wBAAW,EAACN;IACzC,MAAMO,UAAU,MAAMF,eAAeG,MAAM,CAACN,QAAQD;IACpD,OAAOM,SAASE,UAAUC;AAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/config",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Config management for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@lage-run/logger": "^1.3.1",
|
|
24
|
-
"@lage-run/runners": "^1.0
|
|
25
|
-
"@lage-run/target-graph": "^0.
|
|
24
|
+
"@lage-run/runners": "^1.1.0",
|
|
25
|
+
"@lage-run/target-graph": "^0.10.0",
|
|
26
26
|
"backfill-config": "6.4.2",
|
|
27
27
|
"cosmiconfig": "7.1.0",
|
|
28
28
|
"workspace-tools": "0.37.0"
|