@lage-run/cli 0.24.1 → 0.24.2
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,40 @@
|
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 20 Nov 2024 02:43:24 GMT",
|
|
6
|
+
"version": "0.24.2",
|
|
7
|
+
"tag": "@lage-run/cli_v0.24.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/cli",
|
|
13
|
+
"commit": "d2ddec2c03ec7dd371d2f3300fb44061ac966cbc",
|
|
14
|
+
"comment": "adding exit code support for executeInProcess"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/cli",
|
|
19
|
+
"comment": "Bump @lage-run/config to v0.4.9",
|
|
20
|
+
"commit": "not available"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@lage-run/cli",
|
|
25
|
+
"comment": "Bump @lage-run/runners to v1.1.1",
|
|
26
|
+
"commit": "not available"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@lage-run/cli",
|
|
31
|
+
"comment": "Bump @lage-run/scheduler to v1.3.11",
|
|
32
|
+
"commit": "not available"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"date": "Mon, 18 Nov 2024 23:22:30 GMT",
|
|
6
39
|
"version": "0.24.1",
|
|
7
40
|
"tag": "@lage-run/cli_v0.24.1",
|
|
8
41
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
# Change Log - @lage-run/cli
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Wed, 20 Nov 2024 02:43:24 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.24.2
|
|
8
|
+
|
|
9
|
+
Wed, 20 Nov 2024 02:43:24 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- adding exit code support for executeInProcess (kchau@microsoft.com)
|
|
14
|
+
- Bump @lage-run/config to v0.4.9
|
|
15
|
+
- Bump @lage-run/runners to v1.1.1
|
|
16
|
+
- Bump @lage-run/scheduler to v1.3.11
|
|
17
|
+
|
|
7
18
|
## 0.24.1
|
|
8
19
|
|
|
9
|
-
Mon, 18 Nov 2024 23:22:
|
|
20
|
+
Mon, 18 Nov 2024 23:22:30 GMT
|
|
10
21
|
|
|
11
22
|
### Patches
|
|
12
23
|
|
|
@@ -110,13 +110,33 @@ async function executeInProcess({ cwd, args, nodeArg, logger }) {
|
|
|
110
110
|
logger.info("Running target", {
|
|
111
111
|
target
|
|
112
112
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
try {
|
|
114
|
+
await runner.run({
|
|
115
|
+
target,
|
|
116
|
+
weight: 1,
|
|
117
|
+
abortSignal: new AbortController().signal
|
|
118
|
+
});
|
|
119
|
+
logger.info("Finished", {
|
|
120
|
+
target
|
|
121
|
+
});
|
|
122
|
+
} catch (result) {
|
|
123
|
+
process.exitCode = 1;
|
|
124
|
+
if (typeof result === "object" && result !== null && "exitCode" in result) {
|
|
125
|
+
if (typeof result.exitCode === "number" && result.exitCode !== 0) {
|
|
126
|
+
process.exitCode = result.exitCode;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (typeof result === "object" && result !== null && "error" in result) {
|
|
130
|
+
logger.error(`Failed`, {
|
|
131
|
+
target,
|
|
132
|
+
error: result.error
|
|
133
|
+
});
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
logger.error(`Failed`, {
|
|
137
|
+
target,
|
|
138
|
+
error: result
|
|
139
|
+
});
|
|
140
|
+
}
|
|
121
141
|
}
|
|
122
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/exec/executeInProcess.ts"],"sourcesContent":["import { getConfig } from \"@lage-run/config\";\nimport { TargetFactory } from \"@lage-run/target-graph\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { getPackageInfos, getWorkspaceRoot } from \"workspace-tools\";\nimport { filterArgsForTasks } from \"../run/filterArgsForTasks.js\";\nimport { expandTargetDefinition } from \"./expandTargetDefinition.js\";\nimport { TargetRunnerPicker } from \"@lage-run/runners\";\nimport { type Logger } from \"@lage-run/logger\";\nimport { runnerPickerOptions } from \"../../runnerPickerOptions.js\";\n\ninterface ExecuteInProcessOptions {\n cwd?: string;\n nodeArg?: string;\n args?: string[];\n logger: Logger;\n}\n\n/**\n * Parses the package and task from the command as quickly as possible:\n *\n * 1. if cwd overridden in args, use it to read the package.json directly\n * 2. if cwd not overridden and root is not cwd, use the cwd to read the package.json directly\n * 3. if root is cwd, assume the task is global\n *\n * @param options\n * @param command\n * @returns\n */\nfunction parsePackageInfoFromArgs(root: string, cwd: string | undefined, packageName: string | undefined, task: string) {\n if (packageName && task) {\n const packageInfos = getPackageInfos(root);\n const info = packageInfos[packageName];\n return {\n info,\n task,\n isGlobal: false,\n };\n }\n\n if (cwd) {\n const packageJsonPath = path.join(cwd, \"package.json\");\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: false,\n };\n }\n\n if (root !== process.cwd()) {\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: false,\n };\n }\n }\n\n const packageJsonPath = path.join(root, \"package.json\");\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: true,\n };\n}\n\nexport async function executeInProcess({ cwd, args, nodeArg, logger }: ExecuteInProcessOptions) {\n const root = getWorkspaceRoot(process.cwd())!;\n const config = await getConfig(root);\n const { pipeline } = config;\n\n const taskArg = args?.length === 1 ? args?.[0] : args?.[1];\n const packageName = args?.length ?? 0 > 1 ? args?.[0] : undefined;\n\n if (!taskArg) {\n throw new Error(\"No task provided\");\n }\n\n const { info, task, isGlobal } = parsePackageInfoFromArgs(root, cwd, packageName, taskArg);\n\n const packageInfos = { [info.name]: info };\n\n const resolve = () => {\n return path.dirname(info.packageJsonPath).replace(/\\\\/g, \"/\");\n };\n\n const { taskArgs } = filterArgsForTasks(args ?? []);\n\n const factory = new TargetFactory({ root, resolve, packageInfos });\n\n const definition = expandTargetDefinition(isGlobal ? undefined : info.name, task, pipeline, config.cacheOptions.outputGlob ?? []);\n\n const target = isGlobal ? factory.createGlobalTarget(task, definition) : factory.createPackageTarget(info.name, task, definition);\n const pickerOptions = runnerPickerOptions(nodeArg, config.npmClient, taskArgs);\n\n const runnerPicker = new TargetRunnerPicker(pickerOptions);\n const runner = await runnerPicker.pick(target);\n\n if (await runner.shouldRun(target)) {\n logger.info(\"Running target\", { target });\n await runner.run({\n
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/exec/executeInProcess.ts"],"sourcesContent":["import { getConfig } from \"@lage-run/config\";\nimport { TargetFactory } from \"@lage-run/target-graph\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { getPackageInfos, getWorkspaceRoot } from \"workspace-tools\";\nimport { filterArgsForTasks } from \"../run/filterArgsForTasks.js\";\nimport { expandTargetDefinition } from \"./expandTargetDefinition.js\";\nimport { TargetRunnerPicker } from \"@lage-run/runners\";\nimport { type Logger } from \"@lage-run/logger\";\nimport { runnerPickerOptions } from \"../../runnerPickerOptions.js\";\n\ninterface ExecuteInProcessOptions {\n cwd?: string;\n nodeArg?: string;\n args?: string[];\n logger: Logger;\n}\n\n/**\n * Parses the package and task from the command as quickly as possible:\n *\n * 1. if cwd overridden in args, use it to read the package.json directly\n * 2. if cwd not overridden and root is not cwd, use the cwd to read the package.json directly\n * 3. if root is cwd, assume the task is global\n *\n * @param options\n * @param command\n * @returns\n */\nfunction parsePackageInfoFromArgs(root: string, cwd: string | undefined, packageName: string | undefined, task: string) {\n if (packageName && task) {\n const packageInfos = getPackageInfos(root);\n const info = packageInfos[packageName];\n return {\n info,\n task,\n isGlobal: false,\n };\n }\n\n if (cwd) {\n const packageJsonPath = path.join(cwd, \"package.json\");\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: false,\n };\n }\n\n if (root !== process.cwd()) {\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: false,\n };\n }\n }\n\n const packageJsonPath = path.join(root, \"package.json\");\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: true,\n };\n}\n\nexport async function executeInProcess({ cwd, args, nodeArg, logger }: ExecuteInProcessOptions) {\n const root = getWorkspaceRoot(process.cwd())!;\n const config = await getConfig(root);\n const { pipeline } = config;\n\n const taskArg = args?.length === 1 ? args?.[0] : args?.[1];\n const packageName = args?.length ?? 0 > 1 ? args?.[0] : undefined;\n\n if (!taskArg) {\n throw new Error(\"No task provided\");\n }\n\n const { info, task, isGlobal } = parsePackageInfoFromArgs(root, cwd, packageName, taskArg);\n\n const packageInfos = { [info.name]: info };\n\n const resolve = () => {\n return path.dirname(info.packageJsonPath).replace(/\\\\/g, \"/\");\n };\n\n const { taskArgs } = filterArgsForTasks(args ?? []);\n\n const factory = new TargetFactory({ root, resolve, packageInfos });\n\n const definition = expandTargetDefinition(isGlobal ? undefined : info.name, task, pipeline, config.cacheOptions.outputGlob ?? []);\n\n const target = isGlobal ? factory.createGlobalTarget(task, definition) : factory.createPackageTarget(info.name, task, definition);\n const pickerOptions = runnerPickerOptions(nodeArg, config.npmClient, taskArgs);\n\n const runnerPicker = new TargetRunnerPicker(pickerOptions);\n const runner = await runnerPicker.pick(target);\n\n if (await runner.shouldRun(target)) {\n logger.info(\"Running target\", { target });\n\n try {\n await runner.run({\n target,\n weight: 1,\n abortSignal: new AbortController().signal,\n });\n\n logger.info(\"Finished\", { target });\n } catch (result) {\n process.exitCode = 1;\n\n if (typeof result === \"object\" && result !== null && \"exitCode\" in result) {\n if (typeof result.exitCode === \"number\" && result.exitCode !== 0) {\n process.exitCode = result.exitCode;\n }\n }\n\n if (typeof result === \"object\" && result !== null && \"error\" in result) {\n logger.error(`Failed`, { target, error: result.error });\n return;\n }\n\n logger.error(`Failed`, { target, error: result });\n }\n }\n}\n"],"names":["executeInProcess","parsePackageInfoFromArgs","root","cwd","packageName","task","packageInfos","getPackageInfos","info","isGlobal","packageJsonPath","path","join","packageJson","JSON","parse","fs","readFileSync","process","existsSync","args","nodeArg","logger","getWorkspaceRoot","config","getConfig","pipeline","taskArg","length","undefined","Error","name","resolve","dirname","replace","taskArgs","filterArgsForTasks","factory","TargetFactory","definition","expandTargetDefinition","cacheOptions","outputGlob","target","createGlobalTarget","createPackageTarget","pickerOptions","runnerPickerOptions","npmClient","runnerPicker","TargetRunnerPicker","runner","pick","shouldRun","run","weight","abortSignal","AbortController","signal","result","exitCode","error"],"mapp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AAI,CAAC,kBAAkB;YAAEmC;QAAO;QAEvC,IAAI;YACF,MAAMQ,OAAOG,GAAG,CAAC;gBACfX;gBACAY,QAAQ;gBACRC,aAAa,IAAIC,kBAAkBC,MAAM;YAC3C;YAEApC,OAAOd,IAAI,CAAC,YAAY;gBAAEmC;YAAO;QACnC,EAAE,OAAOgB,QAAQ;YACfzC,QAAQ0C,QAAQ,GAAG;YAEnB,IAAI,OAAOD,WAAW,YAAYA,WAAW,QAAQ,cAAcA,QAAQ;gBACzE,IAAI,OAAOA,OAAOC,QAAQ,KAAK,YAAYD,OAAOC,QAAQ,KAAK,GAAG;oBAChE1C,QAAQ0C,QAAQ,GAAGD,OAAOC,QAAQ;gBACpC;YACF;YAEA,IAAI,OAAOD,WAAW,YAAYA,WAAW,QAAQ,WAAWA,QAAQ;gBACtErC,OAAOuC,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE;oBAAElB;oBAAQkB,OAAOF,OAAOE,KAAK;gBAAC;gBACrD;YACF;YAEAvC,OAAOuC,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE;gBAAElB;gBAAQkB,OAAOF;YAAO;QACjD;IACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/cli",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "Command Line Interface for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@lage-run/cache": "^1.3.8",
|
|
25
|
-
"@lage-run/config": "^0.4.
|
|
25
|
+
"@lage-run/config": "^0.4.9",
|
|
26
26
|
"@lage-run/globby": "^14.2.0",
|
|
27
27
|
"@lage-run/hasher": "^1.6.5",
|
|
28
28
|
"@lage-run/logger": "^1.3.1",
|
|
29
29
|
"@lage-run/reporters": "^1.2.16",
|
|
30
30
|
"@lage-run/rpc": "^1.2.3",
|
|
31
|
-
"@lage-run/runners": "^1.1.
|
|
32
|
-
"@lage-run/scheduler": "^1.3.
|
|
31
|
+
"@lage-run/runners": "^1.1.1",
|
|
32
|
+
"@lage-run/scheduler": "^1.3.11",
|
|
33
33
|
"@lage-run/scheduler-types": "^0.3.20",
|
|
34
34
|
"@lage-run/target-graph": "^0.10.0",
|
|
35
35
|
"@lage-run/worker-threads-pool": "^0.8.4",
|