@lage-run/cli 0.33.2 → 0.33.3

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.
@@ -16,7 +16,7 @@ export interface InfoActionOptions extends ReporterInitOptions {
16
16
  outputFile?: string;
17
17
  optimizeGraph: boolean;
18
18
  }
19
- interface PackageTask {
19
+ export interface PackageTask {
20
20
  id: string;
21
21
  command: string[];
22
22
  dependencies: string[];
@@ -57,4 +57,3 @@ export declare function generatePackageTask(target: Target, taskArgs: string[],
57
57
  lage: string;
58
58
  "lage-server": string;
59
59
  }, packageInfos: PackageInfos, tasks: string[]): PackageTask;
60
- export {};
@@ -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, getWorkspaceManagerRoot } 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, hashStrings } from \"@lage-run/hasher\";\nimport { getGlobalInputHashFilePath } from \"../targetHashFilePath.js\";\n\nexport interface 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): Promise<void> {\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 await initializeReporters(logger, options, config.reporters);\n const root = getWorkspaceManagerRoot(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 enableTargetConfigMerging: config.enableTargetConfigMerging,\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\nexport function 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: Target) {\n const cwd = process.cwd();\n const workingDirectory = path.relative(getWorkspaceManagerRoot(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":["generatePackageTask","infoAction","options","command","cwd","process","config","getConfig","logger","createLogger","logLevel","reporter","server","initializeReporters","reporters","root","getWorkspaceManagerRoot","packageInfos","getPackageInfos","tasks","taskArgs","filterArgsForTasks","args","targetGraph","createTargetGraph","dependencies","dependents","to","ignore","concat","pipeline","repoWideChanges","scope","since","outputs","cacheOptions","outputGlob","priorities","enableTargetConfigMerging","getFilteredPackages","includeDependencies","includeDependents","sinceIgnoreGlobs","pickerOptions","runnerPickerOptions","nodeArg","npmClient","runnerPicker","TargetRunnerPicker","createBackwardsCompatGraph","env","optimizeGraph","optimizedTargets","optimizeTargetGraph","binPaths","getBinPaths","packageTasks","map","target","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"],"mappings":";;;;;;;;;;;QAmO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,iBAAiBhI,QAAQ+H,WAAW,CAACE,QAAQ;QAC5D;QAEA,IAAIzE,OAAOoD,WAAW,EAAE;YACtB3G,QAAQ+H,IAAI,CAACxE,OAAOoD,WAAW;QACjC;QAEA,IAAIpD,OAAOqD,IAAI,EAAE;YACf5G,QAAQ+H,IAAI,CAACxE,OAAOqD,IAAI;QAC1B;QAEA5G,QAAQ+H,IAAI,IAAI9G;QAChB,OAAOjB;IACT,OAAO,IAAIuD,OAAO2D,IAAI,KAAK,UAAU;QACnC,MAAMlH,UAAU;YAACmD,SAAS8E,IAAI;YAAE;SAAO;QACvCjI,QAAQ+H,IAAI,CAACxE,OAAOoD,WAAW,IAAI;QACnC3G,QAAQ+H,IAAI,CAACxE,OAAOqD,IAAI;QACxB5G,QAAQ+H,IAAI,IAAI9G;QAChB,OAAOjB;IACT;IAEA,OAAO,EAAE;AACX;AAEA,SAASwG,oBAAoBjD,MAAc;IACzC,MAAMtD,MAAMC,QAAQD,GAAG;IACvB,MAAMsG,mBAAmB7B,aAAI,CAACwD,QAAQ,CAACrH,IAAAA,uCAAuB,EAACZ,QAAQ,IAAIsD,OAAOtD,GAAG,EAAEkI,OAAO,CAAC,OAAO;IACtG,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"}
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, getWorkspaceManagerRoot } 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, hashStrings } from \"@lage-run/hasher\";\nimport { getGlobalInputHashFilePath } from \"../targetHashFilePath.js\";\n\nexport interface 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\nexport interface 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): Promise<void> {\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 await initializeReporters(logger, options, config.reporters);\n const root = getWorkspaceManagerRoot(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 enableTargetConfigMerging: config.enableTargetConfigMerging,\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\nexport function 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: Target) {\n const cwd = process.cwd();\n const workingDirectory = path.relative(getWorkspaceManagerRoot(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":["generatePackageTask","infoAction","options","command","cwd","process","config","getConfig","logger","createLogger","logLevel","reporter","server","initializeReporters","reporters","root","getWorkspaceManagerRoot","packageInfos","getPackageInfos","tasks","taskArgs","filterArgsForTasks","args","targetGraph","createTargetGraph","dependencies","dependents","to","ignore","concat","pipeline","repoWideChanges","scope","since","outputs","cacheOptions","outputGlob","priorities","enableTargetConfigMerging","getFilteredPackages","includeDependencies","includeDependents","sinceIgnoreGlobs","pickerOptions","runnerPickerOptions","nodeArg","npmClient","runnerPicker","TargetRunnerPicker","createBackwardsCompatGraph","env","optimizeGraph","optimizedTargets","optimizeTargetGraph","binPaths","getBinPaths","packageTasks","map","target","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"],"mappings":";;;;;;;;;;;QAmOgBA;eAAAA;;QAnIMC;eAAAA;;;mCA/FY;oCACC;wBAET;gCACkD;qCACxC;+DACX;6DACR;2DACF;4BACO;6BAGwB;qCACV;yBACD;6BACP;qCACQ;mCACF;qCACE;wBACf;wBACmB;oCACG;;;;;;AA0EpC,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;IAC1G,MAAMC,IAAAA,wCAAmB,EAACL,QAAQN,SAASI,OAAOQ,SAAS;IAC3D,MAAMC,OAAOC,IAAAA,uCAAuB,EAACZ;IAErC,MAAMa,eAAeC,IAAAA,+BAAe,EAACH;IAErC,MAAM,EAAEI,KAAK,EAAEC,QAAQ,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AEkI,OAAO,CAAC,OAAO;IACtG,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"}
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "initAction", {
9
9
  }
10
10
  });
11
11
  const _config = require("@lage-run/config");
12
+ const _workspacetools = require("workspace-tools");
12
13
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
13
14
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
14
15
  const _execa = /*#__PURE__*/ _interop_require_default(require("execa"));
@@ -19,37 +20,56 @@ function _interop_require_default(obj) {
19
20
  }
20
21
  async function initAction() {
21
22
  const cwd = process.cwd();
22
- const config = await (0, _config.readConfigFile)(cwd);
23
- if (config) {
24
- console.error("lage is already initialized in this workspace");
23
+ const managerAndRoot = (0, _workspacetools.getWorkspaceManagerAndRoot)(cwd);
24
+ if (!managerAndRoot) {
25
+ console.error("lage only works with workspaces - make sure you are using yarn workspaces, npm workspaces, pnpm workspaces, or rush");
25
26
  process.exitCode = 1;
26
27
  return;
27
28
  }
28
- console.info("Installing lage and creating a default configuration file");
29
- let workspaceManager = "yarn";
30
- try {
31
- workspaceManager = whichWorkspaceManager(cwd);
32
- } catch (e) {
33
- console.error("lage requires you to be using a workspace - make sure you are using yarn workspaces, npm workspaces, pnpm workspaces, or rush");
29
+ const { manager: workspaceManager, root } = managerAndRoot;
30
+ const config = await (0, _config.readConfigFile)(root);
31
+ if (config) {
32
+ console.error("lage is already initialized in this repo");
34
33
  process.exitCode = 1;
35
34
  return;
36
35
  }
37
- const pipeline = {
38
- build: [
39
- "^build"
40
- ],
41
- test: [
42
- "build"
43
- ],
44
- lint: []
45
- };
46
- const lageConfig = {
47
- pipeline,
48
- npmClient: workspaceManager === "yarn" ? "yarn" : "npm"
49
- };
50
- const lageConfigFile = _path.default.join(cwd, "lage.config.js");
51
- _fs.default.writeFileSync(lageConfigFile, "module.exports = " + JSON.stringify(lageConfig, null, 2) + ";");
52
- await installLage(cwd, workspaceManager, pipeline);
36
+ console.info("Installing lage and creating a default configuration file");
37
+ const isMetaManager = workspaceManager === "rush" || workspaceManager === "lerna";
38
+ const npmClientLine = isMetaManager ? "" : `npmClient: "${workspaceManager}",`;
39
+ const lockFile = isMetaManager ? "" : workspaceManager === "yarn" ? "yarn.lock" : workspaceManager === "pnpm" ? "pnpm-lock.yaml" : "package-lock.json";
40
+ const configContent = `// @ts-check
41
+ /** @type {import("lage").ConfigFileOptions} */
42
+ const config = {
43
+ // Define your tasks and their dependencies here
44
+ pipeline: {
45
+ build: ["^build"],
46
+ test: ["build"],
47
+ lint: [],
48
+ },
49
+ ${npmClientLine}
50
+ // Update these according to your repo's build setup
51
+ cacheOptions: {
52
+ // Generated files in each package that will be saved into the cache
53
+ // (relative to package root; folders must end with **/*)
54
+ outputGlob: ["lib/**/*"],
55
+ // Changes to any of these files/globs will invalidate the cache (relative to repo root;
56
+ // folders must end with **/*). This should include your lock file and any other repo-wide
57
+ // configs or scripts that are outside a package but could invalidate previous output.
58
+ environmentGlob: ${JSON.stringify([
59
+ "package.json",
60
+ lockFile,
61
+ "lage.config.js"
62
+ ].filter(Boolean))},
63
+ },
64
+ };
65
+ module.exports = config;
66
+ `;
67
+ _fs.default.writeFileSync(_path.default.join(root, "lage.config.js"), configContent);
68
+ await installLage(root, workspaceManager, [
69
+ "build",
70
+ "test",
71
+ "lint"
72
+ ]);
53
73
  console.info(`Lage is initialized! You can now run: ${getBuildCommand(workspaceManager)}`);
54
74
  }
55
75
  function getBuildCommand(workspaceManager) {
@@ -58,33 +78,16 @@ function getBuildCommand(workspaceManager) {
58
78
  return "yarn lage build";
59
79
  case "pnpm":
60
80
  return "pnpm run lage build";
61
- case "rush":
62
- case "npm":
81
+ default:
63
82
  return "npm run lage build";
64
83
  }
65
84
  }
66
- function whichWorkspaceManager(cwd) {
67
- const packageJson = readPackageJson(cwd);
68
- if (_fs.default.existsSync(_path.default.join(cwd, "rush.json"))) {
69
- return "rush";
70
- }
71
- if (_fs.default.existsSync(_path.default.join(cwd, "yarn.lock")) && packageJson.workspaces) {
72
- return "yarn";
73
- }
74
- if (_fs.default.existsSync(_path.default.join(cwd, "pnpm-workspace.yaml"))) {
75
- return "pnpm";
76
- }
77
- if (_fs.default.existsSync(_path.default.join(cwd, "package-lock.json")) && packageJson.workspaces) {
78
- return "npm";
79
- }
80
- throw new Error("not a workspace");
81
- }
82
- async function installLage(cwd, workspaceManager, pipeline) {
85
+ async function installLage(cwd, workspaceManager, scripts) {
83
86
  var _packageJson;
84
87
  const lageVersion = getLageVersion();
85
88
  const packageJson = readPackageJson(cwd);
86
89
  (_packageJson = packageJson).scripts ?? (_packageJson.scripts = {});
87
- for (const script of Object.keys(pipeline)){
90
+ for (const script of scripts){
88
91
  packageJson.scripts[script] = `lage ${script}`;
89
92
  }
90
93
  if (workspaceManager === "rush") {
@@ -105,13 +108,12 @@ async function installLage(cwd, workspaceManager, pipeline) {
105
108
  }
106
109
  }
107
110
  function getLageVersion() {
108
- const lagePackageJsonFile = require.resolve("../../package.json", {
109
- paths: [
110
- __dirname
111
- ]
112
- });
113
- const lagePackageJson = JSON.parse(_fs.default.readFileSync(lagePackageJsonFile, "utf-8"));
114
- return lagePackageJson.version;
111
+ // NOTE: this would give the wrong version prior to bundling of the `lage` package
112
+ const lagePackageInfo = (0, _workspacetools.getPackageInfo)(__dirname);
113
+ if (!lagePackageInfo) {
114
+ throw new Error("Could not find lage package root");
115
+ }
116
+ return lagePackageInfo.version;
115
117
  }
116
118
  function writePackageJson(cwd, packageJson) {
117
119
  const packageJsonFile = _path.default.join(cwd, "package.json");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/init/action.ts"],"sourcesContent":["/* eslint-disable no-console -- logger doesn't work in this context */\nimport { readConfigFile } from \"@lage-run/config\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport execa from \"execa\";\n\ntype WorkspaceManager = \"rush\" | \"pnpm\" | \"yarn\" | \"npm\";\n\nexport async function initAction(): Promise<void> {\n const cwd = process.cwd();\n\n const config = await readConfigFile(cwd);\n if (config) {\n console.error(\"lage is already initialized in this workspace\");\n process.exitCode = 1;\n return;\n }\n\n console.info(\"Installing lage and creating a default configuration file\");\n\n let workspaceManager: WorkspaceManager = \"yarn\";\n\n try {\n workspaceManager = whichWorkspaceManager(cwd);\n } catch (e) {\n console.error(\n \"lage requires you to be using a workspace - make sure you are using yarn workspaces, npm workspaces, pnpm workspaces, or rush\"\n );\n process.exitCode = 1;\n return;\n }\n\n const pipeline = {\n build: [\"^build\"],\n test: [\"build\"],\n lint: [],\n };\n\n const lageConfig = {\n pipeline,\n npmClient: workspaceManager === \"yarn\" ? \"yarn\" : \"npm\",\n };\n\n const lageConfigFile = path.join(cwd, \"lage.config.js\");\n fs.writeFileSync(lageConfigFile, \"module.exports = \" + JSON.stringify(lageConfig, null, 2) + \";\");\n\n await installLage(cwd, workspaceManager, pipeline);\n\n console.info(`Lage is initialized! You can now run: ${getBuildCommand(workspaceManager)}`);\n}\n\nfunction getBuildCommand(workspaceManager: WorkspaceManager) {\n switch (workspaceManager) {\n case \"yarn\":\n return \"yarn lage build\";\n\n case \"pnpm\":\n return \"pnpm run lage build\";\n\n case \"rush\":\n case \"npm\":\n return \"npm run lage build\";\n }\n}\n\nfunction whichWorkspaceManager(cwd: string) {\n const packageJson = readPackageJson(cwd);\n\n if (fs.existsSync(path.join(cwd, \"rush.json\"))) {\n return \"rush\";\n }\n\n if (fs.existsSync(path.join(cwd, \"yarn.lock\")) && packageJson.workspaces) {\n return \"yarn\";\n }\n\n if (fs.existsSync(path.join(cwd, \"pnpm-workspace.yaml\"))) {\n return \"pnpm\";\n }\n\n if (fs.existsSync(path.join(cwd, \"package-lock.json\")) && packageJson.workspaces) {\n return \"npm\";\n }\n\n throw new Error(\"not a workspace\");\n}\n\nasync function installLage(cwd: string, workspaceManager: WorkspaceManager, pipeline: Record<string, string[]>) {\n const lageVersion = getLageVersion();\n const packageJson = readPackageJson(cwd);\n packageJson.scripts ??= {};\n for (const script of Object.keys(pipeline)) {\n packageJson.scripts[script] = `lage ${script}`;\n }\n\n if (workspaceManager === \"rush\") {\n packageJson.scripts.lage = `node common/scripts/install-run.js lage@${lageVersion} lage`;\n writePackageJson(cwd, packageJson);\n } else {\n packageJson.scripts.lage = \"lage\";\n packageJson.devDependencies ??= {};\n packageJson.devDependencies.lage = lageVersion;\n writePackageJson(cwd, packageJson);\n\n await execa(workspaceManager, [\"install\"], { stdio: \"inherit\", shell: true });\n }\n}\n\nfunction getLageVersion() {\n const lagePackageJsonFile = require.resolve(\"../../package.json\", {\n paths: [__dirname],\n });\n const lagePackageJson = JSON.parse(fs.readFileSync(lagePackageJsonFile, \"utf-8\"));\n return lagePackageJson.version;\n}\n\nfunction writePackageJson(cwd: string, packageJson: any) {\n const packageJsonFile = path.join(cwd, \"package.json\");\n fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2));\n}\n\nfunction readPackageJson(cwd: string): {\n scripts?: Record<string, string>;\n devDependencies?: Record<string, string>;\n workspaces?: any;\n} {\n const packageJsonFile = path.join(cwd, \"package.json\");\n return JSON.parse(fs.readFileSync(packageJsonFile, \"utf-8\"));\n}\n"],"names":["initAction","cwd","process","config","readConfigFile","console","error","exitCode","info","workspaceManager","whichWorkspaceManager","e","pipeline","build","test","lint","lageConfig","npmClient","lageConfigFile","path","join","fs","writeFileSync","JSON","stringify","installLage","getBuildCommand","packageJson","readPackageJson","existsSync","workspaces","Error","lageVersion","getLageVersion","scripts","script","Object","keys","lage","writePackageJson","devDependencies","execa","stdio","shell","lagePackageJsonFile","require","resolve","paths","__dirname","lagePackageJson","parse","readFileSync","version","packageJsonFile"],"mappings":"AAAA,oEAAoE;;;;+BAQ9CA;;;eAAAA;;;wBAPS;2DAChB;6DACE;8DACC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,aAAI,CAACC,IAAI,CAACnB,KAAK;IACvCoB,WAAE,CAACC,aAAa,CAAC+B,iBAAiB9B,KAAKC,SAAS,CAACG,aAAa,MAAM;AACtE;AAEA,SAASC,gBAAgB3B,GAAW;IAKlC,MAAMoD,kBAAkBlC,aAAI,CAACC,IAAI,CAACnB,KAAK;IACvC,OAAOsB,KAAK2B,KAAK,CAAC7B,WAAE,CAAC8B,YAAY,CAACE,iBAAiB;AACrD"}
1
+ {"version":3,"sources":["../../../src/commands/init/action.ts"],"sourcesContent":["/* eslint-disable no-console -- logger doesn't work in this context */\nimport { readConfigFile } from \"@lage-run/config\";\nimport { getPackageInfo, getWorkspaceManagerAndRoot, type WorkspaceManager } from \"workspace-tools\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport execa from \"execa\";\n\nexport async function initAction(): Promise<void> {\n const cwd = process.cwd();\n\n const managerAndRoot = getWorkspaceManagerAndRoot(cwd);\n if (!managerAndRoot) {\n console.error(\"lage only works with workspaces - make sure you are using yarn workspaces, npm workspaces, pnpm workspaces, or rush\");\n process.exitCode = 1;\n return;\n }\n\n const { manager: workspaceManager, root } = managerAndRoot;\n const config = await readConfigFile(root);\n if (config) {\n console.error(\"lage is already initialized in this repo\");\n process.exitCode = 1;\n return;\n }\n\n console.info(\"Installing lage and creating a default configuration file\");\n\n const isMetaManager = workspaceManager === \"rush\" || workspaceManager === \"lerna\";\n const npmClientLine = isMetaManager ? \"\" : `npmClient: \"${workspaceManager}\",`;\n const lockFile = isMetaManager\n ? \"\"\n : workspaceManager === \"yarn\"\n ? \"yarn.lock\"\n : workspaceManager === \"pnpm\"\n ? \"pnpm-lock.yaml\"\n : \"package-lock.json\";\n\n const configContent = `// @ts-check\n/** @type {import(\"lage\").ConfigFileOptions} */\nconst config = {\n // Define your tasks and their dependencies here\n pipeline: {\n build: [\"^build\"],\n test: [\"build\"],\n lint: [],\n },\n ${npmClientLine}\n // Update these according to your repo's build setup\n cacheOptions: {\n // Generated files in each package that will be saved into the cache\n // (relative to package root; folders must end with **/*)\n outputGlob: [\"lib/**/*\"],\n // Changes to any of these files/globs will invalidate the cache (relative to repo root;\n // folders must end with **/*). This should include your lock file and any other repo-wide\n // configs or scripts that are outside a package but could invalidate previous output.\n environmentGlob: ${JSON.stringify([\"package.json\", lockFile, \"lage.config.js\"].filter(Boolean))},\n },\n};\nmodule.exports = config;\n`;\n\n fs.writeFileSync(path.join(root, \"lage.config.js\"), configContent);\n\n await installLage(root, workspaceManager, [\"build\", \"test\", \"lint\"]);\n\n console.info(`Lage is initialized! You can now run: ${getBuildCommand(workspaceManager)}`);\n}\n\nfunction getBuildCommand(workspaceManager: WorkspaceManager) {\n switch (workspaceManager) {\n case \"yarn\":\n return \"yarn lage build\";\n\n case \"pnpm\":\n return \"pnpm run lage build\";\n\n default:\n return \"npm run lage build\";\n }\n}\n\nasync function installLage(cwd: string, workspaceManager: WorkspaceManager, scripts: string[]) {\n const lageVersion = getLageVersion();\n const packageJson = readPackageJson(cwd);\n packageJson.scripts ??= {};\n for (const script of scripts) {\n packageJson.scripts[script] = `lage ${script}`;\n }\n\n if (workspaceManager === \"rush\") {\n packageJson.scripts.lage = `node common/scripts/install-run.js lage@${lageVersion} lage`;\n writePackageJson(cwd, packageJson);\n } else {\n packageJson.scripts.lage = \"lage\";\n packageJson.devDependencies ??= {};\n packageJson.devDependencies.lage = lageVersion;\n writePackageJson(cwd, packageJson);\n\n await execa(workspaceManager, [\"install\"], { stdio: \"inherit\", shell: true });\n }\n}\n\nfunction getLageVersion() {\n // NOTE: this would give the wrong version prior to bundling of the `lage` package\n const lagePackageInfo = getPackageInfo(__dirname);\n if (!lagePackageInfo) {\n throw new Error(\"Could not find lage package root\");\n }\n return lagePackageInfo.version;\n}\n\nfunction writePackageJson(cwd: string, packageJson: any) {\n const packageJsonFile = path.join(cwd, \"package.json\");\n fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2));\n}\n\nfunction readPackageJson(cwd: string): {\n scripts?: Record<string, string>;\n devDependencies?: Record<string, string>;\n workspaces?: any;\n} {\n const packageJsonFile = path.join(cwd, \"package.json\");\n return JSON.parse(fs.readFileSync(packageJsonFile, \"utf-8\"));\n}\n"],"names":["initAction","cwd","process","managerAndRoot","getWorkspaceManagerAndRoot","console","error","exitCode","manager","workspaceManager","root","config","readConfigFile","info","isMetaManager","npmClientLine","lockFile","configContent","JSON","stringify","filter","Boolean","fs","writeFileSync","path","join","installLage","getBuildCommand","scripts","packageJson","lageVersion","getLageVersion","readPackageJson","script","lage","writePackageJson","devDependencies","execa","stdio","shell","lagePackageInfo","getPackageInfo","__dirname","Error","version","packageJsonFile","parse","readFileSync"],"mappings":"AAAA,oEAAoE;;;;+BAO9CA;;;eAAAA;;;wBANS;gCACmD;2DACnE;6DACE;8DACC;;;;;;AAEX,eAAeA;IACpB,MAAMC,MAAMC,QAAQD,GAAG;IAEvB,MAAME,iBAAiBC,IAAAA,0CAA0B,EAACH;IAClD,IAAI,CAACE,gBAAgB;QACnBE,QAAQC,KAAK,CAAC;QACdJ,QAAQK,QAAQ,GAAG;QACnB;IACF;IAEA,MAAM,EAAEC,SAASC,gBAAgB,EAAEC,IAAI,EAAE,GAAGP;IAC5C,MAAMQ,SAAS,MAAMC,IAAAA,sBAAc,EAACF;IACpC,IAAIC,QAAQ;QACVN,QAAQC,KAAK,CAAC;QACdJ,QAAQK,QAAQ,GAAG;QACnB;IACF;IAEAF,QAAQQ,IAAI,CAAC;IAEb,MAAMC,gBAAgBL,qBAAqB,UAAUA,qBAAqB;IAC1E,MAAMM,gBAAgBD,gBAAgB,KAAK,CAAC,YAAY,EAAEL,iBAAiB,EAAE,CAAC;IAC9E,MAAMO,WAAWF,gBACb,KACAL,qBAAqB,SACnB,cACAA,qBAAqB,SACnB,mBACA;IAER,MAAMQ,gBAAgB,CAAC;;;;;;;;;EASvB,EAAEF,cAAc;;;;;;;;;qBASG,EAAEG,KAAKC,SAAS,CAAC;QAAC;QAAgBH;QAAU;KAAiB,CAACI,MAAM,C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AAgBI,OAAO;AAChC;AAEA,SAAST,iBAAiBlC,GAAW,EAAE4B,WAAgB;IACrD,MAAMgB,kBAAkBrB,aAAI,CAACC,IAAI,CAACxB,KAAK;IACvCqB,WAAE,CAACC,aAAa,CAACsB,iBAAiB3B,KAAKC,SAAS,CAACU,aAAa,MAAM;AACtE;AAEA,SAASG,gBAAgB/B,GAAW;IAKlC,MAAM4C,kBAAkBrB,aAAI,CAACC,IAAI,CAACxB,KAAK;IACvC,OAAOiB,KAAK4B,KAAK,CAACxB,WAAE,CAACyB,YAAY,CAACF,iBAAiB;AACrD"}
@@ -1,5 +1,5 @@
1
1
  import type { Logger } from "@lage-run/logger";
2
- export interface launchServerInBackgroundOptions {
2
+ export interface LaunchServerInBackgroundOptions {
3
3
  logger: Logger;
4
4
  root: string;
5
5
  host: string;
@@ -9,4 +9,4 @@ export interface launchServerInBackgroundOptions {
9
9
  args: string[];
10
10
  nodeArg?: string;
11
11
  }
12
- export declare function launchServerInBackground({ logger, root, host, port, tasks, timeout, args, nodeArg, }: launchServerInBackgroundOptions): Promise<void>;
12
+ export declare function launchServerInBackground({ logger, root, host, port, tasks, timeout, args, nodeArg, }: LaunchServerInBackgroundOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/launchServerInBackground.ts"],"sourcesContent":["import type { Logger } from \"@lage-run/logger\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport lockfile from \"proper-lockfile\";\nimport execa from \"execa\";\nimport { getBinScripts } from \"../getBinPaths.js\";\n\nexport interface launchServerInBackgroundOptions {\n logger: Logger;\n root: string;\n host: string;\n port: number;\n tasks: string[];\n timeout: number;\n args: string[];\n nodeArg?: string;\n}\n\nexport async function launchServerInBackground({\n logger,\n root,\n host,\n port,\n tasks,\n timeout,\n args,\n nodeArg,\n}: launchServerInBackgroundOptions): Promise<void> {\n const lockfilePath = path.join(root, `node_modules/.cache/lage/.lage-server-${host}-${port}.pid`);\n\n logger.info(`Starting server on http://${host}:${port}`);\n logger.info(`acquiring lock: ${lockfilePath}`);\n\n ensurePidFile(lockfilePath);\n\n const releaseLock = await lockfile.lock(lockfilePath, {\n stale: 1000 * 60 * 1,\n retries: {\n retries: 10,\n factor: 3,\n minTimeout: 0.5 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n },\n });\n\n const pid = parseInt(fs.readFileSync(lockfilePath, \"utf-8\"));\n const isServerRunning = pid && isAlive(pid);\n logger.info(\"Checking if server is already running\", { pid, isServerRunning });\n if (pid && isServerRunning) {\n logger.info(\"Server already running\", { pid });\n } else {\n const binScripts = getBinScripts();\n\n const lageServerBinPath = binScripts[\"lage-server\"];\n const lageServerArgs = [\n ...(nodeArg ? [\"--node-arg\", nodeArg] : []),\n lageServerBinPath,\n \"--tasks\",\n ...tasks,\n \"--server\",\n `${host}:${port}`,\n \"--timeout\",\n `${timeout}`,\n ...args,\n ];\n\n logger.info(`Launching lage-server with these parameters: ${lageServerArgs.join(\" \")}`);\n const child = execa(\"node\", lageServerArgs, {\n cwd: root,\n detached: true,\n stdio: \"ignore\",\n maxBuffer: 1024 * 1024 * 100,\n });\n\n if (child && child.pid) {\n fs.writeFileSync(lockfilePath, child.pid.toString());\n }\n\n child.unref();\n logger.info(\"Server started\", { pid: child.pid });\n }\n\n await releaseLock();\n}\n\nfunction ensurePidFile(lockfilePath: string) {\n if (!fs.existsSync(path.dirname(lockfilePath))) {\n fs.mkdirSync(path.dirname(lockfilePath), { recursive: true });\n }\n\n if (!fs.existsSync(lockfilePath)) {\n try {\n const fd = fs.openSync(lockfilePath, \"w\");\n fs.closeSync(fd);\n } catch {\n // ignore\n }\n }\n}\n\nfunction isAlive(pid: number) {\n try {\n return process.kill(pid, 0);\n } catch {\n return false;\n }\n}\n"],"names":["launchServerInBackground","logger","root","host","port","tasks","timeout","args","nodeArg","lockfilePath","path","join","info","ensurePidFile","releaseLock","lockfile","lock","stale","retries","factor","minTimeout","maxTimeout","randomize","pid","parseInt","fs","readFileSync","isServerRunning","isAlive","binScripts","getBinScripts","lageServerBinPath","lageServerArgs","child","execa","cwd","detached","stdio","maxBuffer","writeFileSync","toString","unref","existsSync","dirname","mkdirSync","recursive","fd","openSync","closeSync","process","kill"],"mappings":";;;;+BAkBsBA;;;eAAAA;;;2DAjBP;6DACE;uEACI;8DACH;6BACY;;;;;;AAavB,eAAeA,yBAAyB,EAC7CC,MAAM,EACNC,IAAI,EACJC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,OAAO,EACPC,IAAI,EACJC,OAAO,EACyB;IAChC,MAAMC,eAAeC,aAAI,CAACC,IAAI,CAACT,MAAM,CAAC,sCAAsC,EAAEC,KAAK,CAAC,EAAEC,KAAK,IAAI,CAAC;IAEhGH,OAAOW,IAAI,CAAC,CAAC,0BAA0B,EAAET,KAAK,CAAC,EAAEC,MAAM;IACvDH,OAAOW,IAAI,CAAC,CAAC,gBAAgB,EAAEH,cAAc;IAE7CI,cAAcJ;IAEd,MAAMK,cAAc,MAAMC,uBAAQ,CAACC,IAAI,CAACP,cAAc;QACpDQ,OAAO,OAAO,KAAK;QACnBC,SAAS;YACPA,SAAS;YACTC,QAAQ;YACRC,YAAY,MAAM;YAClBC,YAAY,KAAK;YACjBC,WAAW;QACb;IACF;IAEA,MAAMC,MAAMC,SAASC,WAAE,CAACC,YAAY,CAACjB,cAAc;IACnD,MAAMkB,kBAAkBJ,OAAOK,QAAQL;IACvCtB,OAAOW,IAAI,CAAC,yCAAyC;QAAEW;QAAKI;IAAgB;IAC5E,IAAIJ,OAAOI,iBAAiB;QAC1B1B,OAAOW,IAAI,CAAC,0BAA0B;YAAEW;QAAI;IAC9C,OAAO;QACL,MAAMM,aAAaC,IAAAA,0BAAa;QAEhC,MAAMC,oBAAoBF,UAAU,CAAC,cAAc;QACnD,MAAMG,iBAAiB;eACjBxB,UAAU;gBAAC;gBAAcA;aAAQ,GAAG,EAAE;YAC1CuB;YACA;eACG1B;YACH;YACA,GAAGF,KAAK,CAAC,EAAEC,MAAM;YACjB;YACA,GAAGE,SAAS;eACTC;SACJ;QAEDN,OAAOW,IAAI,CAAC,CAAC,6CAA6C,EAAEoB,eAAerB,IAAI,CAAC,MAAM;QACtF,MAAMsB,QAAQC,IAAAA,cAAK,EAAC,QAAQF,gBAAgB;YAC1CG,KAAKjC;YACLkC,UAAU;YACVC,OAAO;YACPC,WAAW,OAAO,OAAO;QAC3B;QAEA,IAAIL,SAASA,MAAMV,GAAG,EAAE;YACtBE,WAAE,CAACc,aAAa,CAAC9B,cAAcwB,MAAMV,GAAG,CAACiB,QAAQ;QACnD;QAEAP,MAAMQ,KAAK;QACXxC,OAAOW,IAAI,CAAC,kBAAkB;YAAEW,KAAKU,MAAMV,GAAG;QAAC;IACjD;IAEA,MAAMT;AACR;AAEA,SAASD,cAAcJ,YAAoB;IACzC,IAAI,CAACgB,WAAE,CAACiB,UAAU,CAAChC,aAAI,CAACiC,OAAO,CAAClC,gBAAgB;QAC9CgB,WAAE,CAACmB,SAAS,CAAClC,aAAI,CAACiC,OAAO,CAAClC,eAAe;YAAEoC,WAAW;QAAK;IAC7D;IAEA,IAAI,CAACpB,WAAE,CAACiB,UAAU,CAACjC,eAAe;QAChC,IAAI;YACF,MAAMqC,KAAKrB,WAAE,CAACsB,QAAQ,CAACtC,cAAc;YACrCgB,WAAE,CAACuB,SAAS,CAACF;QACf,EAAE,OAAM;QACN,SAAS;QACX;IACF;AACF;AAEA,SAASlB,QAAQL,GAAW;IAC1B,IAAI;QACF,OAAO0B,QAAQC,IAAI,CAAC3B,KAAK;IAC3B,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../src/commands/launchServerInBackground.ts"],"sourcesContent":["import type { Logger } from \"@lage-run/logger\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport lockfile from \"proper-lockfile\";\nimport execa from \"execa\";\nimport { getBinScripts } from \"../getBinPaths.js\";\n\nexport interface LaunchServerInBackgroundOptions {\n logger: Logger;\n root: string;\n host: string;\n port: number;\n tasks: string[];\n timeout: number;\n args: string[];\n nodeArg?: string;\n}\n\nexport async function launchServerInBackground({\n logger,\n root,\n host,\n port,\n tasks,\n timeout,\n args,\n nodeArg,\n}: LaunchServerInBackgroundOptions): Promise<void> {\n const lockfilePath = path.join(root, `node_modules/.cache/lage/.lage-server-${host}-${port}.pid`);\n\n logger.info(`Starting server on http://${host}:${port}`);\n logger.info(`acquiring lock: ${lockfilePath}`);\n\n ensurePidFile(lockfilePath);\n\n const releaseLock = await lockfile.lock(lockfilePath, {\n stale: 1000 * 60 * 1,\n retries: {\n retries: 10,\n factor: 3,\n minTimeout: 0.5 * 1000,\n maxTimeout: 60 * 1000,\n randomize: true,\n },\n });\n\n const pid = parseInt(fs.readFileSync(lockfilePath, \"utf-8\"));\n const isServerRunning = pid && isAlive(pid);\n logger.info(\"Checking if server is already running\", { pid, isServerRunning });\n if (pid && isServerRunning) {\n logger.info(\"Server already running\", { pid });\n } else {\n const binScripts = getBinScripts();\n\n const lageServerBinPath = binScripts[\"lage-server\"];\n const lageServerArgs = [\n ...(nodeArg ? [\"--node-arg\", nodeArg] : []),\n lageServerBinPath,\n \"--tasks\",\n ...tasks,\n \"--server\",\n `${host}:${port}`,\n \"--timeout\",\n `${timeout}`,\n ...args,\n ];\n\n logger.info(`Launching lage-server with these parameters: ${lageServerArgs.join(\" \")}`);\n const child = execa(\"node\", lageServerArgs, {\n cwd: root,\n detached: true,\n stdio: \"ignore\",\n maxBuffer: 1024 * 1024 * 100,\n });\n\n if (child && child.pid) {\n fs.writeFileSync(lockfilePath, child.pid.toString());\n }\n\n child.unref();\n logger.info(\"Server started\", { pid: child.pid });\n }\n\n await releaseLock();\n}\n\nfunction ensurePidFile(lockfilePath: string) {\n if (!fs.existsSync(path.dirname(lockfilePath))) {\n fs.mkdirSync(path.dirname(lockfilePath), { recursive: true });\n }\n\n if (!fs.existsSync(lockfilePath)) {\n try {\n const fd = fs.openSync(lockfilePath, \"w\");\n fs.closeSync(fd);\n } catch {\n // ignore\n }\n }\n}\n\nfunction isAlive(pid: number) {\n try {\n return process.kill(pid, 0);\n } catch {\n return false;\n }\n}\n"],"names":["launchServerInBackground","logger","root","host","port","tasks","timeout","args","nodeArg","lockfilePath","path","join","info","ensurePidFile","releaseLock","lockfile","lock","stale","retries","factor","minTimeout","maxTimeout","randomize","pid","parseInt","fs","readFileSync","isServerRunning","isAlive","binScripts","getBinScripts","lageServerBinPath","lageServerArgs","child","execa","cwd","detached","stdio","maxBuffer","writeFileSync","toString","unref","existsSync","dirname","mkdirSync","recursive","fd","openSync","closeSync","process","kill"],"mappings":";;;;+BAkBsBA;;;eAAAA;;;2DAjBP;6DACE;uEACI;8DACH;6BACY;;;;;;AAavB,eAAeA,yBAAyB,EAC7CC,MAAM,EACNC,IAAI,EACJC,IAAI,EACJC,IAAI,EACJC,KAAK,EACLC,OAAO,EACPC,IAAI,EACJC,OAAO,EACyB;IAChC,MAAMC,eAAeC,aAAI,CAACC,IAAI,CAACT,MAAM,CAAC,sCAAsC,EAAEC,KAAK,CAAC,EAAEC,KAAK,IAAI,CAAC;IAEhGH,OAAOW,IAAI,CAAC,CAAC,0BAA0B,EAAET,KAAK,CAAC,EAAEC,MAAM;IACvDH,OAAOW,IAAI,CAAC,CAAC,gBAAgB,EAAEH,cAAc;IAE7CI,cAAcJ;IAEd,MAAMK,cAAc,MAAMC,uBAAQ,CAACC,IAAI,CAACP,cAAc;QACpDQ,OAAO,OAAO,KAAK;QACnBC,SAAS;YACPA,SAAS;YACTC,QAAQ;YACRC,YAAY,MAAM;YAClBC,YAAY,KAAK;YACjBC,WAAW;QACb;IACF;IAEA,MAAMC,MAAMC,SAASC,WAAE,CAACC,YAAY,CAACjB,cAAc;IACnD,MAAMkB,kBAAkBJ,OAAOK,QAAQL;IACvCtB,OAAOW,IAAI,CAAC,yCAAyC;QAAEW;QAAKI;IAAgB;IAC5E,IAAIJ,OAAOI,iBAAiB;QAC1B1B,OAAOW,IAAI,CAAC,0BAA0B;YAAEW;QAAI;IAC9C,OA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
15
  logger: {
16
16
  reporter: new _commander.Option("--reporter <reporter...>", `log reporter (built-in choices: ${_ReporterInitOptions.logBuiltInReporterNames.join(", ")})`),
17
17
  grouped: new _commander.Option("--grouped", "groups the logs").default(false),
18
- progress: new _commander.Option("--progress").conflicts([
18
+ progress: new _commander.Option("--progress", "show progress").conflicts([
19
19
  "reporter",
20
20
  "grouped",
21
21
  "verbose"
@@ -34,10 +34,10 @@ const options = {
34
34
  pool: {
35
35
  concurrency: new _commander.Option("-c|--concurrency <number>", "max jobs to run at a time").argParser((v)=>parseInt(v)),
36
36
  continue: new _commander.Option("--continue", "continue running even after encountering an error for one of the targets"),
37
- maxWorkersPerTask: new _commander.Option("--max-workers-per-task <maxWorkersPerTarget...>", "set max worker per task, e.g. --max-workers-per-task build=2 test=4").default([])
37
+ maxWorkersPerTask: new _commander.Option("--max-workers-per-task <values...>", "set max worker per task, e.g. --max-workers-per-task build=2 test=4").default([])
38
38
  },
39
39
  runner: {
40
- nodeArg: new _commander.Option("-n|--node-arg <arg>", '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")')
40
+ nodeArg: new _commander.Option("-n|--node-arg <arg>", 'node arguments for workers and child processes (like NODE_OPTIONS) as a single string (e.g. --node-arg="--max_old_space_size=1234 --heap-prof")')
41
41
  },
42
42
  run: {
43
43
  cache: new _commander.Option("--no-cache", "disables the cache"),
@@ -45,7 +45,7 @@ const options = {
45
45
  skipLocalCache: new _commander.Option("--skip-local-cache", "skips caching locally (defaults to true in CI environments)").default(isCI),
46
46
  profile: new _commander.Option("--profile [profile]", "writes a run profile into a file that can be processed by Chromium devtool"),
47
47
  continue: new _commander.Option("--continue", "continues the run even on error"),
48
- allowNoTargetRuns: new _commander.Option("--allow-no-target-runs"),
48
+ allowNoTargetRuns: new _commander.Option("--allow-no-target-runs", "succeed even if no targets match the given name"),
49
49
  watch: new _commander.Option("--watch", "runs in watch mode")
50
50
  },
51
51
  server: {
@@ -62,7 +62,7 @@ const options = {
62
62
  ignore: new _commander.Option("--ignore <ignore...>", "ignores files when calculating the scope with `--since` in addition to the files specified in lage.config").default([])
63
63
  },
64
64
  affected: {
65
- outputFormat: new _commander.Option("--output-format <graph|json|default>", `Generate a report about what packages are affected by the current change (defaults to human readable format) ` + `"graph" will generate a GraphViz .dot file format`)
65
+ outputFormat: new _commander.Option("--output-format <graph|json|default>", `Generate a report about what packages are affected by the current change (defaults to human readable format). ` + `"graph" will generate a GraphViz .dot file format`)
66
66
  },
67
67
  cache: {
68
68
  prune: new _commander.Option("--prune <days>", "Prunes cache older than certain number of <days>").argParser(parseInt).conflicts("--clear"),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/commands/options.ts"],"sourcesContent":["import { Option } from \"commander\";\nimport { logBuiltInReporterNames } from \"../types/ReporterInitOptions.js\";\n\nconst isCI = process.env.CI || process.env.TF_BUILD;\n\ninterface Options {\n // Groupings of options\n logger: { [key: string]: Option };\n pool: { [key: string]: Option };\n runner: { [key: string]: Option };\n run: { [key: string]: Option };\n server: { [key: string]: Option };\n filter: { [key: string]: Option };\n affected: { [key: string]: Option };\n cache: { [key: string]: Option };\n info: { [key: string]: Option };\n}\n\nconst options: Options = {\n logger: {\n reporter: new Option(\"--reporter <reporter...>\", `log reporter (built-in choices: ${logBuiltInReporterNames.join(\", \")})`),\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: Options = addEnvOptions(options);\n\nfunction addEnvOptions(opts: typeof options) {\n for (const key in opts) {\n for (const [name, option] of Object.entries<Option>((opts as any)[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","logBuiltInReporterNames","join","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":";;;;+BAyG2BA;;;eAAlBC;;;2BAzGc;qCACiB;AAExC,MAAMC,OAAOC,QAAQC,GAAG,CAACC,EAAE,IAAIF,QAAQC,GAAG,CAACE,QAAQ;AAenD,MAAMN,UAAmB;IACvBO,QAAQ;QACNC,UAAU,IAAI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;QAC9D;IACF;IAEA,OAAOT;AACT"}
1
+ {"version":3,"sources":["../../src/commands/options.ts"],"sourcesContent":["import { Option } from \"commander\";\nimport { logBuiltInReporterNames } from \"../types/ReporterInitOptions.js\";\n\nconst isCI = process.env.CI || process.env.TF_BUILD;\n\ninterface Options {\n // Groupings of options\n logger: { [key: string]: Option };\n pool: { [key: string]: Option };\n runner: { [key: string]: Option };\n run: { [key: string]: Option };\n server: { [key: string]: Option };\n filter: { [key: string]: Option };\n affected: { [key: string]: Option };\n cache: { [key: string]: Option };\n info: { [key: string]: Option };\n}\n\nconst options: Options = {\n logger: {\n reporter: new Option(\"--reporter <reporter...>\", `log reporter (built-in choices: ${logBuiltInReporterNames.join(\", \")})`),\n grouped: new Option(\"--grouped\", \"groups the logs\").default(false),\n progress: new Option(\"--progress\", \"show 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 <values...>\",\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 for workers and child processes (like NODE_OPTIONS) as a single string (e.g. --node-arg=\"--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\", \"succeed even if no targets match the given name\"),\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: Options = addEnvOptions(options);\n\nfunction addEnvOptions(opts: typeof options) {\n for (const key in opts) {\n for (const [name, option] of Object.entries<Option>((opts as any)[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","logBuiltInReporterNames","join","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":";;;;+BAyG2BA;;;eAAlBC;;;2BAzGc;qCACiB;AAExC,MAAMC,OAAOC,QAAQC,GAAG,CAACC,EAAE,IAAIF,QAAQC,GAAG,CAACE,QAAQ;AAenD,MAAMN,UAAmB;IACvBO,QAAQ;QACNC,UAAU,IAAIC,iBAAM,CAAC,4BAA4B,CAAC,gCAAgC,EAAEC,4CAAuB,CAACC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzHC,SAAS,IAAIH,iBAAM,CAAC,aAAa,mBAAmBI,OAAO,CAAC;QAC5DC,UAAU,IAAIL,iBAAM,CAAC,cAAc,iBAAiBM,SAAS,CAAC;YAAC;YAAY;YAAW;SAAU,EAAEF,OAAO,CAAC,CAACX;QAC3Gc,UAAU,IAAIP,iBAAM,CAAC,uBAAuB,aAAaQ,OAAO,CAAC;YAAC;YAAQ;YAAQ;YAAS;YAAW;SAAQ,EAAE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O,IAAIpC,iBAAM,CAAC,mBAAmB;QACrCqC,QAAQ,IAAIrC,iBAAM,CAChB,wBACA,6GACAI,OAAO,CAAC,EAAE;IACd;IACAkC,UAAU;QACRC,cAAc,IAAIvC,iBAAM,CACtB,wCACA,CAAC,8GAA8G,CAAC,GAC9G,CAAC,iDAAiD,CAAC;IAEzD;IACAsB,OAAO;QACLkB,OAAO,IAAIxC,iBAAM,CAAC,kBAAkB,oDAAoDc,SAAS,CAACE,UAAUV,SAAS,CAAC;QACtHmC,OAAO,IAAIzC,iBAAM,CAAC,WAAW;IAC/B;IACA0C,MAAM;QACJC,YAAY,IAAI3C,iBAAM,CAAC,2BAA2B;QAClD4C,iBAAiB,IAAI5C,iBAAM,CAAC,uBAAuB;IACrD;AACF;AAEA,MAAMR,iBAA0BqD,cAActD;AAE9C,SAASsD,cAAcC,IAAoB;IACzC,IAAK,MAAMC,OAAOD,KAAM;QACtB,KAAK,MAAM,CAACE,MAAMC,OAAO,IAAIC,OAAOC,OAAO,CAAS,AAACL,IAAY,CAACC,IAAI,EAAG;YACvE,6DAA6D;YAC7D,MAAMK,oBAAoBL,IAAIM,OAAO,CAAC,YAAY,OAAOC,WAAW;YACpE,MAAMC,qBAAqBP,KAAKK,OAAO,CAAC,YAAY,OAAOC,WAAW;YACtEL,OAAOtD,GAAG,CAAC,CAAC,KAAK,EAAEyD,kBAAkB,CAAC,EAAEG,oBAAoB;QAC9D;IACF;IAEA,OAAOT;AACT"}
@@ -22,13 +22,13 @@ Runs a set of commands in a target graph. The targets are defined by packages an
22
22
 
23
23
  Examples
24
24
  ========
25
-
25
+
26
26
  ### Basic case, running "build", "test", and "lint" against all packages
27
27
 
28
28
  $ lage build test lint
29
29
 
30
30
  ### Concurrency
31
-
31
+
32
32
  $ lage build test lint --concurrency=4
33
33
 
34
34
  ### Filtering by certain packages
@@ -69,11 +69,11 @@ Show logs as grouped by each target:
69
69
 
70
70
  Choosing a different reporter while logging (e.g. nice outputs for Azure DevOps):
71
71
 
72
- $ lage build test lint --reporter=azureDevOps
72
+ $ lage build test lint --reporter=azureDevops
73
73
 
74
74
  Or combine multiple reporters (e.g. Azure DepOps with VerboseFileLog)
75
75
 
76
- $ lage build test lint --reporter azureDevOps --reporter vfl --log-file /my/verbose/log.file
76
+ $ lage build test lint --reporter azureDevops --reporter vfl --log-file /my/verbose/log.file
77
77
 
78
78
  Ignoring files when calculating the scope with --since in addition to files specified in lage.config:
79
79
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/run/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { action } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst command: Command = new Command(\"run\");\n\naddOptions(\"filter\", command);\naddOptions(\"logger\", command);\naddOptions(\"pool\", command);\naddOptions(\"runner\", command);\naddOptions(\"run\", command);\n\ncommand\n .action(action)\n .allowUnknownOption(true)\n .addHelpCommand(\"[run] command1 [command2...commandN] [options]\", \"run commands\")\n .addHelpText(\n \"after\",\n `\nRuns a set of commands in a target graph. The targets are defined by packages and their scripts as defined the package.json files.\n\nExamples\n========\n \n### Basic case, running \"build\", \"test\", and \"lint\" against all packages\n\n $ lage build test lint\n\n### Concurrency\n \n $ lage build test lint --concurrency=4\n\n### Filtering by certain packages\n\nScoped to \"package-a\" and \"package-b\" and their dependencies and dependents:\n\n $ lage build test lint --scope package-a package-b\n\nScoped to \"package-a\" and \"package-b\" only:\n\n $ lage build test lint --scope package-a package-b --no-deps\n\nScoped to packages that have changed in the current branch against a target merge branch:\n\n $ lage build test lint --since origin/master\n\n### Providing node.js arguments for each command\n\n $ lage build test lint --nodearg=--max_old_space_size=1234 --nodearg=--heap-prof\n\n### Continue running even after encountering an error for one of the targets\n\n $ lage build test lint --continue\n\n### Controlling logged outputs\n\nShow verbose output for each target:\n\n $ lage build test lint --verbose\n\nShow only errors for each target:\n\n $ lage build test lint --log-level=error\n\nShow logs as grouped by each target:\n\n $ lage build test lint --grouped --verbose\n\nChoosing a different reporter while logging (e.g. nice outputs for Azure DevOps):\n\n $ lage build test lint --reporter=azureDevOps\n\nOr combine multiple reporters (e.g. Azure DepOps with VerboseFileLog)\n\n $ lage build test lint --reporter azureDevOps --reporter vfl --log-file /my/verbose/log.file\n\nIgnoring files when calculating the scope with --since in addition to files specified in lage.config:\n\n $ lage build test lint --since origin/master --ignore \"package.json\" \"yarn.lock\" \"**/.azure-pipelines/**\"\n\n`\n );\n\nexport { command as runCommand };\n"],"names":["runCommand","command","Command","addOptions","action","allowUnknownOption","addHelpCommand","addHelpText"],"mappings":";;;;+BAmFoBA;;;eAAXC;;;2BAnFe;wBACD;4BACI;AAE3B,MAAMA,UAAmB,IAAIC,kBAAO,CAAC;AAErCC,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,QAAQF;AACnBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,OAAOF;AAElBA,QACGG,MAAM,CAACA,cAAM,EACbC,kBAAkB,CAAC,MACnBC,cAAc,CAAC,kDAAkD,gBACjEC,WAAW,CACV,SACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DL,CAAC"}
1
+ {"version":3,"sources":["../../../src/commands/run/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { action } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst command: Command = new Command(\"run\");\n\naddOptions(\"filter\", command);\naddOptions(\"logger\", command);\naddOptions(\"pool\", command);\naddOptions(\"runner\", command);\naddOptions(\"run\", command);\n\ncommand\n .action(action)\n .allowUnknownOption(true)\n .addHelpCommand(\"[run] command1 [command2...commandN] [options]\", \"run commands\")\n .addHelpText(\n \"after\",\n `\nRuns a set of commands in a target graph. The targets are defined by packages and their scripts as defined the package.json files.\n\nExamples\n========\n\n### Basic case, running \"build\", \"test\", and \"lint\" against all packages\n\n $ lage build test lint\n\n### Concurrency\n\n $ lage build test lint --concurrency=4\n\n### Filtering by certain packages\n\nScoped to \"package-a\" and \"package-b\" and their dependencies and dependents:\n\n $ lage build test lint --scope package-a package-b\n\nScoped to \"package-a\" and \"package-b\" only:\n\n $ lage build test lint --scope package-a package-b --no-deps\n\nScoped to packages that have changed in the current branch against a target merge branch:\n\n $ lage build test lint --since origin/master\n\n### Providing node.js arguments for each command\n\n $ lage build test lint --nodearg=--max_old_space_size=1234 --nodearg=--heap-prof\n\n### Continue running even after encountering an error for one of the targets\n\n $ lage build test lint --continue\n\n### Controlling logged outputs\n\nShow verbose output for each target:\n\n $ lage build test lint --verbose\n\nShow only errors for each target:\n\n $ lage build test lint --log-level=error\n\nShow logs as grouped by each target:\n\n $ lage build test lint --grouped --verbose\n\nChoosing a different reporter while logging (e.g. nice outputs for Azure DevOps):\n\n $ lage build test lint --reporter=azureDevops\n\nOr combine multiple reporters (e.g. Azure DepOps with VerboseFileLog)\n\n $ lage build test lint --reporter azureDevops --reporter vfl --log-file /my/verbose/log.file\n\nIgnoring files when calculating the scope with --since in addition to files specified in lage.config:\n\n $ lage build test lint --since origin/master --ignore \"package.json\" \"yarn.lock\" \"**/.azure-pipelines/**\"\n\n`\n );\n\nexport { command as runCommand };\n"],"names":["runCommand","command","Command","addOptions","action","allowUnknownOption","addHelpCommand","addHelpText"],"mappings":";;;;+BAmFoBA;;;eAAXC;;;2BAnFe;wBACD;4BACI;AAE3B,MAAMA,UAAmB,IAAIC,kBAAO,CAAC;AAErCC,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,QAAQF;AACnBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,OAAOF;AAElBA,QACGG,MAAM,CAACA,cAAM,EACbC,kBAAkB,CAAC,MACnBC,cAAc,CAAC,kDAAkD,gBACjEC,WAAW,CACV,SACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/server/MemoryStream.ts"],"sourcesContent":["import { Writable } from \"stream\";\n\nexport class MemoryStream extends Writable {\n private chunks: Buffer[];\n\n constructor() {\n super();\n this.chunks = [];\n }\n\n _write(chunk: unknown, encoding: BufferEncoding): void {\n this.chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk as any, encoding));\n }\n\n getData(): Buffer {\n return Buffer.concat(this.chunks);\n }\n\n toString(): string {\n return this.getData().toString();\n }\n}\n"],"names":["MemoryStream","Writable","_write","chunk","encoding","chunks","push","Buffer","isBuffer","from","getData","concat","toString"],"mappings":";;;;+BAEaA;;;eAAAA;;;wBAFY;;;;;;;;;;;;;;AAElB,MAAMA,qBAAqBC,gBAAQ;IAQxCC,OAAOC,KAAc,EAAEC,QAAwB,EAAQ;QACrD,IAAI,CAACC,MAAM,CAACC,IAAI,CAACC,OAAOC,QAAQ,CAACL,SAASA,QAAQI,OAAOE,IAAI,CAACN,OAAcC;IAC9E;IAEAM,UAAkB;QAChB,OAAOH,OAAOI,MAAM,CAAC,IAAI,CAACN,MAAM;IAClC;IAEAO,WAAmB;QACjB,OAAO,IAAI,CAACF,OAAO,GAAGE,QAAQ;IAChC;IAfA,aAAc;QACZ,KAAK,IAHP,uBAAQP,UAAR,KAAA;QAIE,IAAI,CAACA,MAAM,GAAG,EAAE;IAClB;AAaF"}
1
+ {"version":3,"sources":["../../../src/commands/server/MemoryStream.ts"],"sourcesContent":["import { Writable } from \"stream\";\n\nexport class MemoryStream extends Writable {\n private chunks: Buffer[];\n\n constructor() {\n super();\n this.chunks = [];\n }\n\n public _write(chunk: unknown, encoding: BufferEncoding): void {\n this.chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk as any, encoding));\n }\n\n public getData(): Buffer {\n return Buffer.concat(this.chunks);\n }\n\n public toString(): string {\n return this.getData().toString();\n }\n}\n"],"names":["MemoryStream","Writable","_write","chunk","encoding","chunks","push","Buffer","isBuffer","from","getData","concat","toString"],"mappings":";;;;+BAEaA;;;eAAAA;;;wBAFY;;;;;;;;;;;;;;AAElB,MAAMA,qBAAqBC,gBAAQ;IAQjCC,OAAOC,KAAc,EAAEC,QAAwB,EAAQ;QAC5D,IAAI,CAACC,MAAM,CAACC,IAAI,CAACC,OAAOC,QAAQ,CAACL,SAASA,QAAQI,OAAOE,IAAI,CAACN,OAAcC;IAC9E;IAEOM,UAAkB;QACvB,OAAOH,OAAOI,MAAM,CAAC,IAAI,CAACN,MAAM;IAClC;IAEOO,WAAmB;QACxB,OAAO,IAAI,CAACF,OAAO,GAAGE,QAAQ;IAChC;IAfA,aAAc;QACZ,KAAK,IAHP,uBAAQP,UAAR,KAAA;QAIE,IAAI,CAACA,MAAM,GAAG,EAAE;IAClB;AAaF"}
package/lib/index.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- export type { CacheOptions } from "@lage-run/config";
2
- export type { ConfigOptions } from "@lage-run/config";
3
- export type { Priority } from "@lage-run/config";
4
- export type { PipelineDefinition } from "@lage-run/config";
5
- export type { LoggerOptions } from "@lage-run/config";
1
+ export type { CacheOptions, ConfigOptions, ConfigFileOptions, Priority, PipelineDefinition, LoggerOptions } from "@lage-run/config";
6
2
  export type { TargetRunnerPickerOptions } from "@lage-run/runners";
7
- export type { Target } from "@lage-run/target-graph";
8
- export type { TargetConfig } from "@lage-run/target-graph";
3
+ export type { Target, TargetConfig } from "@lage-run/target-graph";
@@ -17,7 +17,7 @@ async function optimizeTargetGraph(graph, runnerPicker, createBackCompatGraph) {
17
17
  return true;
18
18
  }
19
19
  if (target.id === (0, _targetgraph.getStartTargetId)()) {
20
- return createBackCompatGraph ? true : false;
20
+ return createBackCompatGraph;
21
21
  }
22
22
  const runner = await runnerPicker.pick(target);
23
23
  if (await runner.shouldRun(target)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/optimizeTargetGraph.ts"],"sourcesContent":["import type { TargetRunnerPicker } from \"@lage-run/runners\";\nimport { type TargetGraph, removeNodes, transitiveReduction, getStartTargetId, type Target } 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 === \"noop\") {\n return true;\n }\n\n if (target.id === getStartTargetId()) {\n return createBackCompatGraph ? true : false;\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","id","getStartTargetId","runner","pick","shouldRun","reduced","transitiveReduction","dependencyMap","Map","node","depId","dependencies","has","set","Set","get","add","dependents","forEach","dependentId","Array","from"],"mappings":";;;;+BAGsBA;;;eAAAA;;;6BAF4E;AAE3F,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,KAAK,QAAQ;YAC1B,OAAO;QACT;QAEA,IAAID,OAAOE,EAAE,KAAKC,IAAAA,6BAAgB,KAAI;YACpC,OAAOR,wBAAwB,OAAO;QACxC;QAEA,MAAMS,SAAS,MAAMV,aAAaW,IAAI,CAACL;QACvC,IAAI,MAAMI,OAAOE,SAAS,CAACN,SAAS;YAClC,OAAO;QACT;QAEA,OAAO;IACT;IAEA,IAAIL,uBAAuB;QACzB,OAAOC;IACT;IAEA,MAAMW,UAAUC,IAAAA,gCAAmB,EAACZ;IAEpC,sEAAsE;IACtE,mDAAmD;IACnD,MAAMa,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"}
1
+ {"version":3,"sources":["../src/optimizeTargetGraph.ts"],"sourcesContent":["import type { TargetRunnerPicker } from \"@lage-run/runners\";\nimport { type TargetGraph, removeNodes, transitiveReduction, getStartTargetId, type Target } 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 === \"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","id","getStartTargetId","runner","pick","shouldRun","reduced","transitiveReduction","dependencyMap","Map","node","depId","dependencies","has","set","Set","get","add","dependents","forEach","dependentId","Array","from"],"mappings":";;;;+BAGsBA;;;eAAAA;;;6BAF4E;AAE3F,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,KAAK,QAAQ;YAC1B,OAAO;QACT;QAEA,IAAID,OAAOE,EAAE,KAAKC,IAAAA,6BAAgB,KAAI;YACpC,OAAOR;QACT;QAEA,MAAMS,SAAS,MAAMV,aAAaW,IAAI,CAACL;QACvC,IAAI,MAAMI,OAAOE,SAAS,CAACN,SAAS;YAClC,OAAO;QACT;QAEA,OAAO;IACT;IAEA,IAAIL,uBAAuB;QACzB,OAAOC;IACT;IAEA,MAAMW,UAAUC,IAAAA,gCAAmB,EAACZ;IAEpC,sEAAsE;IACtE,mDAAmD;IACnD,MAAMa,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"}