@lage-run/cli 0.29.0 → 0.31.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/CHANGELOG.json CHANGED
@@ -2,41 +2,46 @@
2
2
  "name": "@lage-run/cli",
3
3
  "entries": [
4
4
  {
5
- "date": "Sat, 08 Mar 2025 02:33:56 GMT",
6
- "version": "0.29.0",
7
- "tag": "@lage-run/cli_v0.29.0",
5
+ "date": "Tue, 01 Apr 2025 19:21:13 GMT",
6
+ "version": "0.31.0",
7
+ "tag": "@lage-run/cli_v0.31.0",
8
8
  "comments": {
9
9
  "minor": [
10
10
  {
11
- "author": "kchau@microsoft.com",
12
- "package": "@lage-run/cli",
13
- "commit": "10cda62c08de4bd604d80b7d0ebb9aefbb865d70",
14
- "comment": "cheat on optimization by leverage the fact that 'info' command is called before anything else ALWAYS in BXL"
15
- },
16
- {
17
- "author": "beachball",
11
+ "author": "dannyvv@microsoft.com",
18
12
  "package": "@lage-run/cli",
19
- "comment": "Bump @lage-run/hasher to v1.7.0",
20
- "commit": "not available"
21
- },
13
+ "commit": "9c05325591496b39793b8e9ad5a95a5208e51459",
14
+ "comment": "Add backwards compate lage info emit hack"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Sat, 29 Mar 2025 02:16:38 GMT",
21
+ "version": "0.30.0",
22
+ "tag": "@lage-run/cli_v0.30.0",
23
+ "comments": {
24
+ "minor": [
22
25
  {
23
- "author": "beachball",
26
+ "author": "kchau@microsoft.com",
24
27
  "package": "@lage-run/cli",
25
- "comment": "Bump @lage-run/rpc to v1.3.0",
26
- "commit": "not available"
27
- },
28
+ "commit": "a680ab60dcddd84808f223a1b5f38a16e868b66f",
29
+ "comment": "cheat on optimization by leverage the fact that 'info' command is called before anything else ALWAYS in BXL"
30
+ }
31
+ ],
32
+ "none": [
28
33
  {
29
- "author": "beachball",
34
+ "author": "elcraig@microsoft.com",
30
35
  "package": "@lage-run/cli",
31
- "comment": "Bump @lage-run/scheduler to v1.5.2",
32
- "commit": "not available"
36
+ "commit": "a680ab60dcddd84808f223a1b5f38a16e868b66f",
37
+ "comment": "Sync versions, and use workspace:^ versions for local deps"
33
38
  }
34
39
  ],
35
40
  "patch": [
36
41
  {
37
42
  "author": "kchau@microsoft.com",
38
43
  "package": "@lage-run/cli",
39
- "commit": "10cda62c08de4bd604d80b7d0ebb9aefbb865d70",
44
+ "commit": "a680ab60dcddd84808f223a1b5f38a16e868b66f",
40
45
  "comment": "fixes the lage-server to respect gitignored files for env globs"
41
46
  }
42
47
  ]
package/CHANGELOG.md CHANGED
@@ -1,19 +1,24 @@
1
1
  # Change Log - @lage-run/cli
2
2
 
3
- <!-- This log was last generated on Sat, 08 Mar 2025 02:33:56 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Tue, 01 Apr 2025 19:21:13 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.29.0
7
+ ## 0.31.0
8
8
 
9
- Sat, 08 Mar 2025 02:33:56 GMT
9
+ Tue, 01 Apr 2025 19:21:13 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Add backwards compate lage info emit hack (dannyvv@microsoft.com)
14
+
15
+ ## 0.30.0
16
+
17
+ Sat, 29 Mar 2025 02:16:38 GMT
10
18
 
11
19
  ### Minor changes
12
20
 
13
21
  - cheat on optimization by leverage the fact that 'info' command is called before anything else ALWAYS in BXL (kchau@microsoft.com)
14
- - Bump @lage-run/hasher to v1.7.0
15
- - Bump @lage-run/rpc to v1.3.0
16
- - Bump @lage-run/scheduler to v1.5.2
17
22
 
18
23
  ### Patches
19
24
 
@@ -10,6 +10,8 @@ interface InfoActionOptions extends ReporterInitOptions {
10
10
  nodeArg: string;
11
11
  ignore: string[];
12
12
  server: string;
13
+ outputFile?: string;
14
+ optimizeGraph: boolean;
13
15
  }
14
16
  /**
15
17
  * The info command displays information about a target graph in a workspace.
@@ -77,7 +77,7 @@ async function infoAction(options, command) {
77
77
  // This is a temp solution to be able to upgrade to Lage V2 without breaking the BuildXL integration. And allow us
78
78
  // to update to lage v2.
79
79
  // Unfortunately this is the only variable that we can use to not break any other customers
80
- const createBackwardsCompatGraph = process.env["DOMINO"] === "1";
80
+ const createBackwardsCompatGraph = process.env["DOMINO"] === "1" || !options.optimizeGraph;
81
81
  const optimizedTargets = await (0, _optimizeTargetGraph.optimizeTargetGraph)(targetGraph, runnerPicker, createBackwardsCompatGraph);
82
82
  const binPaths = (0, _getBinPaths.getBinPaths)();
83
83
  const packageTasks = optimizedTargets.map((target)=>generatePackageTask(target, taskArgs, config, options, binPaths, packageInfos, tasks));
@@ -128,11 +128,24 @@ async function infoAction(options, command) {
128
128
  _fs.default.writeFileSync(targetGlobalInputsHashFile, targetGlobalInputsHash);
129
129
  }
130
130
  }
131
- logger.info("info", {
131
+ const infoResult = {
132
132
  command: command.args,
133
133
  scope,
134
134
  packageTasks
135
- });
135
+ };
136
+ if (options.outputFile) {
137
+ const parentFolder = _path.default.dirname(options.outputFile);
138
+ if (!_fs.default.existsSync(parentFolder)) {
139
+ await _fs.default.promises.mkdir(parentFolder, {
140
+ recursive: true
141
+ });
142
+ }
143
+ const infoJson = JSON.stringify(infoResult, null, options.verbose ? 2 : undefined);
144
+ await _fs.default.promises.writeFile(options.outputFile, infoJson);
145
+ logger.info(`Wrote info to file: ${options.outputFile}`);
146
+ } else {
147
+ logger.info("info", infoResult);
148
+ }
136
149
  }
137
150
  function generatePackageTask(target, taskArgs, config, options, binPaths, packageInfos, tasks) {
138
151
  const command = generateCommand(target, taskArgs, config, options, binPaths, packageInfos, tasks);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/info/action.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { createTargetGraph } from \"../run/createTargetGraph.js\";\nimport { filterArgsForTasks } from \"../run/filterArgsForTasks.js\";\nimport type { ConfigOptions } from \"@lage-run/config\";\nimport { getConfig } from \"@lage-run/config\";\nimport { type PackageInfos, getPackageInfos, getWorkspaceRoot } from \"workspace-tools\";\nimport { getFilteredPackages } from \"../../filter/getFilteredPackages.js\";\nimport createLogger from \"@lage-run/logger\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { parse } from \"shell-quote\";\n\nimport type { ReporterInitOptions } from \"../../types/ReporterInitOptions.js\";\nimport { type Target, getStartTargetId } from \"@lage-run/target-graph\";\nimport { initializeReporters } from \"../initializeReporters.js\";\nimport { TargetRunnerPicker } from \"@lage-run/runners\";\nimport { getBinPaths } from \"../../getBinPaths.js\";\nimport { runnerPickerOptions } from \"../../runnerPickerOptions.js\";\nimport { parseServerOption } from \"../parseServerOption.js\";\nimport { optimizeTargetGraph } from \"../../optimizeTargetGraph.js\";\nimport { glob } from \"@lage-run/globby\";\nimport { FileHasher } from \"@lage-run/hasher/lib/FileHasher.js\";\nimport { hashStrings } from \"@lage-run/hasher\";\nimport { getGlobalInputHashFilePath } from \"../targetHashFilePath.js\";\n\ninterface InfoActionOptions extends ReporterInitOptions {\n dependencies: boolean;\n dependents: boolean;\n since: string;\n scope: string[];\n to: string[];\n cache: boolean;\n nodeArg: string;\n ignore: string[];\n server: string;\n}\n\ninterface PackageTask {\n id: string;\n command: string[];\n dependencies: string[];\n workingDirectory: string;\n package: string;\n task: string;\n inputs?: string[];\n outputs?: string[];\n options?: Record<string, any>;\n weight?: number;\n}\n\n/**\n * The info command displays information about a target graph in a workspace.\n * The generated output can be read and used by other task runners, such as BuildXL.\n *\n * Expected format:\n * [\n * {\n * \"id\": \"bar##build\",\n * \"package\": \"bar\",\n * \"task\": \"build\",\n * \"command\": \"npm run build --blah\",\n * \"workingDirectory\": \"packages/bar\",\n * \"dependencies\": []\n * },\n * {\n * \"id\": \"foo##build\",\n * \"package\": \"foo\",\n * \"task\": \"build\",\n * \"command\": \"npm run build --blah\",\n * \"workingDirectory\": \"packages/foo\",\n * \"dependencies\": [\n * \"bar##build\"\n * ],\n * \"weight\": 3,\n * \"inputs\": [\"src//**/ /*.ts\"],\n * \"inputs\": [\"lib//**/ /*.js\", \"lib//**/ /*.d.ts]\"\n * \"options\": {\n * \"environment\": {\n * \"custom_env_var\": \"x\",\n * }\n * }\n * },\n * {\n * \"id\": \"foo##test\",\n * \"package\": \"foo\",\n * \"task\": \"test\",\n * \"command\": \"npm run test --blah\",\n * \"workingDirectory\": \"packages/foo\",\n * \"dependencies\": [\n * \"foo##build\"\n * ]\n * },\n * ...\n * ]\n */\nexport async function infoAction(options: InfoActionOptions, command: Command) {\n const cwd = process.cwd();\n const config = await getConfig(cwd);\n const logger = createLogger();\n options.logLevel = options.logLevel ?? \"info\";\n options.reporter = options.reporter ?? \"json\";\n options.server = typeof options.server === \"boolean\" && options.server ? \"localhost:5332\" : options.server;\n initializeReporters(logger, options);\n const root = getWorkspaceRoot(cwd)!;\n\n const packageInfos = getPackageInfos(root);\n\n const { tasks, taskArgs } = filterArgsForTasks(command.args);\n\n const targetGraph = await createTargetGraph({\n logger,\n root,\n dependencies: options.dependencies,\n dependents: options.dependents && !options.to, // --to is a short hand for --scope + --no-dependents\n ignore: options.ignore.concat(config.ignore),\n pipeline: config.pipeline,\n repoWideChanges: config.repoWideChanges,\n scope: (options.scope ?? []).concat(options.to ?? []), // --to is a short hand for --scope + --no-dependents\n since: options.since,\n outputs: config.cacheOptions.outputGlob,\n tasks,\n packageInfos,\n priorities: config.priorities,\n });\n\n const scope = getFilteredPackages({\n root,\n packageInfos,\n logger,\n includeDependencies: options.dependencies,\n includeDependents: options.dependents && !options.to, // --to is a short hand for --scope + --no-dependents\n since: options.since,\n scope: (options.scope ?? []).concat(options.to ?? []), // --to is a short hand for --scope + --no-dependents\n repoWideChanges: config.repoWideChanges,\n sinceIgnoreGlobs: options.ignore.concat(config.ignore),\n });\n\n const pickerOptions = runnerPickerOptions(options.nodeArg, config.npmClient, taskArgs);\n\n const runnerPicker = new TargetRunnerPicker(pickerOptions);\n\n // This is a temporary flag to allow backwards compatibility with the old lage graph format used by BuildXL (formerly known as Domino).\n // I initially worked on a commandline flag, but threading that through requires 3 different releases (lage, buildxl, ohome).\n // This is a temp solution to be able to upgrade to Lage V2 without breaking the BuildXL integration. And allow us\n // to update to lage v2.\n // Unfortunately this is the only variable that we can use to not break any other customers\n const createBackwardsCompatGraph = process.env[\"DOMINO\"] === \"1\";\n\n const optimizedTargets = await optimizeTargetGraph(targetGraph, runnerPicker, createBackwardsCompatGraph);\n const binPaths = getBinPaths();\n const packageTasks = optimizedTargets.map((target) =>\n generatePackageTask(target, taskArgs, config, options, binPaths, packageInfos, tasks)\n );\n\n // In worker server mode, we need to actually speed up the BuildXL runs with presupplied global input hashes so that it doesn't try to read it over and over again\n // This is an important optimization for BuildXL for large amount of env glob matches in non-well-behaved monorepos\n // (e.g. repos that have files listed in env glob to avoid circular dependencies in package graph)\n if (shouldRunWorkersAsService(options)) {\n // For each target in the target graph, we need to create a global input hash file in this kind of location:\n // ${target.cwd}/.lage/global_inputs_hash\n // We will use glob for these files and use the FileHasher to generate these hashes.\n const fileHasher = new FileHasher({\n root,\n });\n\n const globHashCache = new Map<string, string>();\n const globHashWithCache = (patterns: string[], options: { cwd: string }) => {\n const key = patterns.join(\"###\");\n if (globHashCache.has(key)) {\n return globHashCache.get(key)!;\n }\n\n const files = glob(patterns, options);\n const hash = hashStrings(Object.values(fileHasher.hash(files.map((file) => path.join(root, file)))));\n\n globHashCache.set(key, hash);\n\n return hash;\n };\n\n const globalInputs = config.cacheOptions?.environmentGlob\n ? glob(config.cacheOptions?.environmentGlob, { cwd: root })\n : [\"lage.config.js\"];\n\n for (const target of optimizedTargets) {\n if (target.id === getStartTargetId()) {\n continue;\n }\n\n const targetGlobalInputsHash = target.environmentGlob\n ? globHashWithCache(target.environmentGlob, { cwd: root })\n : globHashWithCache(globalInputs, { cwd: root });\n\n const targetGlobalInputsHashFile = path.join(target.cwd, getGlobalInputHashFilePath(target));\n const targetGlobalInputsHashFileDir = path.dirname(targetGlobalInputsHashFile);\n\n // Make sure the directory exists\n if (!fs.existsSync(targetGlobalInputsHashFileDir)) {\n fs.mkdirSync(targetGlobalInputsHashFileDir, { recursive: true });\n }\n\n // Write the hash to the file\n fs.writeFileSync(targetGlobalInputsHashFile, targetGlobalInputsHash);\n }\n }\n\n logger.info(\"info\", {\n command: command.args,\n scope,\n packageTasks,\n });\n}\n\nfunction generatePackageTask(\n target: Target,\n taskArgs: string[],\n config: ConfigOptions,\n options: InfoActionOptions,\n binPaths: { lage: string; \"lage-server\": string },\n packageInfos: PackageInfos,\n tasks: string[]\n): PackageTask {\n const command = generateCommand(target, taskArgs, config, options, binPaths, packageInfos, tasks);\n const workingDirectory = getWorkingDirectory(target);\n\n const packageTask: PackageTask = {\n id: target.id,\n command,\n dependencies: target.dependencies,\n workingDirectory,\n package: target.packageName ?? \"\",\n task: target.task,\n inputs: target.inputs,\n outputs: target.outputs,\n };\n\n if (target.weight && target.weight !== 1) {\n packageTask.weight = target.weight;\n }\n\n if (target.options && Object.keys(target.options).length != 0) {\n packageTask.options = target.options;\n }\n\n return packageTask;\n}\n\nfunction shouldRunWorkersAsService(options: InfoActionOptions) {\n return (typeof process.env.LAGE_WORKER_SERVER === \"string\" && process.env.LAGE_WORKER_SERVER !== \"false\") || !!options.server;\n}\n\nfunction generateCommand(\n target: Target,\n taskArgs: string[],\n config: ConfigOptions,\n options: InfoActionOptions,\n binPaths: { lage: string; \"lage-server\": string },\n packageInfos: PackageInfos,\n tasks: string[]\n) {\n if (target.type === \"npmScript\") {\n const script = target.packageName !== undefined ? packageInfos[target.packageName]?.scripts?.[target.task] : undefined;\n\n // If the script is a node script, and that it does not have any shell operators (&&, ||, etc)\n // then we can simply pass this along to info command rather than using npm client to run it.\n if (script && script.startsWith(\"node\")) {\n const parsed = parse(script);\n if (parsed.length > 0 && parsed.every((entry) => typeof entry === \"string\")) {\n return [...(parsed as string[]), ...taskArgs];\n }\n }\n\n const npmClient = config.npmClient ?? \"npm\";\n const command = [npmClient, ...getNpmArgs(target.task, taskArgs)];\n return command;\n } else if (target.type === \"worker\" && shouldRunWorkersAsService(options)) {\n const { host, port } = parseServerOption(options.server);\n const command = [binPaths[\"lage\"], \"exec\", \"--tasks\", ...tasks, \"--server\", `${host}:${port}`];\n if (options.concurrency) {\n command.push(\"--concurrency\", options.concurrency.toString());\n }\n\n if (target.packageName) {\n command.push(target.packageName);\n }\n\n if (target.task) {\n command.push(target.task);\n }\n\n command.push(...taskArgs);\n return command;\n } else if (target.type === \"worker\") {\n const command = [binPaths.lage, \"exec\"];\n command.push(target.packageName ?? \"\");\n command.push(target.task);\n command.push(...taskArgs);\n return command;\n }\n\n return [];\n}\n\nfunction getWorkingDirectory(target) {\n const cwd = process.cwd();\n const workingDirectory = path.relative(getWorkspaceRoot(cwd) ?? \"\", target.cwd).replace(/\\\\/g, \"/\");\n return workingDirectory;\n}\n\nfunction getNpmArgs(task: string, taskTargs: string[]) {\n const extraArgs = taskTargs != undefined && taskTargs.length > 0 ? [\"--\", ...taskTargs] : [];\n return [\"run\", task, ...extraArgs];\n}\n"],"names":["infoAction","options","command","cwd","process","config","getConfig","logger","createLogger","logLevel","reporter","server","initializeReporters","root","getWorkspaceRoot","packageInfos","getPackageInfos","tasks","taskArgs","filterArgsForTasks","args","targetGraph","createTargetGraph","dependencies","dependents","to","ignore","concat","pipeline","repoWideChanges","scope","since","outputs","cacheOptions","outputGlob","priorities","getFilteredPackages","includeDependencies","includeDependents","sinceIgnoreGlobs","pickerOptions","runnerPickerOptions","nodeArg","npmClient","runnerPicker","TargetRunnerPicker","createBackwardsCompatGraph","env","optimizedTargets","optimizeTargetGraph","binPaths","getBinPaths","packageTasks","map","target","generatePackageTask","shouldRunWorkersAsService","fileHasher","FileHasher","globHashCache","Map","globHashWithCache","patterns","key","join","has","get","files","glob","hash","hashStrings","Object","values","file","path","set","globalInputs","environmentGlob","id","getStartTargetId","targetGlobalInputsHash","targetGlobalInputsHashFile","getGlobalInputHashFilePath","targetGlobalInputsHashFileDir","dirname","fs","existsSync","mkdirSync","recursive","writeFileSync","info","generateCommand","workingDirectory","getWorkingDirectory","packageTask","package","packageName","task","inputs","weight","keys","length","LAGE_WORKER_SERVER","type","script","undefined","scripts","startsWith","parsed","parse","every","entry","getNpmArgs","host","port","parseServerOption","concurrency","push","toString","lage","relative","replace","taskTargs","extraArgs"],"mappings":";;;;+BA+FsBA;;;eAAAA;;;mCA9FY;oCACC;wBAET;gCAC2C;qCACjC;+DACX;6DACR;2DACF;4BACO;6BAGwB;qCACV;yBACD;6BACP;qCACQ;mCACF;qCACE;wBACf;4BACM;wBACC;oCACe;;;;;;AAwEpC,eAAeA,WAAWC,OAA0B,EAAEC,OAAgB;IAC3E,MAAMC,MAAMC,QAAQD,GAAG;IACvB,MAAME,SAAS,MAAMC,IAAAA,iBAAS,EAACH;IAC/B,MAAMI,SAASC,IAAAA,eAAY;IAC3BP,QAAQQ,QAAQ,GAAGR,QAAQQ,QAAQ,IAAI;IACvCR,QAAQS,QAAQ,GAAGT,QAAQS,QAAQ,IAAI;IACvCT,QAAQU,MAAM,GAAG,OAAOV,QAAQU,MAAM,KAAK,aAAaV,QAAQU,MAAM,GAAG,mBAAmBV,QAAQU,MAAM;IAC1GC,IAAAA,wCAAmB,EAACL,QAAQN;IAC5B,MAAMY,OAAOC,IAAAA,gCAAgB,EAACX;IAE9B,MAAMY,eAAeC,IAAAA,+BAAe,EAACH;IAErC,MAAM,EAAEI,KAAK,EAAEC,QAAQ,EAAE,GAAGC,IAAAA,sCAAkB,EAACjB,QAAQkB,IAAI;IAE3D,MAAMC,cAAc,MAAMC,IAAAA,oCAAiB,EAAC;QAC1Cf;QACAM;QACAU,cAActB,QAAQsB,YAAY;QAClCC,YAAYvB,QAAQuB,UAAU,IAAI,CAACvB,QAAQwB,EAAE;QAC7CC,QAAQzB,QAAQyB,MAAM,CAACC,MAAM,CAACtB,OAAOqB,MAAM;QAC3CE,UAAUvB,OAAOuB,QAAQ;QACzBC,iBAAiBxB,OAAOwB,eAAe;QACvCC,OAAO,AAAC7B,CAAAA,QAAQ6B,KA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,CAAC/D,OAAO2C,IAAI;QACxB/F,QAAQmH,IAAI,IAAInG;QAChB,OAAOhB;IACT;IAEA,OAAO,EAAE;AACX;AAEA,SAAS2F,oBAAoBvC,MAAM;IACjC,MAAMnD,MAAMC,QAAQD,GAAG;IACvB,MAAMyF,mBAAmBlB,aAAI,CAAC8C,QAAQ,CAAC1G,IAAAA,gCAAgB,EAACX,QAAQ,IAAImD,OAAOnD,GAAG,EAAEsH,OAAO,CAAC,OAAO;IAC/F,OAAO7B;AACT;AAEA,SAASoB,WAAWf,IAAY,EAAEyB,SAAmB;IACnD,MAAMC,YAAYD,aAAajB,aAAaiB,UAAUrB,MAAM,GAAG,IAAI;QAAC;WAASqB;KAAU,GAAG,EAAE;IAC5F,OAAO;QAAC;QAAOzB;WAAS0B;KAAU;AACpC"}
1
+ {"version":3,"sources":["../../../src/commands/info/action.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { createTargetGraph } from \"../run/createTargetGraph.js\";\nimport { filterArgsForTasks } from \"../run/filterArgsForTasks.js\";\nimport type { ConfigOptions } from \"@lage-run/config\";\nimport { getConfig } from \"@lage-run/config\";\nimport { type PackageInfos, getPackageInfos, getWorkspaceRoot } from \"workspace-tools\";\nimport { getFilteredPackages } from \"../../filter/getFilteredPackages.js\";\nimport createLogger from \"@lage-run/logger\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { parse } from \"shell-quote\";\n\nimport type { ReporterInitOptions } from \"../../types/ReporterInitOptions.js\";\nimport { type Target, getStartTargetId } from \"@lage-run/target-graph\";\nimport { initializeReporters } from \"../initializeReporters.js\";\nimport { TargetRunnerPicker } from \"@lage-run/runners\";\nimport { getBinPaths } from \"../../getBinPaths.js\";\nimport { runnerPickerOptions } from \"../../runnerPickerOptions.js\";\nimport { parseServerOption } from \"../parseServerOption.js\";\nimport { optimizeTargetGraph } from \"../../optimizeTargetGraph.js\";\nimport { glob } from \"@lage-run/globby\";\nimport { FileHasher } from \"@lage-run/hasher/lib/FileHasher.js\";\nimport { hashStrings } from \"@lage-run/hasher\";\nimport { getGlobalInputHashFilePath } from \"../targetHashFilePath.js\";\n\ninterface InfoActionOptions extends ReporterInitOptions {\n dependencies: boolean;\n dependents: boolean;\n since: string;\n scope: string[];\n to: string[];\n cache: boolean;\n nodeArg: string;\n ignore: string[];\n server: string;\n outputFile?: string;\n optimizeGraph: boolean;\n}\n\ninterface PackageTask {\n id: string;\n command: string[];\n dependencies: string[];\n workingDirectory: string;\n package: string;\n task: string;\n inputs?: string[];\n outputs?: string[];\n options?: Record<string, any>;\n weight?: number;\n}\n\n/**\n * The info command displays information about a target graph in a workspace.\n * The generated output can be read and used by other task runners, such as BuildXL.\n *\n * Expected format:\n * [\n * {\n * \"id\": \"bar##build\",\n * \"package\": \"bar\",\n * \"task\": \"build\",\n * \"command\": \"npm run build --blah\",\n * \"workingDirectory\": \"packages/bar\",\n * \"dependencies\": []\n * },\n * {\n * \"id\": \"foo##build\",\n * \"package\": \"foo\",\n * \"task\": \"build\",\n * \"command\": \"npm run build --blah\",\n * \"workingDirectory\": \"packages/foo\",\n * \"dependencies\": [\n * \"bar##build\"\n * ],\n * \"weight\": 3,\n * \"inputs\": [\"src//**/ /*.ts\"],\n * \"inputs\": [\"lib//**/ /*.js\", \"lib//**/ /*.d.ts]\"\n * \"options\": {\n * \"environment\": {\n * \"custom_env_var\": \"x\",\n * }\n * }\n * },\n * {\n * \"id\": \"foo##test\",\n * \"package\": \"foo\",\n * \"task\": \"test\",\n * \"command\": \"npm run test --blah\",\n * \"workingDirectory\": \"packages/foo\",\n * \"dependencies\": [\n * \"foo##build\"\n * ]\n * },\n * ...\n * ]\n */\nexport async function infoAction(options: InfoActionOptions, command: Command) {\n const cwd = process.cwd();\n const config = await getConfig(cwd);\n const logger = createLogger();\n options.logLevel = options.logLevel ?? \"info\";\n options.reporter = options.reporter ?? \"json\";\n options.server = typeof options.server === \"boolean\" && options.server ? \"localhost:5332\" : options.server;\n initializeReporters(logger, options);\n const root = getWorkspaceRoot(cwd)!;\n\n const packageInfos = getPackageInfos(root);\n\n const { tasks, taskArgs } = filterArgsForTasks(command.args);\n\n const targetGraph = await createTargetGraph({\n logger,\n root,\n dependencies: options.dependencies,\n dependents: options.dependents && !options.to, // --to is a short hand for --scope + --no-dependents\n ignore: options.ignore.concat(config.ignore),\n pipeline: config.pipeline,\n repoWideChanges: config.repoWideChanges,\n scope: (options.scope ?? []).concat(options.to ?? []), // --to is a short hand for --scope + --no-dependents\n since: options.since,\n outputs: config.cacheOptions.outputGlob,\n tasks,\n packageInfos,\n priorities: config.priorities,\n });\n\n const scope = getFilteredPackages({\n root,\n packageInfos,\n logger,\n includeDependencies: options.dependencies,\n includeDependents: options.dependents && !options.to, // --to is a short hand for --scope + --no-dependents\n since: options.since,\n scope: (options.scope ?? []).concat(options.to ?? []), // --to is a short hand for --scope + --no-dependents\n repoWideChanges: config.repoWideChanges,\n sinceIgnoreGlobs: options.ignore.concat(config.ignore),\n });\n\n const pickerOptions = runnerPickerOptions(options.nodeArg, config.npmClient, taskArgs);\n\n const runnerPicker = new TargetRunnerPicker(pickerOptions);\n\n // This is a temporary flag to allow backwards compatibility with the old lage graph format used by BuildXL (formerly known as Domino).\n // I initially worked on a commandline flag, but threading that through requires 3 different releases (lage, buildxl, ohome).\n // This is a temp solution to be able to upgrade to Lage V2 without breaking the BuildXL integration. And allow us\n // to update to lage v2.\n // Unfortunately this is the only variable that we can use to not break any other customers\n const createBackwardsCompatGraph = process.env[\"DOMINO\"] === \"1\" || !options.optimizeGraph;\n\n const optimizedTargets = await optimizeTargetGraph(targetGraph, runnerPicker, createBackwardsCompatGraph);\n const binPaths = getBinPaths();\n const packageTasks = optimizedTargets.map((target) =>\n generatePackageTask(target, taskArgs, config, options, binPaths, packageInfos, tasks)\n );\n\n // In worker server mode, we need to actually speed up the BuildXL runs with presupplied global input hashes so that it doesn't try to read it over and over again\n // This is an important optimization for BuildXL for large amount of env glob matches in non-well-behaved monorepos\n // (e.g. repos that have files listed in env glob to avoid circular dependencies in package graph)\n if (shouldRunWorkersAsService(options)) {\n // For each target in the target graph, we need to create a global input hash file in this kind of location:\n // ${target.cwd}/.lage/global_inputs_hash\n // We will use glob for these files and use the FileHasher to generate these hashes.\n const fileHasher = new FileHasher({\n root,\n });\n\n const globHashCache = new Map<string, string>();\n const globHashWithCache = (patterns: string[], options: { cwd: string }) => {\n const key = patterns.join(\"###\");\n if (globHashCache.has(key)) {\n return globHashCache.get(key)!;\n }\n\n const files = glob(patterns, options);\n const hash = hashStrings(Object.values(fileHasher.hash(files.map((file) => path.join(root, file)))));\n\n globHashCache.set(key, hash);\n\n return hash;\n };\n\n const globalInputs = config.cacheOptions?.environmentGlob\n ? glob(config.cacheOptions?.environmentGlob, { cwd: root })\n : [\"lage.config.js\"];\n\n for (const target of optimizedTargets) {\n if (target.id === getStartTargetId()) {\n continue;\n }\n\n const targetGlobalInputsHash = target.environmentGlob\n ? globHashWithCache(target.environmentGlob, { cwd: root })\n : globHashWithCache(globalInputs, { cwd: root });\n\n const targetGlobalInputsHashFile = path.join(target.cwd, getGlobalInputHashFilePath(target));\n const targetGlobalInputsHashFileDir = path.dirname(targetGlobalInputsHashFile);\n\n // Make sure the directory exists\n if (!fs.existsSync(targetGlobalInputsHashFileDir)) {\n fs.mkdirSync(targetGlobalInputsHashFileDir, { recursive: true });\n }\n\n // Write the hash to the file\n fs.writeFileSync(targetGlobalInputsHashFile, targetGlobalInputsHash);\n }\n }\n\n const infoResult = {\n command: command.args,\n scope,\n packageTasks,\n };\n\n if (options.outputFile) {\n const parentFolder = path.dirname(options.outputFile);\n if (!fs.existsSync(parentFolder)) {\n await fs.promises.mkdir(parentFolder, { recursive: true });\n }\n const infoJson = JSON.stringify(infoResult, null, options.verbose ? 2 : undefined);\n await fs.promises.writeFile(options.outputFile, infoJson);\n logger.info(`Wrote info to file: ${options.outputFile}`);\n } else {\n logger.info(\"info\", infoResult);\n }\n}\n\nfunction generatePackageTask(\n target: Target,\n taskArgs: string[],\n config: ConfigOptions,\n options: InfoActionOptions,\n binPaths: { lage: string; \"lage-server\": string },\n packageInfos: PackageInfos,\n tasks: string[]\n): PackageTask {\n const command = generateCommand(target, taskArgs, config, options, binPaths, packageInfos, tasks);\n const workingDirectory = getWorkingDirectory(target);\n\n const packageTask: PackageTask = {\n id: target.id,\n command,\n dependencies: target.dependencies,\n workingDirectory,\n package: target.packageName ?? \"\",\n task: target.task,\n inputs: target.inputs,\n outputs: target.outputs,\n };\n\n if (target.weight && target.weight !== 1) {\n packageTask.weight = target.weight;\n }\n\n if (target.options && Object.keys(target.options).length != 0) {\n packageTask.options = target.options;\n }\n\n return packageTask;\n}\n\nfunction shouldRunWorkersAsService(options: InfoActionOptions) {\n return (typeof process.env.LAGE_WORKER_SERVER === \"string\" && process.env.LAGE_WORKER_SERVER !== \"false\") || !!options.server;\n}\n\nfunction generateCommand(\n target: Target,\n taskArgs: string[],\n config: ConfigOptions,\n options: InfoActionOptions,\n binPaths: { lage: string; \"lage-server\": string },\n packageInfos: PackageInfos,\n tasks: string[]\n) {\n if (target.type === \"npmScript\") {\n const script = target.packageName !== undefined ? packageInfos[target.packageName]?.scripts?.[target.task] : undefined;\n\n // If the script is a node script, and that it does not have any shell operators (&&, ||, etc)\n // then we can simply pass this along to info command rather than using npm client to run it.\n if (script && script.startsWith(\"node\")) {\n const parsed = parse(script);\n if (parsed.length > 0 && parsed.every((entry) => typeof entry === \"string\")) {\n return [...(parsed as string[]), ...taskArgs];\n }\n }\n\n const npmClient = config.npmClient ?? \"npm\";\n const command = [npmClient, ...getNpmArgs(target.task, taskArgs)];\n return command;\n } else if (target.type === \"worker\" && shouldRunWorkersAsService(options)) {\n const { host, port } = parseServerOption(options.server);\n const command = [binPaths[\"lage\"], \"exec\", \"--tasks\", ...tasks, \"--server\", `${host}:${port}`];\n if (options.concurrency) {\n command.push(\"--concurrency\", options.concurrency.toString());\n }\n\n if (target.packageName) {\n command.push(target.packageName);\n }\n\n if (target.task) {\n command.push(target.task);\n }\n\n command.push(...taskArgs);\n return command;\n } else if (target.type === \"worker\") {\n const command = [binPaths.lage, \"exec\"];\n command.push(target.packageName ?? \"\");\n command.push(target.task);\n command.push(...taskArgs);\n return command;\n }\n\n return [];\n}\n\nfunction getWorkingDirectory(target) {\n const cwd = process.cwd();\n const workingDirectory = path.relative(getWorkspaceRoot(cwd) ?? \"\", target.cwd).replace(/\\\\/g, \"/\");\n return workingDirectory;\n}\n\nfunction getNpmArgs(task: string, taskTargs: string[]) {\n const extraArgs = taskTargs != undefined && taskTargs.length > 0 ? [\"--\", ...taskTargs] : [];\n return [\"run\", task, ...extraArgs];\n}\n"],"names":["infoAction","options","command","cwd","process","config","getConfig","logger","createLogger","logLevel","reporter","server","initializeReporters","root","getWorkspaceRoot","packageInfos","getPackageInfos","tasks","taskArgs","filterArgsForTasks","args","targetGraph","createTargetGraph","dependencies","dependents","to","ignore","concat","pipeline","repoWideChanges","scope","since","outputs","cacheOptions","outputGlob","priorities","getFilteredPackages","includeDependencies","includeDependents","sinceIgnoreGlobs","pickerOptions","runnerPickerOptions","nodeArg","npmClient","runnerPicker","TargetRunnerPicker","createBackwardsCompatGraph","env","optimizeGraph","optimizedTargets","optimizeTargetGraph","binPaths","getBinPaths","packageTasks","map","target","generatePackageTask","shouldRunWorkersAsService","fileHasher","FileHasher","globHashCache","Map","globHashWithCache","patterns","key","join","has","get","files","glob","hash","hashStrings","Object","values","file","path","set","globalInputs","environmentGlob","id","getStartTargetId","targetGlobalInputsHash","targetGlobalInputsHashFile","getGlobalInputHashFilePath","targetGlobalInputsHashFileDir","dirname","fs","existsSync","mkdirSync","recursive","writeFileSync","infoResult","outputFile","parentFolder","promises","mkdir","infoJson","JSON","stringify","verbose","undefined","writeFile","info","generateCommand","workingDirectory","getWorkingDirectory","packageTask","package","packageName","task","inputs","weight","keys","length","LAGE_WORKER_SERVER","type","script","scripts","startsWith","parsed","parse","every","entry","getNpmArgs","host","port","parseServerOption","concurrency","push","toString","lage","relative","replace","taskTargs","extraArgs"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,WAAW,EAAE;YACtB1G,QAAQ8H,IAAI,CAACzE,OAAOqD,WAAW;QACjC;QAEA,IAAIrD,OAAOsD,IAAI,EAAE;YACf3G,QAAQ8H,IAAI,CAACzE,OAAOsD,IAAI;QAC1B;QAEA3G,QAAQ8H,IAAI,IAAI9G;QAChB,OAAOhB;IACT,OAAO,IAAIqD,OAAO4D,IAAI,KAAK,UAAU;QACnC,MAAMjH,UAAU;YAACiD,SAAS+E,IAAI;YAAE;SAAO;QACvChI,QAAQ8H,IAAI,CAACzE,OAAOqD,WAAW,IAAI;QACnC1G,QAAQ8H,IAAI,CAACzE,OAAOsD,IAAI;QACxB3G,QAAQ8H,IAAI,IAAI9G;QAChB,OAAOhB;IACT;IAEA,OAAO,EAAE;AACX;AAEA,SAASuG,oBAAoBlD,MAAM;IACjC,MAAMpD,MAAMC,QAAQD,GAAG;IACvB,MAAMqG,mBAAmB7B,aAAI,CAACwD,QAAQ,CAACrH,IAAAA,gCAAgB,EAACX,QAAQ,IAAIoD,OAAOpD,GAAG,EAAEiI,OAAO,CAAC,OAAO;IAC/F,OAAO5B;AACT;AAEA,SAASmB,WAAWd,IAAY,EAAEwB,SAAmB;IACnD,MAAMC,YAAYD,aAAajC,aAAaiC,UAAUpB,MAAM,GAAG,IAAI;QAAC;WAASoB;KAAU,GAAG,EAAE;IAC5F,OAAO;QAAC;QAAOxB;WAASyB;KAAU;AACpC"}
@@ -16,4 +16,5 @@ const command = new _commander.Command("info");
16
16
  (0, _addOptions.addOptions)("runner", command);
17
17
  (0, _addOptions.addOptions)("logger", command);
18
18
  (0, _addOptions.addOptions)("filter", command);
19
+ (0, _addOptions.addOptions)("info", command);
19
20
  command.action(_action.infoAction);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/info/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { infoAction } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst command = new Command(\"info\");\naddOptions(\"server\", command);\naddOptions(\"runner\", command);\naddOptions(\"logger\", command);\naddOptions(\"filter\", command);\ncommand.action(infoAction);\n\nexport { command as infoCommand };\n"],"names":["infoCommand","command","Command","addOptions","action","infoAction"],"mappings":";;;;+BAWoBA;;;eAAXC;;;2BAXe;wBACG;4BACA;AAE3B,MAAMA,UAAU,IAAIC,kBAAO,CAAC;AAC5BC,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBA,QAAQG,MAAM,CAACC,kBAAU"}
1
+ {"version":3,"sources":["../../../src/commands/info/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { infoAction } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst command = new Command(\"info\");\naddOptions(\"server\", command);\naddOptions(\"runner\", command);\naddOptions(\"logger\", command);\naddOptions(\"filter\", command);\naddOptions(\"info\", command);\ncommand.action(infoAction);\n\nexport { command as infoCommand };\n"],"names":["infoCommand","command","Command","addOptions","action","infoAction"],"mappings":";;;;+BAYoBA;;;eAAXC;;;2BAZe;wBACG;4BACA;AAE3B,MAAMA,UAAU,IAAIC,kBAAO,CAAC;AAC5BC,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,QAAQF;AACnBA,QAAQG,MAAM,CAACC,kBAAU"}
@@ -46,5 +46,9 @@ declare const optionsWithEnv: {
46
46
  readonly prune: Option;
47
47
  readonly clear: Option;
48
48
  };
49
+ readonly info: {
50
+ readonly outputFile: Option;
51
+ readonly noOptimizeGraph: Option;
52
+ };
49
53
  };
50
54
  export { optionsWithEnv as options };
@@ -66,6 +66,10 @@ const options = {
66
66
  cache: {
67
67
  prune: new _commander.Option("--prune <days>", "Prunes cache older than certain number of <days>").argParser(parseInt).conflicts("--clear"),
68
68
  clear: new _commander.Option("--clear", "Clears the cache locally")
69
+ },
70
+ info: {
71
+ outputFile: new _commander.Option("-o|--output-file <file>", "Output the target graph as json to the specified file."),
72
+ noOptimizeGraph: new _commander.Option("--no-optimize-graph", "Do not optimize the target graph")
69
73
  }
70
74
  };
71
75
  const optionsWithEnv = addEnvOptions(options);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/options.ts"],"sourcesContent":["import { Option } from \"commander\";\n\nconst isCI = process.env.CI || process.env.TF_BUILD;\n\nconst options = {\n logger: {\n reporter: new Option(\"--reporter <reporter...>\", \"reporter\"),\n grouped: new Option(\"--grouped\", \"groups the logs\").default(false),\n progress: new Option(\"--progress\").conflicts([\"reporter\", \"grouped\", \"verbose\"]).default(!isCI),\n logLevel: new Option(\"--log-level <level>\", \"log level\").choices([\"info\", \"warn\", \"error\", \"verbose\", \"silly\"]).conflicts(\"verbose\"),\n logFile: new Option(\"--log-file <file>\", \"when used with --reporter vfl, writes verbose, ungrouped logs to the specified file\"),\n verbose: new Option(\"--verbose\", \"verbose output\").default(false),\n indented: new Option(\"--indented\", \"enabled indentation of the JSON output\").default(false),\n },\n pool: {\n concurrency: new Option(\"-c|--concurrency <number>\", \"max jobs to run at a time\").argParser((v) => parseInt(v)),\n continue: new Option(\"--continue\", \"continue running even after encountering an error for one of the targets\"),\n maxWorkersPerTask: new Option(\n \"--max-workers-per-task <maxWorkersPerTarget...>\",\n \"set max worker per task, e.g. --max-workers-per-task build=2 test=4\"\n ).default([]),\n },\n runner: {\n nodeArg: new Option(\n \"-n|--node-arg <arg>\",\n 'node arguments as a string to be passed into node like a NODE_OPTIONS setting, (e.g. --nodearg=\"--max_old_space_size=1234 --heap-prof\")'\n ),\n },\n run: {\n cache: new Option(\"--no-cache\", \"disables the cache\"),\n resetCache: new Option(\"--reset-cache\", \"resets the cache, filling it after a run\"),\n skipLocalCache: new Option(\"--skip-local-cache\", \"skips caching locally (defaults to true in CI environments)\").default(isCI),\n profile: new Option(\"--profile [profile]\", \"writes a run profile into a file that can be processed by Chromium devtool\"),\n continue: new Option(\"--continue\", \"continues the run even on error\"),\n allowNoTargetRuns: new Option(\"--allow-no-target-runs\"),\n watch: new Option(\"--watch\", \"runs in watch mode\"),\n },\n server: {\n server: new Option(\"--server [host:port]\", \"Run targets of type 'worker' on a background service\"),\n tasks: new Option(\"--tasks <tasks...>\", \"A list of tasks to run, separated by space e.g. 'build test'\"),\n timeout: new Option(\"-t|--timeout <seconds>\", \"lage server autoshutoff timeout\").default(5 * 60).argParser((v) => parseInt(v)),\n },\n filter: {\n scope: new Option(\n \"--scope <scope...>\",\n \"scopes the run to a subset of packages (by default, includes the dependencies and dependents as well)\"\n ),\n noDeps: new Option(\"--no-deps|--no-dependents\", \"disables running any dependents of the scoped packages\"),\n includeDependencies: new Option(\n \"--include-dependencies|--dependencies\",\n 'adds the scoped packages dependencies as the \"entry points\" for the target graph run'\n ),\n to: new Option(\"--to <scope...>\", \"runs up to a package (shorthand for --scope=<scope...> --no-dependents)\"),\n since: new Option(\"--since <since>\", \"only runs packages that have changed since the given commit, tag, or branch\"),\n ignore: new Option(\n \"--ignore <ignore...>\",\n \"ignores files when calculating the scope with `--since` in addition to the files specified in lage.config\"\n ).default([]),\n },\n affected: {\n outputFormat: new Option(\n \"--output-format <graph|json|default>\",\n `Generate a report about what packages are affected by the current change (defaults to human readable format) ` +\n `\"graph\" will generate a GraphViz .dot file format`\n ),\n },\n cache: {\n prune: new Option(\"--prune <days>\", \"Prunes cache older than certain number of <days>\").argParser(parseInt).conflicts(\"--clear\"),\n clear: new Option(\"--clear\", \"Clears the cache locally\"),\n },\n} as const;\n\nconst optionsWithEnv = addEnvOptions(options);\n\nfunction addEnvOptions(opts: typeof options) {\n for (const key in opts) {\n for (const [name, option] of Object.entries<Option>(opts[key])) {\n // convert the camel cased name to uppercase with underscores\n const upperCaseSnakeKey = key.replace(/([A-Z])/g, \"_$1\").toUpperCase();\n const upperCaseSnakeName = name.replace(/([A-Z])/g, \"_$1\").toUpperCase();\n option.env(`LAGE_${upperCaseSnakeKey}_${upperCaseSnakeName}`);\n }\n }\n\n return opts;\n}\n\nexport { optionsWithEnv as options };\n"],"names":["options","optionsWithEnv","isCI","process","env","CI","TF_BUILD","logger","reporter","Option","grouped","default","progress","conflicts","logLevel","choices","logFile","verbose","indented","pool","concurrency","argParser","v","parseInt","continue","maxWorkersPerTask","runner","nodeArg","run","cache","resetCache","skipLocalCache","profile","allowNoTargetRuns","watch","server","tasks","timeout","filter","scope","noDeps","includeDependencies","to","since","ignore","affected","outputFormat","prune","clear","addEnvOptions","opts","key","name","option","Object","entries","upperCaseSnakeKey","replace","toUpperCase","upperCaseSnakeName"],"mappings":";;;;+BAuF2BA;;;eAAlBC;;;2BAvFc;AAEvB,MAAMC,OAAOC,QAAQC,GAAG,CAACC,EAAE,IAAIF,QAAQC,GAAG,CAACE,QAAQ;AAEnD,MAAMN,UAAU;IACdO,QAAQ;QACNC,UAAU,IAAIC,iBAAM,CAAC,4BAA4B;QACjDC,SAAS,IAAID,iBAAM,CAAC,aAAa,mBAAmBE,OAAO,CAAC;QAC5DC,UAAU,IAAIH,iBAAM,CAAC,cAAcI,SAAS,CAAC;YAAC;YAAY;YAAW;SAAU,EAAEF,OAAO,CAAC,CAACT;QAC1FY,UAAU,IAAIL,iBAAM,CAAC,uBAAuB,aAAaM,OAAO,CAAC;YAAC;YAAQ;YAAQ;YAAS;YAAW;SAAQ,EAAEF,SAAS,CAAC;QAC1HG,SAAS,IAAIP,iBAAM,CAAC,qBAAqB;QACzCQ,SAAS,IAAIR,iBAAM,CAAC,aAAa,kBAAkBE,OAAO,CAAC;QAC3DO,UAAU,IAAIT,iBAAM,CAAC,cAAc,0CAA0CE,OAAO,CAAC;IACvF;IACAQ,MAAM;QACJC,aAAa,IAAIX,iBAAM,CAAC,6BAA6B,6BAA6BY,SAAS,CAAC,CAACC,IAAMC,SAASD;QAC5GE,UAAU,IAAIf,i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C,OAAO,IAAIvC,iBAAM,CAAC,WAAW;IAC/B;AACF;AAEA,MAAMR,iBAAiBgD,cAAcjD;AAErC,SAASiD,cAAcC,IAAoB;IACzC,IAAK,MAAMC,OAAOD,KAAM;QACtB,KAAK,MAAM,CAACE,MAAMC,OAAO,IAAIC,OAAOC,OAAO,CAASL,IAAI,CAACC,IAAI,EAAG;YAC9D,6DAA6D;YAC7D,MAAMK,oBAAoBL,IAAIM,OAAO,CAAC,YAAY,OAAOC,WAAW;YACpE,MAAMC,qBAAqBP,KAAKK,OAAO,CAAC,YAAY,OAAOC,WAAW;YACtEL,OAAOjD,GAAG,CAAC,CAAC,KAAK,EAAEoD,kBAAkB,CAAC,EAAEG,oBAAoB;QAC9D;IACF;IAEA,OAAOT;AACT"}
1
+ {"version":3,"sources":["../../src/commands/options.ts"],"sourcesContent":["import { Option } from \"commander\";\n\nconst isCI = process.env.CI || process.env.TF_BUILD;\n\nconst options = {\n logger: {\n reporter: new Option(\"--reporter <reporter...>\", \"reporter\"),\n grouped: new Option(\"--grouped\", \"groups the logs\").default(false),\n progress: new Option(\"--progress\").conflicts([\"reporter\", \"grouped\", \"verbose\"]).default(!isCI),\n logLevel: new Option(\"--log-level <level>\", \"log level\").choices([\"info\", \"warn\", \"error\", \"verbose\", \"silly\"]).conflicts(\"verbose\"),\n logFile: new Option(\"--log-file <file>\", \"when used with --reporter vfl, writes verbose, ungrouped logs to the specified file\"),\n verbose: new Option(\"--verbose\", \"verbose output\").default(false),\n indented: new Option(\"--indented\", \"enabled indentation of the JSON output\").default(false),\n },\n pool: {\n concurrency: new Option(\"-c|--concurrency <number>\", \"max jobs to run at a time\").argParser((v) => parseInt(v)),\n continue: new Option(\"--continue\", \"continue running even after encountering an error for one of the targets\"),\n maxWorkersPerTask: new Option(\n \"--max-workers-per-task <maxWorkersPerTarget...>\",\n \"set max worker per task, e.g. --max-workers-per-task build=2 test=4\"\n ).default([]),\n },\n runner: {\n nodeArg: new Option(\n \"-n|--node-arg <arg>\",\n 'node arguments as a string to be passed into node like a NODE_OPTIONS setting, (e.g. --nodearg=\"--max_old_space_size=1234 --heap-prof\")'\n ),\n },\n run: {\n cache: new Option(\"--no-cache\", \"disables the cache\"),\n resetCache: new Option(\"--reset-cache\", \"resets the cache, filling it after a run\"),\n skipLocalCache: new Option(\"--skip-local-cache\", \"skips caching locally (defaults to true in CI environments)\").default(isCI),\n profile: new Option(\"--profile [profile]\", \"writes a run profile into a file that can be processed by Chromium devtool\"),\n continue: new Option(\"--continue\", \"continues the run even on error\"),\n allowNoTargetRuns: new Option(\"--allow-no-target-runs\"),\n watch: new Option(\"--watch\", \"runs in watch mode\"),\n },\n server: {\n server: new Option(\"--server [host:port]\", \"Run targets of type 'worker' on a background service\"),\n tasks: new Option(\"--tasks <tasks...>\", \"A list of tasks to run, separated by space e.g. 'build test'\"),\n timeout: new Option(\"-t|--timeout <seconds>\", \"lage server autoshutoff timeout\").default(5 * 60).argParser((v) => parseInt(v)),\n },\n filter: {\n scope: new Option(\n \"--scope <scope...>\",\n \"scopes the run to a subset of packages (by default, includes the dependencies and dependents as well)\"\n ),\n noDeps: new Option(\"--no-deps|--no-dependents\", \"disables running any dependents of the scoped packages\"),\n includeDependencies: new Option(\n \"--include-dependencies|--dependencies\",\n 'adds the scoped packages dependencies as the \"entry points\" for the target graph run'\n ),\n to: new Option(\"--to <scope...>\", \"runs up to a package (shorthand for --scope=<scope...> --no-dependents)\"),\n since: new Option(\"--since <since>\", \"only runs packages that have changed since the given commit, tag, or branch\"),\n ignore: new Option(\n \"--ignore <ignore...>\",\n \"ignores files when calculating the scope with `--since` in addition to the files specified in lage.config\"\n ).default([]),\n },\n affected: {\n outputFormat: new Option(\n \"--output-format <graph|json|default>\",\n `Generate a report about what packages are affected by the current change (defaults to human readable format) ` +\n `\"graph\" will generate a GraphViz .dot file format`\n ),\n },\n cache: {\n prune: new Option(\"--prune <days>\", \"Prunes cache older than certain number of <days>\").argParser(parseInt).conflicts(\"--clear\"),\n clear: new Option(\"--clear\", \"Clears the cache locally\"),\n },\n info: {\n outputFile: new Option(\"-o|--output-file <file>\", \"Output the target graph as json to the specified file.\"),\n noOptimizeGraph: new Option(\"--no-optimize-graph\", \"Do not optimize the target graph\"),\n },\n} as const;\n\nconst optionsWithEnv = addEnvOptions(options);\n\nfunction addEnvOptions(opts: typeof options) {\n for (const key in opts) {\n for (const [name, option] of Object.entries<Option>(opts[key])) {\n // convert the camel cased name to uppercase with underscores\n const upperCaseSnakeKey = key.replace(/([A-Z])/g, \"_$1\").toUpperCase();\n const upperCaseSnakeName = name.replace(/([A-Z])/g, \"_$1\").toUpperCase();\n option.env(`LAGE_${upperCaseSnakeKey}_${upperCaseSnakeName}`);\n }\n }\n\n return opts;\n}\n\nexport { optionsWithEnv as options };\n"],"names":["options","optionsWithEnv","isCI","process","env","CI","TF_BUILD","logger","reporter","Option","grouped","default","progress","conflicts","logLevel","choices","logFile","verbose","indented","pool","concurrency","argParser","v","parseInt","continue","maxWorkersPerTask","runner","nodeArg","run","cache","resetCache","skipLocalCache","profile","allowNoTargetRuns","watch","server","tasks","timeout","filter","scope","noDeps","includeDependencies","to","since","ignore","affected","outputFormat","prune","clear","info","outputFile","noOptimizeGraph","addEnvOptions","opts","key","name","option","Object","entries","upperCaseSnakeKey","replace","toUpperCase","upperCaseSnakeName"],"mappings":";;;;+BA2F2BA;;;eAAlBC;;;2BA3Fc;AAEvB,MAAMC,OAAOC,QAAQC,GAAG,CAACC,EAAE,IAAIF,QAAQC,GAAG,CAACE,QAAQ;AAEnD,MAAMN,UAAU;IACdO,QAAQ;QACNC,UAAU,IAAIC,iBAAM,CAAC,4BAA4B;QACjDC,SAAS,IAAID,iBAAM,CAAC,aAAa,mBAAmBE,OAAO,CAAC;QAC5DC,UAAU,IAAIH,iBAAM,CAAC,cAAcI,SAAS,CAAC;YAAC;YAAY;YAAW;SAAU,EAAEF,OAAO,CAAC,CAACT;QAC1FY,UAAU,IAAIL,iBAAM,CAAC,uBAAuB,aAAaM,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IAAI,IAAIjC,iBAAM,CAAC,mBAAmB;QAClCkC,OAAO,IAAIlC,iBAAM,CAAC,mBAAmB;QACrCmC,QAAQ,IAAInC,iBAAM,CAChB,wBACA,6GACAE,OAAO,CAAC,EAAE;IACd;IACAkC,UAAU;QACRC,cAAc,IAAIrC,iBAAM,CACtB,wCACA,CAAC,6GAA6G,CAAC,GAC7G,CAAC,iDAAiD,CAAC;IAEzD;IACAoB,OAAO;QACLkB,OAAO,IAAItC,iBAAM,CAAC,kBAAkB,oDAAoDY,SAAS,CAACE,UAAUV,SAAS,CAAC;QACtHmC,OAAO,IAAIvC,iBAAM,CAAC,WAAW;IAC/B;IACAwC,MAAM;QACJC,YAAY,IAAIzC,iBAAM,CAAC,2BAA2B;QAClD0C,iBAAiB,IAAI1C,iBAAM,CAAC,uBAAuB;IACrD;AACF;AAEA,MAAMR,iBAAiBmD,cAAcpD;AAErC,SAASoD,cAAcC,IAAoB;IACzC,IAAK,MAAMC,OAAOD,KAAM;QACtB,KAAK,MAAM,CAACE,MAAMC,OAAO,IAAIC,OAAOC,OAAO,CAASL,IAAI,CAACC,IAAI,EAAG;YAC9D,6DAA6D;YAC7D,MAAMK,oBAAoBL,IAAIM,OAAO,CAAC,YAAY,OAAOC,WAAW;YACpE,MAAMC,qBAAqBP,KAAKK,OAAO,CAAC,YAAY,OAAOC,WAAW;YACtEL,OAAOpD,GAAG,CAAC,CAAC,KAAK,EAAEuD,kBAAkB,CAAC,EAAEG,oBAAoB;QAC9D;IACF;IAEA,OAAOT;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/cli",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "description": "Command Line Interface for Lage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,12 +25,12 @@
25
25
  "@lage-run/config": "^0.4.12",
26
26
  "@lage-run/format-hrtime": "^0.1.6",
27
27
  "@lage-run/globby": "^14.2.0",
28
- "@lage-run/hasher": "^1.7.0",
28
+ "@lage-run/hasher": "^1.8.0",
29
29
  "@lage-run/logger": "^1.3.1",
30
30
  "@lage-run/reporters": "^1.3.0",
31
- "@lage-run/rpc": "^1.3.0",
31
+ "@lage-run/rpc": "^1.4.0",
32
32
  "@lage-run/runners": "^1.2.1",
33
- "@lage-run/scheduler": "^1.5.2",
33
+ "@lage-run/scheduler": "^1.5.3",
34
34
  "@lage-run/scheduler-types": "^0.3.23",
35
35
  "@lage-run/target-graph": "^0.11.1",
36
36
  "@lage-run/worker-threads-pool": "^0.9.0",
@@ -43,8 +43,8 @@
43
43
  "workspace-tools": "0.38.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@lage-run/monorepo-fixture": "*",
47
- "@lage-run/monorepo-scripts": "*",
46
+ "@lage-run/monorepo-fixture": "^0.1.0",
47
+ "@lage-run/monorepo-scripts": "^1.0.0",
48
48
  "@types/proper-lockfile": "^4.1.4",
49
49
  "@types/shell-quote": "^1.7.5"
50
50
  },