@lage-run/cli 0.33.2 → 0.33.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/createReporter.js +19 -1
- package/lib/commands/createReporter.js.map +1 -1
- package/lib/commands/exec/executeInProcess.d.ts +1 -1
- package/lib/commands/exec/executeInProcess.js +6 -6
- package/lib/commands/exec/executeInProcess.js.map +1 -1
- package/lib/commands/info/action.d.ts +1 -2
- package/lib/commands/info/action.js +6 -2
- package/lib/commands/info/action.js.map +1 -1
- package/lib/commands/init/action.js +54 -52
- package/lib/commands/init/action.js.map +1 -1
- package/lib/commands/launchServerInBackground.d.ts +2 -2
- package/lib/commands/launchServerInBackground.js.map +1 -1
- package/lib/commands/options.js +5 -5
- package/lib/commands/options.js.map +1 -1
- package/lib/commands/run/index.js +4 -4
- package/lib/commands/run/index.js.map +1 -1
- package/lib/commands/run/runAction.js +7 -3
- package/lib/commands/run/runAction.js.map +1 -1
- package/lib/commands/run/watchAction.js +6 -2
- package/lib/commands/run/watchAction.js.map +1 -1
- package/lib/commands/server/MemoryStream.js.map +1 -1
- package/lib/commands/server/lageService.js +11 -3
- package/lib/commands/server/lageService.js.map +1 -1
- package/lib/getBuiltInRunners.d.ts +6 -0
- package/lib/{runnerPickerOptions.js → getBuiltInRunners.js} +5 -4
- package/lib/getBuiltInRunners.js.map +1 -0
- package/lib/index.d.ts +3 -8
- package/lib/optimizeTargetGraph.js +1 -1
- package/lib/optimizeTargetGraph.js.map +1 -1
- package/lib/types/ReporterInitOptions.d.ts +1 -1
- package/lib/types/ReporterInitOptions.js +2 -0
- package/lib/types/ReporterInitOptions.js.map +1 -1
- package/package.json +23 -21
- package/CHANGELOG.json +0 -5329
- package/CHANGELOG.md +0 -1925
- package/jest.config.js +0 -1
- package/lib/commands/cache/runners/ClearCacheRunner.d.ts +0 -5
- package/lib/commands/cache/runners/ClearCacheRunner.js +0 -46
- package/lib/commands/cache/runners/ClearCacheRunner.js.map +0 -1
- package/lib/commands/cache/runners/PruneCacheRunner.d.ts +0 -5
- package/lib/commands/cache/runners/PruneCacheRunner.js +0 -49
- package/lib/commands/cache/runners/PruneCacheRunner.js.map +0 -1
- package/lib/runnerPickerOptions.d.ts +0 -2
- package/lib/runnerPickerOptions.js.map +0 -1
- package/tsconfig.json +0 -7
|
@@ -43,6 +43,12 @@ async function createReporter(reporter, options, customReporters = {}) {
|
|
|
43
43
|
grouped,
|
|
44
44
|
logLevel: verbose ? _logger.LogLevel.verbose : logLevel
|
|
45
45
|
});
|
|
46
|
+
case "githubActions":
|
|
47
|
+
case "gha":
|
|
48
|
+
return new _reporters.GithubActionsReporter({
|
|
49
|
+
grouped,
|
|
50
|
+
logLevel: verbose ? _logger.LogLevel.verbose : logLevel
|
|
51
|
+
});
|
|
46
52
|
case "npmLog":
|
|
47
53
|
case "old":
|
|
48
54
|
return new _reporters.LogReporter({
|
|
@@ -80,7 +86,19 @@ async function createReporter(reporter, options, customReporters = {}) {
|
|
|
80
86
|
throw new Error(`Failed to load custom reporter "${reporter}" from "${resolvedPath}": ${error}`);
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
|
-
// Default reporter behavior
|
|
89
|
+
// Default reporter behavior - auto-detect CI environments
|
|
90
|
+
if (process.env.GITHUB_ACTIONS) {
|
|
91
|
+
return new _reporters.GithubActionsReporter({
|
|
92
|
+
grouped: true,
|
|
93
|
+
logLevel: verbose ? _logger.LogLevel.verbose : logLevel
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (process.env.TF_BUILD) {
|
|
97
|
+
return new _reporters.AdoReporter({
|
|
98
|
+
grouped: true,
|
|
99
|
+
logLevel: verbose ? _logger.LogLevel.verbose : logLevel
|
|
100
|
+
});
|
|
101
|
+
}
|
|
84
102
|
if (progress && (0, _isinteractive.default)() && !(logLevel >= _logger.LogLevel.verbose || verbose || grouped)) {
|
|
85
103
|
return new _reporters.BasicReporter({
|
|
86
104
|
concurrency,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/createReporter.ts"],"sourcesContent":["import { LogLevel } from \"@lage-run/logger\";\nimport {\n JsonReporter,\n AdoReporter,\n LogReporter,\n ProgressReporter,\n BasicReporter,\n VerboseFileLogReporter,\n ChromeTraceEventsReporter,\n} from \"@lage-run/reporters\";\nimport type { BuiltInReporterName, ReporterInitOptions } from \"../types/ReporterInitOptions.js\";\nimport type { Reporter } from \"@lage-run/logger\";\nimport { findPackageRoot } from \"workspace-tools\";\nimport { readFileSync } from \"fs\";\nimport path from \"path\";\nimport { pathToFileURL } from \"url\";\nimport isInteractive from \"is-interactive\";\n\nexport async function createReporter(\n reporter: string,\n options: ReporterInitOptions,\n customReporters: Record<string, string> = {}\n): Promise<Reporter> {\n const { verbose, grouped, logLevel: logLevelName, concurrency, profile, progress, logFile, indented } = options;\n const logLevel = LogLevel[logLevelName];\n\n const root = findPackageRoot(__filename)!;\n const packageJson = JSON.parse(readFileSync(path.join(root, \"package.json\"), \"utf-8\"));\n const version = packageJson.version;\n\n switch (reporter as BuiltInReporterName) {\n case \"profile\":\n return new ChromeTraceEventsReporter({\n concurrency,\n outputFile: typeof profile === \"string\" ? profile : undefined,\n });\n case \"json\":\n return new JsonReporter({ logLevel, indented: indented ?? false });\n case \"azureDevops\":\n case \"adoLog\":\n return new AdoReporter({ grouped, logLevel: verbose ? LogLevel.verbose : logLevel });\n\n case \"npmLog\":\n case \"old\":\n return new LogReporter({ grouped, logLevel: verbose ? LogLevel.verbose : logLevel });\n\n case \"fancy\":\n return new ProgressReporter({ concurrency, version });\n\n case \"verboseFileLog\":\n case \"vfl\":\n return new VerboseFileLogReporter(logFile);\n }\n\n // Check if it's a custom reporter defined in config\n if (customReporters && customReporters[reporter]) {\n const reporterPath = customReporters[reporter];\n const resolvedPath = path.isAbsolute(reporterPath) ? reporterPath : path.resolve(process.cwd(), reporterPath);\n\n try {\n // Use dynamic import to load the custom reporter module\n // This works with both ESM (.mjs, .js with type: module) and CommonJS (.cjs, .js) files\n const reporterModule = await import(pathToFileURL(resolvedPath).href);\n\n // Try different export patterns\n const ReporterClass = reporterModule.default ?? reporterModule[reporter] ?? reporterModule;\n\n if (typeof ReporterClass === \"function\") {\n return new ReporterClass(options);\n } else if (typeof ReporterClass === \"object\" && ReporterClass !== null) {\n // If it's already an instance\n return ReporterClass;\n } else {\n throw new Error(`Custom reporter \"${reporter}\" at \"${resolvedPath}\" does not export a valid reporter class or instance.`);\n }\n } catch (error) {\n throw new Error(`Failed to load custom reporter \"${reporter}\" from \"${resolvedPath}\": ${error}`);\n }\n }\n\n // Default reporter behavior\n if (progress && isInteractive() && !(logLevel >= LogLevel.verbose || verbose || grouped)) {\n return new BasicReporter({ concurrency, version });\n }\n\n return new LogReporter({ grouped, logLevel: verbose ? LogLevel.verbose : logLevel });\n}\n"],"names":["createReporter","reporter","options","customReporters","verbose","grouped","logLevel","logLevelName","concurrency","profile","progress","logFile","indented","LogLevel","root","findPackageRoot","__filename","packageJson","JSON","parse","readFileSync","path","join","version","ChromeTraceEventsReporter","outputFile","undefined","JsonReporter","AdoReporter","LogReporter","ProgressReporter","VerboseFileLogReporter","reporterPath","resolvedPath","isAbsolute","resolve","process","cwd","reporterModule","pathToFileURL","href","ReporterClass","default","Error","error","isInteractive","BasicReporter"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../../src/commands/createReporter.ts"],"sourcesContent":["import { LogLevel } from \"@lage-run/logger\";\nimport {\n JsonReporter,\n AdoReporter,\n GithubActionsReporter,\n LogReporter,\n ProgressReporter,\n BasicReporter,\n VerboseFileLogReporter,\n ChromeTraceEventsReporter,\n} from \"@lage-run/reporters\";\nimport type { BuiltInReporterName, ReporterInitOptions } from \"../types/ReporterInitOptions.js\";\nimport type { Reporter } from \"@lage-run/logger\";\nimport { findPackageRoot } from \"workspace-tools\";\nimport { readFileSync } from \"fs\";\nimport path from \"path\";\nimport { pathToFileURL } from \"url\";\nimport isInteractive from \"is-interactive\";\n\nexport async function createReporter(\n reporter: string,\n options: ReporterInitOptions,\n customReporters: Record<string, string> = {}\n): Promise<Reporter> {\n const { verbose, grouped, logLevel: logLevelName, concurrency, profile, progress, logFile, indented } = options;\n const logLevel = LogLevel[logLevelName];\n\n const root = findPackageRoot(__filename)!;\n const packageJson = JSON.parse(readFileSync(path.join(root, \"package.json\"), \"utf-8\"));\n const version = packageJson.version;\n\n switch (reporter as BuiltInReporterName) {\n case \"profile\":\n return new ChromeTraceEventsReporter({\n concurrency,\n outputFile: typeof profile === \"string\" ? profile : undefined,\n });\n case \"json\":\n return new JsonReporter({ logLevel, indented: indented ?? false });\n case \"azureDevops\":\n case \"adoLog\":\n return new AdoReporter({ grouped, logLevel: verbose ? LogLevel.verbose : logLevel });\n\n case \"githubActions\":\n case \"gha\":\n return new GithubActionsReporter({ grouped, logLevel: verbose ? LogLevel.verbose : logLevel });\n\n case \"npmLog\":\n case \"old\":\n return new LogReporter({ grouped, logLevel: verbose ? LogLevel.verbose : logLevel });\n\n case \"fancy\":\n return new ProgressReporter({ concurrency, version });\n\n case \"verboseFileLog\":\n case \"vfl\":\n return new VerboseFileLogReporter(logFile);\n }\n\n // Check if it's a custom reporter defined in config\n if (customReporters && customReporters[reporter]) {\n const reporterPath = customReporters[reporter];\n const resolvedPath = path.isAbsolute(reporterPath) ? reporterPath : path.resolve(process.cwd(), reporterPath);\n\n try {\n // Use dynamic import to load the custom reporter module\n // This works with both ESM (.mjs, .js with type: module) and CommonJS (.cjs, .js) files\n const reporterModule = await import(pathToFileURL(resolvedPath).href);\n\n // Try different export patterns\n const ReporterClass = reporterModule.default ?? reporterModule[reporter] ?? reporterModule;\n\n if (typeof ReporterClass === \"function\") {\n return new ReporterClass(options);\n } else if (typeof ReporterClass === \"object\" && ReporterClass !== null) {\n // If it's already an instance\n return ReporterClass;\n } else {\n throw new Error(`Custom reporter \"${reporter}\" at \"${resolvedPath}\" does not export a valid reporter class or instance.`);\n }\n } catch (error) {\n throw new Error(`Failed to load custom reporter \"${reporter}\" from \"${resolvedPath}\": ${error}`);\n }\n }\n\n // Default reporter behavior - auto-detect CI environments\n if (process.env.GITHUB_ACTIONS) {\n return new GithubActionsReporter({ grouped: true, logLevel: verbose ? LogLevel.verbose : logLevel });\n }\n\n if (process.env.TF_BUILD) {\n return new AdoReporter({ grouped: true, logLevel: verbose ? LogLevel.verbose : logLevel });\n }\n\n if (progress && isInteractive() && !(logLevel >= LogLevel.verbose || verbose || grouped)) {\n return new BasicReporter({ concurrency, version });\n }\n\n return new LogReporter({ grouped, logLevel: verbose ? LogLevel.verbose : logLevel });\n}\n"],"names":["createReporter","reporter","options","customReporters","verbose","grouped","logLevel","logLevelName","concurrency","profile","progress","logFile","indented","LogLevel","root","findPackageRoot","__filename","packageJson","JSON","parse","readFileSync","path","join","version","ChromeTraceEventsReporter","outputFile","undefined","JsonReporter","AdoReporter","GithubActionsReporter","LogReporter","ProgressReporter","VerboseFileLogReporter","reporterPath","resolvedPath","isAbsolute","resolve","process","cwd","reporterModule","pathToFileURL","href","ReporterClass","default","Error","error","env","GITHUB_ACTIONS","TF_BUILD","isInteractive","BasicReporter"],"mappings":";;;;+BAmBsBA;;;eAAAA;;;wBAnBG;2BAUlB;gCAGyB;oBACH;6DACZ;qBACa;sEACJ;;;;;;AAEnB,eAAeA,eACpBC,QAAgB,EAChBC,OAA4B,EAC5BC,kBAA0C,CAAC,CAAC;IAE5C,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,UAAUC,YAAY,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGV;IACxG,MAAMI,WAAWO,gBAAQ,CAACN,aAAa;IAEvC,MAAMO,OAAOC,IAAAA,+BAAe,EAACC;IAC7B,MAAMC,cAAcC,KAAKC,KAAK,CAACC,IAAAA,gBAAY,EAACC,aAAI,CAACC,IAAI,CAACR,MAAM,iBAAiB;IAC7E,MAAMS,UAAUN,YAAYM,OAAO;IAEnC,OAAQtB;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AC9B,OAAOA;YACT,OAAO;gBACL,MAAM,IAAIE,MAAM,CAAC,iBAAiB,EAAE3C,SAAS,MAAM,EAAEiC,aAAa,qDAAqD,CAAC;YAC1H;QACF,EAAE,OAAOW,OAAO;YACd,MAAM,IAAID,MAAM,CAAC,gCAAgC,EAAE3C,SAAS,QAAQ,EAAEiC,aAAa,GAAG,EAAEW,OAAO;QACjG;IACF;IAEA,0DAA0D;IAC1D,IAAIR,QAAQS,GAAG,CAACC,cAAc,EAAE;QAC9B,OAAO,IAAIlB,gCAAqB,CAAC;YAAExB,SAAS;YAAMC,UAAUF,UAAUS,gBAAQ,CAACT,OAAO,GAAGE;QAAS;IACpG;IAEA,IAAI+B,QAAQS,GAAG,CAACE,QAAQ,EAAE;QACxB,OAAO,IAAIpB,sBAAW,CAAC;YAAEvB,SAAS;YAAMC,UAAUF,UAAUS,gBAAQ,CAACT,OAAO,GAAGE;QAAS;IAC1F;IAEA,IAAII,YAAYuC,IAAAA,sBAAa,OAAM,CAAE3C,CAAAA,YAAYO,gBAAQ,CAACT,OAAO,IAAIA,WAAWC,OAAM,GAAI;QACxF,OAAO,IAAI6C,wBAAa,CAAC;YAAE1C;YAAae;QAAQ;IAClD;IAEA,OAAO,IAAIO,sBAAW,CAAC;QAAEzB;QAASC,UAAUF,UAAUS,gBAAQ,CAACT,OAAO,GAAGE;IAAS;AACpF"}
|
|
@@ -16,7 +16,7 @@ const _workspacetools = require("workspace-tools");
|
|
|
16
16
|
const _filterArgsForTasks = require("../run/filterArgsForTasks.js");
|
|
17
17
|
const _expandTargetDefinition = require("./expandTargetDefinition.js");
|
|
18
18
|
const _runners = require("@lage-run/runners");
|
|
19
|
-
const
|
|
19
|
+
const _getBuiltInRunners = require("../../getBuiltInRunners.js");
|
|
20
20
|
function _interop_require_default(obj) {
|
|
21
21
|
return obj && obj.__esModule ? obj : {
|
|
22
22
|
default: obj
|
|
@@ -28,10 +28,6 @@ function _interop_require_default(obj) {
|
|
|
28
28
|
* 1. if cwd overridden in args, use it to read the package.json directly
|
|
29
29
|
* 2. if cwd not overridden and root is not cwd, use the cwd to read the package.json directly
|
|
30
30
|
* 3. if root is cwd, assume the task is global
|
|
31
|
-
*
|
|
32
|
-
* @param options
|
|
33
|
-
* @param command
|
|
34
|
-
* @returns
|
|
35
31
|
*/ function parsePackageInfoFromArgs(root, cwd, packageName, task) {
|
|
36
32
|
if (packageName && task) {
|
|
37
33
|
const packageInfos = (0, _workspacetools.getPackageInfos)(root);
|
|
@@ -103,7 +99,11 @@ async function executeInProcess({ cwd, args, nodeArg, logger }) {
|
|
|
103
99
|
});
|
|
104
100
|
const definition = (0, _expandTargetDefinition.expandTargetDefinition)(isGlobal ? undefined : info.name, task, pipeline, config.cacheOptions.outputGlob ?? []);
|
|
105
101
|
const target = isGlobal ? factory.createGlobalTarget(task, definition) : factory.createPackageTarget(info.name, task, definition);
|
|
106
|
-
const pickerOptions = (0,
|
|
102
|
+
const pickerOptions = (0, _getBuiltInRunners.getBuiltInRunners)({
|
|
103
|
+
nodeArg,
|
|
104
|
+
npmCmd: config.npmClient,
|
|
105
|
+
taskArgs
|
|
106
|
+
});
|
|
107
107
|
const runnerPicker = new _runners.TargetRunnerPicker(pickerOptions);
|
|
108
108
|
const runner = await runnerPicker.pick(target);
|
|
109
109
|
if (await runner.shouldRun(target)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/commands/exec/executeInProcess.ts"],"sourcesContent":["import { getConfig } from \"@lage-run/config\";\nimport { TargetFactory } from \"@lage-run/target-graph\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { getPackageInfos, getWorkspaceManagerRoot } from \"workspace-tools\";\nimport { filterArgsForTasks } from \"../run/filterArgsForTasks.js\";\nimport { expandTargetDefinition } from \"./expandTargetDefinition.js\";\nimport { TargetRunnerPicker } from \"@lage-run/runners\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/exec/executeInProcess.ts"],"sourcesContent":["import { getConfig } from \"@lage-run/config\";\nimport { TargetFactory } from \"@lage-run/target-graph\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { getPackageInfos, getWorkspaceManagerRoot } from \"workspace-tools\";\nimport { filterArgsForTasks } from \"../run/filterArgsForTasks.js\";\nimport { expandTargetDefinition } from \"./expandTargetDefinition.js\";\nimport { TargetRunnerPicker } from \"@lage-run/runners\";\nimport type { Logger } from \"@lage-run/logger\";\nimport { getBuiltInRunners } from \"../../getBuiltInRunners.js\";\n\ninterface ExecuteInProcessOptions {\n cwd?: string;\n nodeArg?: string;\n args?: string[];\n logger: Logger;\n}\n\n/**\n * Parses the package and task from the command as quickly as possible:\n *\n * 1. if cwd overridden in args, use it to read the package.json directly\n * 2. if cwd not overridden and root is not cwd, use the cwd to read the package.json directly\n * 3. if root is cwd, assume the task is global\n */\nfunction parsePackageInfoFromArgs(root: string, cwd: string | undefined, packageName: string | undefined, task: string) {\n if (packageName && task) {\n const packageInfos = getPackageInfos(root);\n const info = packageInfos[packageName];\n return {\n info,\n task,\n isGlobal: false,\n };\n }\n\n if (cwd) {\n const packageJsonPath = path.join(cwd, \"package.json\");\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: false,\n };\n }\n\n if (root !== process.cwd()) {\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n if (fs.existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: false,\n };\n }\n }\n\n const packageJsonPath = path.join(root, \"package.json\");\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf-8\"));\n\n return {\n info: {\n ...packageJson,\n packageJsonPath,\n },\n task,\n isGlobal: true,\n };\n}\n\nexport async function executeInProcess({ cwd, args, nodeArg, logger }: ExecuteInProcessOptions): Promise<void> {\n const root = getWorkspaceManagerRoot(process.cwd())!;\n const config = await getConfig(root);\n const { pipeline } = config;\n\n const taskArg = args?.length === 1 ? args?.[0] : args?.[1];\n const packageName = (args?.length ?? 0 > 1) ? args?.[0] : undefined;\n\n if (!taskArg) {\n throw new Error(\"No task provided\");\n }\n\n const { info, task, isGlobal } = parsePackageInfoFromArgs(root, cwd, packageName, taskArg);\n\n const packageInfos = { [info.name]: info };\n\n const resolve = () => {\n return path.dirname(info.packageJsonPath).replace(/\\\\/g, \"/\");\n };\n\n const { taskArgs } = filterArgsForTasks(args ?? []);\n\n const factory = new TargetFactory({ root, resolve, packageInfos });\n\n const definition = expandTargetDefinition(isGlobal ? undefined : info.name, task, pipeline, config.cacheOptions.outputGlob ?? []);\n\n const target = isGlobal ? factory.createGlobalTarget(task, definition) : factory.createPackageTarget(info.name, task, definition);\n const pickerOptions = getBuiltInRunners({ nodeArg, npmCmd: config.npmClient, taskArgs });\n\n const runnerPicker = new TargetRunnerPicker(pickerOptions);\n const runner = await runnerPicker.pick(target);\n\n if (await runner.shouldRun(target)) {\n logger.info(\"Running target\", { target });\n\n try {\n await runner.run({\n target,\n weight: 1,\n abortSignal: new AbortController().signal,\n });\n\n logger.info(\"Finished\", { target });\n } catch (result) {\n process.exitCode = 1;\n\n if (typeof result === \"object\" && result !== null && \"exitCode\" in result) {\n if (typeof result.exitCode === \"number\" && result.exitCode !== 0) {\n process.exitCode = result.exitCode;\n }\n }\n\n if (typeof result === \"object\" && result !== null && \"error\" in result) {\n logger.error(`Failed`, { target, error: result.error });\n return;\n }\n\n logger.error(`Failed`, { target, error: result });\n }\n }\n}\n"],"names":["executeInProcess","parsePackageInfoFromArgs","root","cwd","packageName","task","packageInfos","getPackageInfos","info","isGlobal","packageJsonPath","path","join","packageJson","JSON","parse","fs","readFileSync","process","existsSync","args","nodeArg","logger","getWorkspaceManagerRoot","config","getConfig","pipeline","taskArg","length","undefined","Error","name","resolve","dirname","replace","taskArgs","filterArgsForTasks","factory","TargetFactory","definition","expandTargetDefinition","cacheOptions","outputGlob","target","createGlobalTarget","createPackageTarget","pickerOptions","getBuiltInRunners","npmCmd","npmClient","runnerPicker","TargetRunnerPicker","runner","pick","shouldRun","run","weight","abortSignal","AbortController","signal","result","exitCode","error"],"mappings":";;;;+BA8EsBA;;;eAAAA;;;wBA9EI;6BACI;6DACb;2DACF;gCAC0C;oCACtB;wCACI;yBACJ;mCAED;;;;;;AASlC;;;;;;CAMC,GACD,SAASC,yBAAyBC,IAAY,EAAEC,GAAuB,EAAEC,WAA+B,EAAEC,IAAY;IACpH,IAAID,eAAeC,MAAM;QACvB,MAAMC,eAAeC,IAAAA,+BAAe,EAACL;QACrC,MAAMM,OAAOF,YAAY,CAACF,YAAY;QACtC,OAAO;YACLI;YACAH;YACAI,UAAU;QACZ;IACF;IAEA,IAAIN,KAAK;QACP,MAAMO,kBAAkBC,aAAI,CAACC,IAAI,CAACT,KAAK;QACvC,MAAMU,cAAcC,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACP,iBAAiB;QAEhE,OAAO;YACLF,MAAM;gBACJ,GAAGK,WAAW;gBACdH;YACF;YACAL;YACAI,UAAU;QACZ;IACF;IAEA,IAAIP,SAASgB,QAAQf,GAAG,IAAI;QAC1B,MAAMO,kBAAkBC,aAAI,CAACC,IAAI,CAACM,QAAQf,GAAG,IAAI;QACjD,IAAIa,WAAE,CAACG,UAAU,CAACT,kBAAkB;YAClC,MAAMG,cAAcC,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACP,iBAAiB;YAChE,OAAO;gBACLF,MAAM;oBACJ,GAAGK,WAAW;oBACdH;gBACF;gBACAL;gBACAI,UAAU;YACZ;QACF;IACF;IAEA,MAAMC,kBAAkBC,aAAI,CAACC,IAAI,CAACV,MAAM;IACxC,MAAMW,cAAcC,KAAKC,KAAK,CAACC,WAAE,CAACC,YAAY,CAACP,iBAAiB;IAEhE,OAAO;QACLF,MAAM;YACJ,GAAGK,WAAW;YACdH;QACF;QACAL;QACAI,UAAU;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,SAAS;QAAEd;IAAS;IAEtF,MAAMe,eAAe,IAAIC,2BAAkB,CAACL;IAC5C,MAAMM,SAAS,MAAMF,aAAaG,IAAI,CAACV;IAEvC,IAAI,MAAMS,OAAOE,SAAS,CAACX,SAAS;QAClCrB,OAAOd,IAAI,CAAC,kBAAkB;YAAEmC;QAAO;QAEvC,IAAI;YACF,MAAMS,OAAOG,GAAG,CAAC;gBACfZ;gBACAa,QAAQ;gBACRC,aAAa,IAAIC,kBAAkBC,MAAM;YAC3C;YAEArC,OAAOd,IAAI,CAAC,YAAY;gBAAEmC;YAAO;QACnC,EAAE,OAAOiB,QAAQ;YACf1C,QAAQ2C,QAAQ,GAAG;YAEnB,IAAI,OAAOD,WAAW,YAAYA,WAAW,QAAQ,cAAcA,QAAQ;gBACzE,IAAI,OAAOA,OAAOC,QAAQ,KAAK,YAAYD,OAAOC,QAAQ,KAAK,GAAG;oBAChE3C,QAAQ2C,QAAQ,GAAGD,OAAOC,QAAQ;gBACpC;YACF;YAEA,IAAI,OAAOD,WAAW,YAAYA,WAAW,QAAQ,WAAWA,QAAQ;gBACtEtC,OAAOwC,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE;oBAAEnB;oBAAQmB,OAAOF,OAAOE,KAAK;gBAAC;gBACrD;YACF;YAEAxC,OAAOwC,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE;gBAAEnB;gBAAQmB,OAAOF;YAAO;QACjD;IACF;AACF"}
|
|
@@ -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 {};
|
|
@@ -29,7 +29,7 @@ const _targetgraph = require("@lage-run/target-graph");
|
|
|
29
29
|
const _initializeReporters = require("../initializeReporters.js");
|
|
30
30
|
const _runners = require("@lage-run/runners");
|
|
31
31
|
const _getBinPaths = require("../../getBinPaths.js");
|
|
32
|
-
const
|
|
32
|
+
const _getBuiltInRunners = require("../../getBuiltInRunners.js");
|
|
33
33
|
const _parseServerOption = require("../parseServerOption.js");
|
|
34
34
|
const _optimizeTargetGraph = require("../../optimizeTargetGraph.js");
|
|
35
35
|
const _globby = require("@lage-run/globby");
|
|
@@ -78,7 +78,11 @@ async function infoAction(options, command) {
|
|
|
78
78
|
repoWideChanges: config.repoWideChanges,
|
|
79
79
|
sinceIgnoreGlobs: options.ignore.concat(config.ignore)
|
|
80
80
|
});
|
|
81
|
-
const pickerOptions = (0,
|
|
81
|
+
const pickerOptions = (0, _getBuiltInRunners.getBuiltInRunners)({
|
|
82
|
+
nodeArg: options.nodeArg,
|
|
83
|
+
npmCmd: config.npmClient,
|
|
84
|
+
taskArgs
|
|
85
|
+
});
|
|
82
86
|
const runnerPicker = new _runners.TargetRunnerPicker(pickerOptions);
|
|
83
87
|
// This is a temporary flag to allow backwards compatibility with the old lage graph format used by BuildXL (formerly known as Domino).
|
|
84
88
|
// I initially worked on a commandline flag, but threading that through requires 3 different releases (lage, buildxl, ohome).
|
|
@@ -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":";;;;;;;;;;;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,EAAE,GAAGC,IAAAA,sCA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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 { getBuiltInRunners } from \"../../getBuiltInRunners.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 = getBuiltInRunners({ nodeArg: options.nodeArg, npmCmd: 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","getBuiltInRunners","nodeArg","npmCmd","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;mCACM;mCACA;qCACE;wBACf;wBACmB;oCACG;;;;;;AA0EpC,eAAeA,WAAWC,OAA0B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AAE;YACf7G,QAAQgI,IAAI,CAACxE,OAAOqD,IAAI;QAC1B;QAEA7G,QAAQgI,IAAI,IAAI/G;QAChB,OAAOjB;IACT,OAAO,IAAIwD,OAAO2D,IAAI,KAAK,UAAU;QACnC,MAAMnH,UAAU;YAACoD,SAAS8E,IAAI;YAAE;SAAO;QACvClI,QAAQgI,IAAI,CAACxE,OAAOoD,WAAW,IAAI;QACnC5G,QAAQgI,IAAI,CAACxE,OAAOqD,IAAI;QACxB7G,QAAQgI,IAAI,IAAI/G;QAChB,OAAOjB;IACT;IAEA,OAAO,EAAE;AACX;AAEA,SAASyG,oBAAoBjD,MAAc;IACzC,MAAMvD,MAAMC,QAAQD,GAAG;IACvB,MAAMuG,mBAAmB7B,aAAI,CAACwD,QAAQ,CAACtH,IAAAA,uCAAuB,EAACZ,QAAQ,IAAIuD,OAAOvD,GAAG,EAAEmI,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
|
|
23
|
-
if (
|
|
24
|
-
console.error("lage
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
62
|
-
case "npm":
|
|
81
|
+
default:
|
|
63
82
|
return "npm run lage build";
|
|
64
83
|
}
|
|
65
84
|
}
|
|
66
|
-
function
|
|
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
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
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
|
|
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,CAACC,UAAU;;;;AAIpG,CAAC;IAECC,WAAE,CAACC,aAAa,CAACC,aAAI,CAACC,IAAI,CAACf,MAAM,mBAAmBO;IAEpD,MAAMS,YAAYhB,MAAMD,kBAAkB;QAAC;QAAS;QAAQ;KAAO;IAEnEJ,QAAQQ,IAAI,CAAC,CAAC,sCAAsC,EAAEc,gBAAgBlB,mBAAmB;AAC3F;AAEA,SAASkB,gBAAgBlB,gBAAkC;IACzD,OAAQA;QACN,KAAK;YACH,OAAO;QAET,KAAK;YACH,OAAO;QAET;YACE,OAAO;IACX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F,iBAAiB;AACrD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Logger } from "@lage-run/logger";
|
|
2
|
-
export interface
|
|
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, }:
|
|
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
|
|
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","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AI,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"}
|
package/lib/commands/options.js
CHANGED
|
@@ -15,7 +15,7 @@ const options = {
|
|
|
15
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 <
|
|
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
|
|
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"),
|