@lage-run/cli 0.24.13 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.json +16 -1
  2. package/CHANGELOG.md +10 -2
  3. package/lib/commands/addOptions.d.ts +3 -0
  4. package/lib/commands/addOptions.js +17 -0
  5. package/lib/commands/addOptions.js.map +1 -0
  6. package/lib/commands/affected/index.js +2 -2
  7. package/lib/commands/affected/index.js.map +1 -1
  8. package/lib/commands/cache/index.d.ts +2 -2
  9. package/lib/commands/cache/index.js +6 -4
  10. package/lib/commands/cache/index.js.map +1 -1
  11. package/lib/commands/exec/index.d.ts +2 -2
  12. package/lib/commands/exec/index.js +8 -15
  13. package/lib/commands/exec/index.js.map +1 -1
  14. package/lib/commands/info/index.d.ts +2 -2
  15. package/lib/commands/info/index.js +8 -9
  16. package/lib/commands/info/index.js.map +1 -1
  17. package/lib/commands/init/index.js +1 -2
  18. package/lib/commands/init/index.js.map +1 -1
  19. package/lib/commands/launchServerInBackground.js +2 -4
  20. package/lib/commands/launchServerInBackground.js.map +1 -1
  21. package/lib/commands/options.d.ts +49 -0
  22. package/lib/commands/options.js +81 -0
  23. package/lib/commands/options.js.map +1 -0
  24. package/lib/commands/run/index.d.ts +2 -2
  25. package/lib/commands/run/index.js +9 -7
  26. package/lib/commands/run/index.js.map +1 -1
  27. package/lib/commands/server/action.d.ts +1 -2
  28. package/lib/commands/server/action.js +5 -3
  29. package/lib/commands/server/action.js.map +1 -1
  30. package/lib/commands/server/index.d.ts +2 -2
  31. package/lib/commands/server/index.js +9 -10
  32. package/lib/commands/server/index.js.map +1 -1
  33. package/package.json +1 -1
  34. package/lib/commands/addFilterOptions.d.ts +0 -2
  35. package/lib/commands/addFilterOptions.js +0 -13
  36. package/lib/commands/addFilterOptions.js.map +0 -1
  37. package/lib/commands/addLoggerOptions.d.ts +0 -2
  38. package/lib/commands/addLoggerOptions.js +0 -25
  39. package/lib/commands/addLoggerOptions.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@lage-run/cli",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 23 Jan 2025 17:37:49 GMT",
5
+ "date": "Fri, 24 Jan 2025 23:04:20 GMT",
6
+ "version": "0.25.0",
7
+ "tag": "@lage-run/cli_v0.25.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/cli",
13
+ "commit": "1816081df6da9541b52912354484d9bd2f198b03",
14
+ "comment": "Adds environment variables override for all CLI args. Get these from --help"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 23 Jan 2025 17:38:05 GMT",
6
21
  "version": "0.24.13",
7
22
  "tag": "@lage-run/cli_v0.24.13",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # Change Log - @lage-run/cli
2
2
 
3
- <!-- This log was last generated on Thu, 23 Jan 2025 17:37:49 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Fri, 24 Jan 2025 23:04:20 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.25.0
8
+
9
+ Fri, 24 Jan 2025 23:04:20 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Adds environment variables override for all CLI args. Get these from --help (kchau@microsoft.com)
14
+
7
15
  ## 0.24.13
8
16
 
9
- Thu, 23 Jan 2025 17:37:49 GMT
17
+ Thu, 23 Jan 2025 17:38:05 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ import { options } from "./options.js";
3
+ export declare function addOptions(category: keyof typeof options, command: Command): Command;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "addOptions", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return addOptions;
9
+ }
10
+ });
11
+ const _options = require("./options.js");
12
+ function addOptions(category, command) {
13
+ for (const option of Object.values(_options.options[category])){
14
+ command.addOption(option);
15
+ }
16
+ return command;
17
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/addOptions.ts"],"sourcesContent":["import type { Command, Option } from \"commander\";\nimport { options } from \"./options.js\";\n\nexport function addOptions(category: keyof typeof options, command: Command) {\n for (const option of Object.values<Option>(options[category])) {\n command.addOption(option);\n }\n return command;\n}\n"],"names":["addOptions","category","command","option","Object","values","options","addOption"],"mappings":";;;;+BAGgBA;;;eAAAA;;;yBAFQ;AAEjB,SAASA,WAAWC,QAA8B,EAAEC,OAAgB;IACzE,KAAK,MAAMC,UAAUC,OAAOC,MAAM,CAASC,gBAAO,CAACL,SAAS,EAAG;QAC7DC,QAAQK,SAAS,CAACJ;IACpB;IACA,OAAOD;AACT"}
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "affectedCommand", {
9
9
  }
10
10
  });
11
11
  const _commander = require("commander");
12
- const _addFilterOptions = require("../addFilterOptions.js");
13
12
  const _action = require("./action.js");
13
+ const _addOptions = require("../addOptions.js");
14
14
  const affectedCommand = new _commander.Command("affected");
15
- (0, _addFilterOptions.addFilterOptions)(affectedCommand).action(_action.affectedAction).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`).option("--since <branch>", "Calculate changes since this branch (defaults to origin/master)", "origin/master");
15
+ (0, _addOptions.addOptions)("filter", affectedCommand).action(_action.affectedAction);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/affected/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { addFilterOptions } from \"../addFilterOptions.js\";\nimport { affectedAction } from \"./action.js\";\n\nconst affectedCommand = new Command(\"affected\");\n\naddFilterOptions(affectedCommand)\n .action(affectedAction)\n .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 .option(\"--since <branch>\", \"Calculate changes since this branch (defaults to origin/master)\", \"origin/master\");\n\nexport { affectedCommand };\n"],"names":["affectedCommand","Command","addFilterOptions","action","affectedAction","option"],"mappings":";;;;+BAeSA;;;eAAAA;;;2BAfe;kCACS;wBACF;AAE/B,MAAMA,kBAAkB,IAAIC,kBAAO,CAAC;AAEpCC,IAAAA,kCAAgB,EAACF,iBACdG,MAAM,CAACC,sBAAc,EACrBC,MAAM,CACL,wCACA,CAAC,6GAA6G,CAAC,GAC7G,CAAC,iDAAiD,CAAC,EAEtDA,MAAM,CAAC,oBAAoB,mEAAmE"}
1
+ {"version":3,"sources":["../../../src/commands/affected/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { affectedAction } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst affectedCommand = new Command(\"affected\");\naddOptions(\"filter\", affectedCommand).action(affectedAction);\n\nexport { affectedCommand };\n"],"names":["affectedCommand","Command","addOptions","action","affectedAction"],"mappings":";;;;+BAOSA;;;eAAAA;;;2BAPe;wBACO;4BACJ;AAE3B,MAAMA,kBAAkB,IAAIC,kBAAO,CAAC;AACpCC,IAAAA,sBAAU,EAAC,UAAUF,iBAAiBG,MAAM,CAACC,sBAAc"}
@@ -1,3 +1,3 @@
1
1
  import { Command } from "commander";
2
- declare const cacheCommand: Command;
3
- export { cacheCommand };
2
+ declare const command: Command;
3
+ export { command as cacheCommand };
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  Object.defineProperty(exports, "cacheCommand", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return cacheCommand;
8
+ return command;
9
9
  }
10
10
  });
11
11
  const _commander = require("commander");
12
- const _addLoggerOptions = require("../addLoggerOptions.js");
13
12
  const _action = require("./action.js");
14
- const cacheCommand = new _commander.Command("cache");
15
- (0, _addLoggerOptions.addLoggerOptions)(cacheCommand).action(_action.cacheAction).addOption(new _commander.Option("--prune <days>", "Prunes cache older than certain number of <days>").argParser(parseInt).conflicts("--clear")).option("--clear", "Clears the cache locally");
13
+ const _addOptions = require("../addOptions.js");
14
+ const command = new _commander.Command("cache");
15
+ (0, _addOptions.addOptions)("cache", command);
16
+ (0, _addOptions.addOptions)("logger", command);
17
+ command.action(_action.cacheAction);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/cache/index.ts"],"sourcesContent":["import { Command, Option } from \"commander\";\nimport { addLoggerOptions } from \"../addLoggerOptions.js\";\nimport { cacheAction } from \"./action.js\";\n\nconst cacheCommand = new Command(\"cache\");\n\naddLoggerOptions(cacheCommand)\n .action(cacheAction)\n .addOption(new Option(\"--prune <days>\", \"Prunes cache older than certain number of <days>\").argParser(parseInt).conflicts(\"--clear\"))\n .option(\"--clear\", \"Clears the cache locally\");\n\nexport { cacheCommand };\n"],"names":["cacheCommand","Command","addLoggerOptions","action","cacheAction","addOption","Option","argParser","parseInt","conflicts","option"],"mappings":";;;;+BAWSA;;;eAAAA;;;2BAXuB;kCACC;wBACL;AAE5B,MAAMA,eAAe,IAAIC,kBAAO,CAAC;AAEjCC,IAAAA,kCAAgB,EAACF,cACdG,MAAM,CAACC,mBAAW,EAClBC,SAAS,CAAC,IAAIC,iBAAM,CAAC,kBAAkB,oDAAoDC,SAAS,CAACC,UAAUC,SAAS,CAAC,YACzHC,MAAM,CAAC,WAAW"}
1
+ {"version":3,"sources":["../../../src/commands/cache/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { cacheAction } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst command = new Command(\"cache\");\n\naddOptions(\"cache\", command);\naddOptions(\"logger\", command);\ncommand.action(cacheAction);\n\nexport { command as cacheCommand };\n"],"names":["cacheCommand","command","Command","addOptions","action","cacheAction"],"mappings":";;;;+BAUoBA;;;eAAXC;;;2BAVe;wBACI;4BACD;AAE3B,MAAMA,UAAU,IAAIC,kBAAO,CAAC;AAE5BC,IAAAA,sBAAU,EAAC,SAASF;AACpBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBA,QAAQG,MAAM,CAACC,mBAAW"}
@@ -1,3 +1,3 @@
1
1
  import { Command } from "commander";
2
- declare const execCommand: Command;
3
- export { execCommand };
2
+ declare const command: Command;
3
+ export { command as execCommand };
@@ -5,22 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  Object.defineProperty(exports, "execCommand", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return execCommand;
8
+ return command;
9
9
  }
10
10
  });
11
11
  const _commander = require("commander");
12
12
  const _action = require("./action.js");
13
- const _addLoggerOptions = require("../addLoggerOptions.js");
14
- const _os = /*#__PURE__*/ _interop_require_default(require("os"));
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
20
- const execCommand = new _commander.Command("exec");
21
- execCommand.option("-n|--node-arg <arg>", "node argument to pass to worker, just a single string to be passed into node like a NODE_OPTIONS setting");
22
- execCommand.option("-c|--concurrency <number>", "max jobs to run at a time", (v)=>parseInt(v), _os.default.cpus().length - 1);
23
- execCommand.option("-s|--server [host:port]", "lage server host");
24
- execCommand.option("-t|--timeout <seconds>", "lage server autoshutoff timeout", (v)=>parseInt(v), 5 * 60);
25
- execCommand.option("--tasks [tasks...]", "A list of tasks to run, separated by space e.g. 'build test', used with --server");
26
- (0, _addLoggerOptions.addLoggerOptions)(execCommand).action(_action.execAction);
13
+ const _addOptions = require("../addOptions.js");
14
+ const command = new _commander.Command("exec");
15
+ (0, _addOptions.addOptions)("pool", command);
16
+ (0, _addOptions.addOptions)("runner", command);
17
+ (0, _addOptions.addOptions)("server", command);
18
+ (0, _addOptions.addOptions)("logger", command);
19
+ command.action(_action.execAction);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/exec/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { execAction } from \"./action.js\";\nimport { addLoggerOptions } from \"../addLoggerOptions.js\";\nimport os from \"os\";\n\nconst execCommand = new Command(\"exec\");\nexecCommand.option(\n \"-n|--node-arg <arg>\",\n \"node argument to pass to worker, just a single string to be passed into node like a NODE_OPTIONS setting\"\n);\nexecCommand.option(\"-c|--concurrency <number>\", \"max jobs to run at a time\", (v) => parseInt(v), os.cpus().length - 1);\nexecCommand.option(\"-s|--server [host:port]\", \"lage server host\");\nexecCommand.option<number>(\"-t|--timeout <seconds>\", \"lage server autoshutoff timeout\", (v) => parseInt(v), 5 * 60);\nexecCommand.option(\"--tasks [tasks...]\", \"A list of tasks to run, separated by space e.g. 'build test', used with --server\");\naddLoggerOptions(execCommand).action(execAction);\nexport { execCommand };\n"],"names":["execCommand","Command","option","v","parseInt","os","cpus","length","addLoggerOptions","action","execAction"],"mappings":";;;;+BAeSA;;;eAAAA;;;2BAfe;wBACG;kCACM;2DAClB;;;;;;AAEf,MAAMA,cAAc,IAAIC,kBAAO,CAAC;AAChCD,YAAYE,MAAM,CAChB,uBACA;AAEFF,YAAYE,MAAM,CAAC,6BAA6B,6BAA6B,CAACC,IAAMC,SAASD,IAAIE,WAAE,CAACC,IAAI,GAAGC,MAAM,GAAG;AACpHP,YAAYE,MAAM,CAAC,2BAA2B;AAC9CF,YAAYE,MAAM,CAAS,0BAA0B,mCAAmC,CAACC,IAAMC,SAASD,IAAI,IAAI;AAChHH,YAAYE,MAAM,CAAC,sBAAsB;AACzCM,IAAAA,kCAAgB,EAACR,aAAaS,MAAM,CAACC,kBAAU"}
1
+ {"version":3,"sources":["../../../src/commands/exec/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { execAction } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst command = new Command(\"exec\");\naddOptions(\"pool\", command);\naddOptions(\"runner\", command);\naddOptions(\"server\", command);\naddOptions(\"logger\", command);\ncommand.action(execAction);\n\nexport { command as execCommand };\n"],"names":["execCommand","command","Command","addOptions","action","execAction"],"mappings":";;;;+BAWoBA;;;eAAXC;;;2BAXe;wBACG;4BACA;AAE3B,MAAMA,UAAU,IAAIC,kBAAO,CAAC;AAC5BC,IAAAA,sBAAU,EAAC,QAAQF;AACnBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBA,QAAQG,MAAM,CAACC,kBAAU"}
@@ -1,3 +1,3 @@
1
1
  import { Command } from "commander";
2
- declare const infoCommand: Command;
3
- export { infoCommand };
2
+ declare const command: Command;
3
+ export { command as infoCommand };
@@ -5,16 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  Object.defineProperty(exports, "infoCommand", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return infoCommand;
8
+ return command;
9
9
  }
10
10
  });
11
11
  const _commander = require("commander");
12
12
  const _action = require("./action.js");
13
- const _addFilterOptions = require("../addFilterOptions.js");
14
- const _addLoggerOptions = require("../addLoggerOptions.js");
15
- const infoCommand = new _commander.Command("info");
16
- (0, _addFilterOptions.addFilterOptions)((0, _addLoggerOptions.addLoggerOptions)(infoCommand));
17
- infoCommand.description("Display information about a target graph in a workspace.\n" + "It is used by BuildXL to build a pip-graph");
18
- infoCommand.option("--server [host:port]", "Run targets of type 'worker' on a background service");
19
- infoCommand.option("--nodearg|--node-arg <nodeArg>", 'arguments to be passed to node (e.g. --nodearg="--max_old_space_size=1234 --heap-prof" - set via "NODE_OPTIONS" environment variable');
20
- infoCommand.action(_action.infoAction);
13
+ const _addOptions = require("../addOptions.js");
14
+ const command = new _commander.Command("info");
15
+ (0, _addOptions.addOptions)("server", command);
16
+ (0, _addOptions.addOptions)("runner", command);
17
+ (0, _addOptions.addOptions)("logger", command);
18
+ (0, _addOptions.addOptions)("filter", command);
19
+ command.action(_action.infoAction);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/info/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { infoAction } from \"./action.js\";\nimport { addFilterOptions } from \"../addFilterOptions.js\";\nimport { addLoggerOptions } from \"../addLoggerOptions.js\";\n\nconst infoCommand = new Command(\"info\");\n\naddFilterOptions(addLoggerOptions(infoCommand));\ninfoCommand.description(\"Display information about a target graph in a workspace.\\n\" + \"It is used by BuildXL to build a pip-graph\");\ninfoCommand.option(\"--server [host:port]\", \"Run targets of type 'worker' on a background service\");\ninfoCommand.option(\n \"--nodearg|--node-arg <nodeArg>\",\n 'arguments to be passed to node (e.g. --nodearg=\"--max_old_space_size=1234 --heap-prof\" - set via \"NODE_OPTIONS\" environment variable'\n);\ninfoCommand.action(infoAction);\n\nexport { infoCommand };\n"],"names":["infoCommand","Command","addFilterOptions","addLoggerOptions","description","option","action","infoAction"],"mappings":";;;;+BAgBSA;;;eAAAA;;;2BAhBe;wBACG;kCACM;kCACA;AAEjC,MAAMA,cAAc,IAAIC,kBAAO,CAAC;AAEhCC,IAAAA,kCAAgB,EAACC,IAAAA,kCAAgB,EAACH;AAClCA,YAAYI,WAAW,CAAC,+DAA+D;AACvFJ,YAAYK,MAAM,CAAC,wBAAwB;AAC3CL,YAAYK,MAAM,CAChB,kCACA;AAEFL,YAAYM,MAAM,CAACC,kBAAU"}
1
+ {"version":3,"sources":["../../../src/commands/info/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { infoAction } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst command = new Command(\"info\");\naddOptions(\"server\", command);\naddOptions(\"runner\", command);\naddOptions(\"logger\", command);\naddOptions(\"filter\", command);\ncommand.action(infoAction);\n\nexport { command as infoCommand };\n"],"names":["infoCommand","command","Command","addOptions","action","infoAction"],"mappings":";;;;+BAWoBA;;;eAAXC;;;2BAXe;wBACG;4BACA;AAE3B,MAAMA,UAAU,IAAIC,kBAAO,CAAC;AAC5BC,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBE,IAAAA,sBAAU,EAAC,UAAUF;AACrBA,QAAQG,MAAM,CAACC,kBAAU"}
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "initCommand", {
9
9
  }
10
10
  });
11
11
  const _commander = require("commander");
12
- const _addFilterOptions = require("../addFilterOptions.js");
13
12
  const _action = require("./action.js");
14
13
  const initCommand = new _commander.Command("init");
15
- (0, _addFilterOptions.addFilterOptions)(initCommand).description("Install lage in a workspace and create a config file").action(_action.initAction);
14
+ initCommand.description("Install lage in a workspace and create a config file").action(_action.initAction);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/init/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { addFilterOptions } from \"../addFilterOptions.js\";\nimport { initAction } from \"./action.js\";\n\nconst initCommand = new Command(\"init\");\n\naddFilterOptions(initCommand).description(\"Install lage in a workspace and create a config file\").action(initAction);\n\nexport { initCommand };\n"],"names":["initCommand","Command","addFilterOptions","description","action","initAction"],"mappings":";;;;+BAQSA;;;eAAAA;;;2BARe;kCACS;wBACN;AAE3B,MAAMA,cAAc,IAAIC,kBAAO,CAAC;AAEhCC,IAAAA,kCAAgB,EAACF,aAAaG,WAAW,CAAC,wDAAwDC,MAAM,CAACC,kBAAU"}
1
+ {"version":3,"sources":["../../../src/commands/init/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { initAction } from \"./action.js\";\n\nconst initCommand = new Command(\"init\");\n\ninitCommand.description(\"Install lage in a workspace and create a config file\").action(initAction);\n\nexport { initCommand };\n"],"names":["initCommand","Command","description","action","initAction"],"mappings":";;;;+BAOSA;;;eAAAA;;;2BAPe;wBACG;AAE3B,MAAMA,cAAc,IAAIC,kBAAO,CAAC;AAEhCD,YAAYE,WAAW,CAAC,wDAAwDC,MAAM,CAACC,kBAAU"}
@@ -54,10 +54,8 @@ async function launchServerInBackground({ logger, root, host, port, tasks, timeo
54
54
  lageServerBinPath,
55
55
  "--tasks",
56
56
  ...tasks,
57
- "--host",
58
- host,
59
- "--port",
60
- `${port}`,
57
+ "--server",
58
+ `${host}:${port}`,
61
59
  "--timeout",
62
60
  `${timeout}`,
63
61
  ...args
@@ -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 { getBinPaths, 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) {\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 \"--host\",\n host,\n \"--port\",\n `${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;6BACyB;;;;;;AAapC,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;YACAF;YACA;YACA,GAAGC,MAAM;YACT;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) {\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"}
@@ -0,0 +1,49 @@
1
+ import { Option } from "commander";
2
+ declare const optionsWithEnv: {
3
+ readonly logger: {
4
+ readonly reporter: Option;
5
+ readonly grouped: Option;
6
+ readonly progress: Option;
7
+ readonly logLevel: Option;
8
+ readonly logFile: Option;
9
+ readonly verbose: Option;
10
+ };
11
+ readonly pool: {
12
+ readonly concurrency: Option;
13
+ readonly continue: Option;
14
+ readonly maxWorkersPerTask: Option;
15
+ };
16
+ readonly runner: {
17
+ readonly nodeArg: Option;
18
+ };
19
+ readonly run: {
20
+ readonly cache: Option;
21
+ readonly resetCache: Option;
22
+ readonly skipLocalCache: Option;
23
+ readonly profile: Option;
24
+ readonly continue: Option;
25
+ readonly allowNoTargetRuns: Option;
26
+ readonly watch: Option;
27
+ };
28
+ readonly server: {
29
+ readonly server: Option;
30
+ readonly tasks: Option;
31
+ readonly timeout: Option;
32
+ };
33
+ readonly filter: {
34
+ readonly scope: Option;
35
+ readonly noDeps: Option;
36
+ readonly includeDependencies: Option;
37
+ readonly to: Option;
38
+ readonly since: Option;
39
+ readonly ignore: Option;
40
+ };
41
+ readonly affected: {
42
+ readonly outputFormat: Option;
43
+ };
44
+ readonly cache: {
45
+ readonly prune: Option;
46
+ readonly clear: Option;
47
+ };
48
+ };
49
+ export { optionsWithEnv as options };
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "options", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return optionsWithEnv;
9
+ }
10
+ });
11
+ const _commander = require("commander");
12
+ const isCI = process.env.CI || process.env.TF_BUILD;
13
+ const options = {
14
+ logger: {
15
+ reporter: new _commander.Option("--reporter <reporter...>", "reporter"),
16
+ grouped: new _commander.Option("--grouped", "groups the logs").default(false),
17
+ progress: new _commander.Option("--progress").conflicts([
18
+ "reporter",
19
+ "grouped",
20
+ "verbose"
21
+ ]).default(!isCI),
22
+ logLevel: new _commander.Option("--log-level <level>", "log level").choices([
23
+ "info",
24
+ "warn",
25
+ "error",
26
+ "verbose",
27
+ "silly"
28
+ ]).conflicts("verbose"),
29
+ logFile: new _commander.Option("--log-file <file>", "when used with --reporter vfl, writes verbose, ungrouped logs to the specified file"),
30
+ verbose: new _commander.Option("--verbose", "verbose output").default(false)
31
+ },
32
+ pool: {
33
+ concurrency: new _commander.Option("-c|--concurrency <number>", "max jobs to run at a time").argParser((v)=>parseInt(v)),
34
+ continue: new _commander.Option("--continue", "continue running even after encountering an error for one of the targets"),
35
+ 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([])
36
+ },
37
+ runner: {
38
+ 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")')
39
+ },
40
+ run: {
41
+ cache: new _commander.Option("--no-cache", "disables the cache"),
42
+ resetCache: new _commander.Option("--reset-cache", "resets the cache, filling it after a run"),
43
+ skipLocalCache: new _commander.Option("--skip-local-cache", "skips caching locally (defaults to true in CI environments)").default(isCI),
44
+ profile: new _commander.Option("--profile [profile]", "writes a run profile into a file that can be processed by Chromium devtool"),
45
+ continue: new _commander.Option("--continue", "continues the run even on error"),
46
+ allowNoTargetRuns: new _commander.Option("--allow-no-target-runs"),
47
+ watch: new _commander.Option("--watch", "runs in watch mode")
48
+ },
49
+ server: {
50
+ server: new _commander.Option("--server [host:port]", "Run targets of type 'worker' on a background service"),
51
+ tasks: new _commander.Option("--tasks <tasks...>", "A list of tasks to run, separated by space e.g. 'build test'"),
52
+ timeout: new _commander.Option("-t|--timeout <seconds>", "lage server autoshutoff timeout").default(5 * 60).argParser((v)=>parseInt(v))
53
+ },
54
+ filter: {
55
+ scope: new _commander.Option("--scope <scope...>", "scopes the run to a subset of packages (by default, includes the dependencies and dependents as well)"),
56
+ noDeps: new _commander.Option("--no-deps|--no-dependents", "disables running any dependents of the scoped packages"),
57
+ includeDependencies: new _commander.Option("--include-dependencies|--dependencies", 'adds the scoped packages dependencies as the "entry points" for the target graph run'),
58
+ to: new _commander.Option("--to <scope...>", "runs up to a package (shorthand for --scope=<scope...> --no-dependents)"),
59
+ since: new _commander.Option("--since <since>", "only runs packages that have changed since the given commit, tag, or branch"),
60
+ ignore: new _commander.Option("--ignore <ignore...>", "ignores files when calculating the scope with `--since` in addition to the files specified in lage.config").default([])
61
+ },
62
+ affected: {
63
+ 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`)
64
+ },
65
+ cache: {
66
+ prune: new _commander.Option("--prune <days>", "Prunes cache older than certain number of <days>").argParser(parseInt).conflicts("--clear"),
67
+ clear: new _commander.Option("--clear", "Clears the cache locally")
68
+ }
69
+ };
70
+ const optionsWithEnv = addEnvOptions(options);
71
+ function addEnvOptions(opts) {
72
+ for(const key in opts){
73
+ for (const [name, option] of Object.entries(opts[key])){
74
+ // convert the camel cased name to uppercase with underscores
75
+ const upperCaseSnakeKey = key.replace(/([A-Z])/g, "_$1").toUpperCase();
76
+ const upperCaseSnakeName = name.replace(/([A-Z])/g, "_$1").toUpperCase();
77
+ option.env(`LAGE_${upperCaseSnakeKey}_${upperCaseSnakeName}`);
78
+ }
79
+ }
80
+ return opts;
81
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/options.ts"],"sourcesContent":["import { Option } from \"commander\";\n\nconst isCI = process.env.CI || process.env.TF_BUILD;\n\nconst options = {\n logger: {\n reporter: new Option(\"--reporter <reporter...>\", \"reporter\"),\n grouped: new Option(\"--grouped\", \"groups the logs\").default(false),\n progress: new Option(\"--progress\").conflicts([\"reporter\", \"grouped\", \"verbose\"]).default(!isCI),\n logLevel: new Option(\"--log-level <level>\", \"log level\").choices([\"info\", \"warn\", \"error\", \"verbose\", \"silly\"]).conflicts(\"verbose\"),\n logFile: new Option(\"--log-file <file>\", \"when used with --reporter vfl, writes verbose, ungrouped logs to the specified file\"),\n verbose: new Option(\"--verbose\", \"verbose output\").default(false),\n },\n pool: {\n concurrency: new Option(\"-c|--concurrency <number>\", \"max jobs to run at a time\").argParser((v) => parseInt(v)),\n continue: new Option(\"--continue\", \"continue running even after encountering an error for one of the targets\"),\n maxWorkersPerTask: new Option(\n \"--max-workers-per-task <maxWorkersPerTarget...>\",\n \"set max worker per task, e.g. --max-workers-per-task build=2 test=4\"\n ).default([]),\n },\n runner: {\n nodeArg: new Option(\n \"-n|--node-arg <arg>\",\n 'node arguments as a string to be passed into node like a NODE_OPTIONS setting, (e.g. --nodearg=\"--max_old_space_size=1234 --heap-prof\")'\n ),\n },\n run: {\n cache: new Option(\"--no-cache\", \"disables the cache\"),\n resetCache: new Option(\"--reset-cache\", \"resets the cache, filling it after a run\"),\n skipLocalCache: new Option(\"--skip-local-cache\", \"skips caching locally (defaults to true in CI environments)\").default(isCI),\n profile: new Option(\"--profile [profile]\", \"writes a run profile into a file that can be processed by Chromium devtool\"),\n continue: new Option(\"--continue\", \"continues the run even on error\"),\n allowNoTargetRuns: new Option(\"--allow-no-target-runs\"),\n watch: new Option(\"--watch\", \"runs in watch mode\"),\n },\n server: {\n server: new Option(\"--server [host:port]\", \"Run targets of type 'worker' on a background service\"),\n tasks: new Option(\"--tasks <tasks...>\", \"A list of tasks to run, separated by space e.g. 'build test'\"),\n timeout: new Option(\"-t|--timeout <seconds>\", \"lage server autoshutoff timeout\").default(5 * 60).argParser((v) => parseInt(v)),\n },\n filter: {\n scope: new Option(\n \"--scope <scope...>\",\n \"scopes the run to a subset of packages (by default, includes the dependencies and dependents as well)\"\n ),\n noDeps: new Option(\"--no-deps|--no-dependents\", \"disables running any dependents of the scoped packages\"),\n includeDependencies: new Option(\n \"--include-dependencies|--dependencies\",\n 'adds the scoped packages dependencies as the \"entry points\" for the target graph run'\n ),\n to: new Option(\"--to <scope...>\", \"runs up to a package (shorthand for --scope=<scope...> --no-dependents)\"),\n since: new Option(\"--since <since>\", \"only runs packages that have changed since the given commit, tag, or branch\"),\n ignore: new Option(\n \"--ignore <ignore...>\",\n \"ignores files when calculating the scope with `--since` in addition to the files specified in lage.config\"\n ).default([]),\n },\n affected: {\n outputFormat: new Option(\n \"--output-format <graph|json|default>\",\n `Generate a report about what packages are affected by the current change (defaults to human readable format) ` +\n `\"graph\" will generate a GraphViz .dot file format`\n ),\n },\n cache: {\n prune: new Option(\"--prune <days>\", \"Prunes cache older than certain number of <days>\").argParser(parseInt).conflicts(\"--clear\"),\n clear: new Option(\"--clear\", \"Clears the cache locally\"),\n },\n} as const;\n\nconst optionsWithEnv = addEnvOptions(options);\n\nfunction addEnvOptions(opts: typeof options) {\n for (const key in opts) {\n for (const [name, option] of Object.entries<Option>(opts[key])) {\n // convert the camel cased name to uppercase with underscores\n const upperCaseSnakeKey = key.replace(/([A-Z])/g, \"_$1\").toUpperCase();\n const upperCaseSnakeName = name.replace(/([A-Z])/g, \"_$1\").toUpperCase();\n option.env(`LAGE_${upperCaseSnakeKey}_${upperCaseSnakeName}`);\n }\n }\n\n return opts;\n}\n\nexport { optionsWithEnv as options };\n"],"names":["options","optionsWithEnv","isCI","process","env","CI","TF_BUILD","logger","reporter","Option","grouped","default","progress","conflicts","logLevel","choices","logFile","verbose","pool","concurrency","argParser","v","parseInt","continue","maxWorkersPerTask","runner","nodeArg","run","cache","resetCache","skipLocalCache","profile","allowNoTargetRuns","watch","server","tasks","timeout","filter","scope","noDeps","includeDependencies","to","since","ignore","affected","outputFormat","prune","clear","addEnvOptions","opts","key","name","option","Object","entries","upperCaseSnakeKey","replace","toUpperCase","upperCaseSnakeName"],"mappings":";;;;+BAsF2BA;;;eAAlBC;;;2BAtFc;AAEvB,MAAMC,OAAOC,QAAQC,GAAG,CAACC,EAAE,IAAIF,QAAQC,GAAG,CAACE,QAAQ;AAEnD,MAAMN,UAAU;IACdO,QAAQ;QACNC,UAAU,IAAIC,iBAAM,CAAC,4BAA4B;QACjDC,SAAS,IAAID,iBAAM,CAAC,aAAa,mBAAmBE,OAAO,CAAC;QAC5DC,UAAU,IAAIH,iBAAM,CAAC,cAAcI,SAAS,CAAC;YAAC;YAAY;YAAW;SAAU,EAAEF,OAAO,CAAC,CAACT;QAC1FY,UAAU,IAAIL,iBAAM,CAAC,uBAAuB,aAAaM,OAAO,CAAC;YAAC;YAAQ;YAAQ;YAAS;YAAW;SAAQ,EAAEF,SAAS,CAAC;QAC1HG,SAAS,IAAIP,iBAAM,CAAC,qBAAqB;QACzCQ,SAAS,IAAIR,iBAAM,CAAC,aAAa,kBAAkBE,OAAO,CAAC;IAC7D;IACAO,MAAM;QACJC,aAAa,IAAIV,iBAAM,CAAC,6BAA6B,6BAA6BW,SAAS,CAAC,CAACC,IAAMC,SAASD;QAC5GE,UAAU,IAAId,iBAAM,CAAC,cAAc;QACnCe,mBAAmB,IAAIf,iBAAM,CAC3B,mDACA,uEACAE,OAAO,CAAC,EAAE;IACd;IACAc,QAAQ;QACNC,SAAS,IAAIjB,iBAAM,CACjB,uBACA;IAEJ;IACAkB,KAAK;QACHC,OAAO,IAAInB,iBAAM,CAAC,cAAc;QAChCoB,YAAY,IAAIpB,iBAAM,CAAC,iBAAiB;QACxCqB,gBAAgB,IAAIrB,iBAAM,CAAC,sBAAsB,+DAA+DE,OAAO,CAACT;QACxH6B,SAAS,IAAItB,iBAAM,CAAC,uBAAuB;QAC3Cc,UAAU,IAAId,iBAAM,CAAC,cAAc;QACnCuB,mBAAmB,IAAIvB,iBAAM,CAAC;QAC9BwB,OAAO,IAAIxB,iBAAM,CAAC,WAAW;IAC/B;IACAyB,QAAQ;QACNA,QAAQ,IAAIzB,iBAAM,CAAC,wBAAwB;QAC3C0B,OAAO,IAAI1B,iBAAM,CAAC,sBAAsB;QACxC2B,SAAS,IAAI3B,iBAAM,CAAC,0BAA0B,mCAAmCE,OAAO,CAAC,IAAI,IAAIS,SAAS,CAAC,CAACC,IAAMC,SAASD;IAC7H;IACAgB,QAAQ;QACNC,OAAO,IAAI7B,iBAAM,CACf,sBACA;QAEF8B,QAAQ,IAAI9B,iBAAM,CAAC,6BAA6B;QAChD+B,qBAAqB,IAAI/B,iBAAM,CAC7B,yCACA;QAEFgC,IAAI,IAAIhC,iBAAM,CAAC,mBAAmB;QAClCiC,OAAO,IAAIjC,iBAAM,CAAC,mBAAmB;QACrCkC,QAAQ,IAAIlC,iBAAM,CAChB,wBACA,6GACAE,OAAO,CAAC,EAAE;IACd;IACAiC,UAAU;QACRC,cAAc,IAAIpC,iBAAM,CACtB,wCACA,CAAC,6GAA6G,CAAC,GAC7G,CAAC,iDAAiD,CAAC;IAEzD;IACAmB,OAAO;QACLkB,OAAO,IAAIrC,iBAAM,CAAC,kBAAkB,oDAAoDW,SAAS,CAACE,UAAUT,SAAS,CAAC;QACtHkC,OAAO,IAAItC,iBAAM,CAAC,WAAW;IAC/B;AACF;AAEA,MAAMR,iBAAiB+C,cAAchD;AAErC,SAASgD,cAAcC,IAAoB;IACzC,IAAK,MAAMC,OAAOD,KAAM;QACtB,KAAK,MAAM,CAACE,MAAMC,OAAO,IAAIC,OAAOC,OAAO,CAASL,IAAI,CAACC,IAAI,EAAG;YAC9D,6DAA6D;YAC7D,MAAMK,oBAAoBL,IAAIM,OAAO,CAAC,YAAY,OAAOC,WAAW;YACpE,MAAMC,qBAAqBP,KAAKK,OAAO,CAAC,YAAY,OAAOC,WAAW;YACtEL,OAAOhD,GAAG,CAAC,CAAC,KAAK,EAAEmD,kBAAkB,CAAC,EAAEG,oBAAoB;QAC9D;IACF;IAEA,OAAOT;AACT"}
@@ -1,3 +1,3 @@
1
1
  import { Command } from "commander";
2
- declare const runCommand: Command;
3
- export { runCommand };
2
+ declare const command: Command;
3
+ export { command as runCommand };
@@ -5,17 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  Object.defineProperty(exports, "runCommand", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return runCommand;
8
+ return command;
9
9
  }
10
10
  });
11
11
  const _commander = require("commander");
12
12
  const _action = require("./action.js");
13
- const _addLoggerOptions = require("../addLoggerOptions.js");
14
- const _isRunningFromCI = require("../isRunningFromCI.js");
15
- const _addFilterOptions = require("../addFilterOptions.js");
16
- const runCommand = new _commander.Command("run");
17
- (0, _addFilterOptions.addFilterOptions)((0, _addLoggerOptions.addLoggerOptions)(runCommand)).action(_action.action).option("-c, --concurrency <n>", "concurrency", (value)=>parseInt(value, 10)).option("--max-workers-per-task <maxWorkersPerTarget...>", "set max worker per task, e.g. --max-workers-per-task build=2 test=4", [])// Run Command Options
18
- .option("--no-cache", "disables the cache").option("--reset-cache", "resets the cache, filling it after a run").option("--skip-local-cache", "skips caching locally (defaults to true in CI environments)", _isRunningFromCI.isRunningFromCI).option("--profile [profile]", "writes a run profile into a file that can be processed by Chromium devtool").option("--nodearg|--node-arg <nodeArg>", 'arguments to be passed to node (e.g. --nodearg="--max_old_space_size=1234 --heap-prof" - set via "NODE_OPTIONS" environment variable').option("--continue", "continues the run even on error").option("--allow-no-target-runs").option("--watch", "runs in watch mode").allowUnknownOption(true).addHelpCommand("[run] command1 [command2...commandN] [options]", "run commands").addHelpText("after", `
13
+ const _addOptions = require("../addOptions.js");
14
+ const command = new _commander.Command("run");
15
+ (0, _addOptions.addOptions)("filter", command);
16
+ (0, _addOptions.addOptions)("logger", command);
17
+ (0, _addOptions.addOptions)("pool", command);
18
+ (0, _addOptions.addOptions)("runner", command);
19
+ (0, _addOptions.addOptions)("run", command);
20
+ command.action(_action.action).allowUnknownOption(true).addHelpCommand("[run] command1 [command2...commandN] [options]", "run commands").addHelpText("after", `
19
21
  Runs a set of commands in a target graph. The targets are defined by packages and their scripts as defined the package.json files.
20
22
 
21
23
  Examples
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/run/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { action } from \"./action.js\";\nimport { addLoggerOptions } from \"../addLoggerOptions.js\";\nimport { isRunningFromCI } from \"../isRunningFromCI.js\";\nimport { addFilterOptions } from \"../addFilterOptions.js\";\n\nconst runCommand = new Command(\"run\");\n\naddFilterOptions(addLoggerOptions(runCommand))\n .action(action)\n .option(\"-c, --concurrency <n>\", \"concurrency\", (value) => parseInt(value, 10))\n .option(\"--max-workers-per-task <maxWorkersPerTarget...>\", \"set max worker per task, e.g. --max-workers-per-task build=2 test=4\", [])\n\n // Run Command Options\n .option(\"--no-cache\", \"disables the cache\")\n .option(\"--reset-cache\", \"resets the cache, filling it after a run\")\n .option(\"--skip-local-cache\", \"skips caching locally (defaults to true in CI environments)\", isRunningFromCI)\n .option(\"--profile [profile]\", \"writes a run profile into a file that can be processed by Chromium devtool\")\n .option(\n \"--nodearg|--node-arg <nodeArg>\",\n 'arguments to be passed to node (e.g. --nodearg=\"--max_old_space_size=1234 --heap-prof\" - set via \"NODE_OPTIONS\" environment variable'\n )\n .option(\"--continue\", \"continues the run even on error\")\n .option(\"--allow-no-target-runs\")\n .option(\"--watch\", \"runs in watch mode\")\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 { runCommand };\n"],"names":["runCommand","Command","addFilterOptions","addLoggerOptions","action","option","value","parseInt","isRunningFromCI","allowUnknownOption","addHelpCommand","addHelpText"],"mappings":";;;;+BA8FSA;;;eAAAA;;;2BA9Fe;wBACD;kCACU;iCACD;kCACC;AAEjC,MAAMA,aAAa,IAAIC,kBAAO,CAAC;AAE/BC,IAAAA,kCAAgB,EAACC,IAAAA,kCAAgB,EAACH,aAC/BI,MAAM,CAACA,cAAM,EACbC,MAAM,CAAC,yBAAyB,eAAe,CAACC,QAAUC,SAASD,OAAO,KAC1ED,MAAM,CAAC,mDAAmD,uEAAuE,EAAE,CAEpI,sBAAsB;CACrBA,MAAM,CAAC,cAAc,sBACrBA,MAAM,CAAC,iBAAiB,4CACxBA,MAAM,CAAC,sBAAsB,+DAA+DG,gCAAe,EAC3GH,MAAM,CAAC,uBAAuB,8EAC9BA,MAAM,CACL,kCACA,wIAEDA,MAAM,CAAC,cAAc,mCACrBA,MAAM,CAAC,0BACPA,MAAM,CAAC,WAAW,sBAClBI,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 = 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,UAAU,IAAIC,kBAAO,CAAC;AAE5BC,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,8 +1,7 @@
1
1
  import type { ReporterInitOptions } from "../../types/ReporterInitOptions.js";
2
2
  interface WorkerOptions extends ReporterInitOptions {
3
3
  nodeArg?: string[];
4
- port?: number;
5
- host?: string;
4
+ server?: string;
6
5
  timeout?: number;
7
6
  shutdown: boolean;
8
7
  tasks: string[];
@@ -12,13 +12,15 @@ const _logger = /*#__PURE__*/ _interop_require_default(require("@lage-run/logger
12
12
  const _initializeReporters = require("../initializeReporters.js");
13
13
  const _lageService = require("./lageService.js");
14
14
  const _rpc = require("@lage-run/rpc");
15
+ const _parseServerOption = require("../parseServerOption.js");
15
16
  function _interop_require_default(obj) {
16
17
  return obj && obj.__esModule ? obj : {
17
18
  default: obj
18
19
  };
19
20
  }
20
21
  async function serverAction(options) {
21
- const { port = 5332, host = "localhost", timeout = 1, tasks } = options;
22
+ const { server = "localhost:5332", timeout = 1, tasks } = options;
23
+ const { host, port } = (0, _parseServerOption.parseServerOption)(server);
22
24
  const logger = (0, _logger.default)();
23
25
  options.logLevel = options.logLevel ?? "info";
24
26
  options.logFile = options.logFile ?? "node_modules/.cache/lage/server.log";
@@ -37,8 +39,8 @@ async function serverAction(options) {
37
39
  concurrency: options.concurrency,
38
40
  tasks
39
41
  });
40
- const server = await (0, _rpc.createServer)(lageService, abortController);
41
- await server.listen({
42
+ const lageServer = await (0, _rpc.createServer)(lageService, abortController);
43
+ await lageServer.listen({
42
44
  host,
43
45
  port
44
46
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/server/action.ts"],"sourcesContent":["import createLogger, { type Logger } from \"@lage-run/logger\";\nimport type { ReporterInitOptions } from \"../../types/ReporterInitOptions.js\";\nimport { initializeReporters } from \"../initializeReporters.js\";\nimport { createLageService } from \"./lageService.js\";\nimport { createServer } from \"@lage-run/rpc\";\n\ninterface WorkerOptions extends ReporterInitOptions {\n nodeArg?: string[];\n port?: number;\n host?: string;\n timeout?: number;\n shutdown: boolean;\n tasks: string[];\n}\n\nexport async function serverAction(options: WorkerOptions) {\n const { port = 5332, host = \"localhost\", timeout = 1, tasks } = options;\n\n const logger = createLogger();\n options.logLevel = options.logLevel ?? \"info\";\n options.logFile = options.logFile ?? \"node_modules/.cache/lage/server.log\";\n options.reporter = options.reporter ?? \"verboseFileLog\";\n initializeReporters(logger, options);\n\n logger.info(`Starting server on http://${host}:${port}`);\n\n const abortController = new AbortController();\n\n const lageService = await createLageService({\n cwd: process.cwd(),\n serverControls: {\n abortController,\n countdownToShutdown: () => resetTimer(logger, timeout, abortController, server),\n clearCountdown: clearTimer,\n },\n logger,\n concurrency: options.concurrency,\n tasks,\n });\n const server = await createServer(lageService, abortController);\n\n await server.listen({ host, port });\n logger.info(`Server listening on http://${host}:${port}, timeout in ${timeout} seconds`);\n}\n\nlet timeoutHandle: NodeJS.Timeout | undefined;\nfunction resetTimer(logger: Logger, timeout: number, abortController: AbortController, server: any) {\n clearTimer();\n\n timeoutHandle = globalThis.setTimeout(() => {\n logger.info(`Server timed out after ${timeout} seconds`);\n abortController.abort();\n server.close();\n }, timeout * 1000);\n}\n\nfunction clearTimer() {\n if (timeoutHandle) {\n globalThis.clearTimeout(timeoutHandle);\n }\n}\n"],"names":["serverAction","options","port","host","timeout","tasks","logger","createLogger","logLevel","logFile","reporter","initializeReporters","info","abortController","AbortController","lageService","createLageService","cwd","process","serverControls","countdownToShutdown","resetTimer","server","clearCountdown","clearTimer","concurrency","createServer","listen","timeoutHandle","globalThis","setTimeout","abort","close","clearTimeout"],"mappings":";;;;+BAesBA;;;eAAAA;;;+DAfoB;qCAEN;6BACF;qBACL;;;;;;AAWtB,eAAeA,aAAaC,OAAsB;IACvD,MAAM,EAAEC,OAAO,IAAI,EAAEC,OAAO,WAAW,EAAEC,UAAU,CAAC,EAAEC,KAAK,EAAE,GAAGJ;IAEhE,MAAMK,SAASC,IAAAA,eAAY;IAC3BN,QAAQO,QAAQ,GAAGP,QAAQO,QAAQ,IAAI;IACvCP,QAAQQ,OAAO,GAAGR,QAAQQ,OAAO,IAAI;IACrCR,QAAQS,QAAQ,GAAGT,QAAQS,QAAQ,IAAI;IACvCC,IAAAA,wCAAmB,EAACL,QAAQL;IAE5BK,OAAOM,IAAI,CAAC,CAAC,0BAA0B,EAAET,KAAK,CAAC,EAAED,MAAM;IAEvD,MAAMW,kBAAkB,IAAIC;IAE5B,MAAMC,cAAc,MAAMC,IAAAA,8BAAiB,EAAC;QAC1CC,KAAKC,QAAQD,GAAG;QAChBE,gBAAgB;YACdN;YACAO,qBAAqB,IAAMC,WAAWf,QAAQF,SAASS,iBAAiBS;YACxEC,gBAAgBC;QAClB;QACAlB;QACAmB,aAAaxB,QAAQwB,WAAW;QAChCpB;IACF;IACA,MAAMiB,SAAS,MAAMI,IAAAA,iBAAY,EAACX,aAAaF;IAE/C,MAAMS,OAAOK,MAAM,CAAC;QAAExB;QAAMD;IAAK;IACjCI,OAAOM,IAAI,CAAC,CAAC,2BAA2B,EAAET,KAAK,CAAC,EAAED,KAAK,aAAa,EAAEE,QAAQ,QAAQ,CAAC;AACzF;AAEA,IAAIwB;AACJ,SAASP,WAAWf,MAAc,EAAEF,OAAe,EAAES,eAAgC,EAAES,MAAW;IAChGE;IAEAI,gBAAgBC,WAAWC,UAAU,CAAC;QACpCxB,OAAOM,IAAI,CAAC,CAAC,uBAAuB,EAAER,QAAQ,QAAQ,CAAC;QACvDS,gBAAgBkB,KAAK;QACrBT,OAAOU,KAAK;IACd,GAAG5B,UAAU;AACf;AAEA,SAASoB;IACP,IAAII,eAAe;QACjBC,WAAWI,YAAY,CAACL;IAC1B;AACF"}
1
+ {"version":3,"sources":["../../../src/commands/server/action.ts"],"sourcesContent":["import createLogger, { type Logger } from \"@lage-run/logger\";\nimport type { ReporterInitOptions } from \"../../types/ReporterInitOptions.js\";\nimport { initializeReporters } from \"../initializeReporters.js\";\nimport { createLageService } from \"./lageService.js\";\nimport { createServer } from \"@lage-run/rpc\";\nimport { parseServerOption } from \"../parseServerOption.js\";\n\ninterface WorkerOptions extends ReporterInitOptions {\n nodeArg?: string[];\n server?: string;\n timeout?: number;\n shutdown: boolean;\n tasks: string[];\n}\n\nexport async function serverAction(options: WorkerOptions) {\n const { server = \"localhost:5332\", timeout = 1, tasks } = options;\n\n const { host, port } = parseServerOption(server);\n\n const logger = createLogger();\n options.logLevel = options.logLevel ?? \"info\";\n options.logFile = options.logFile ?? \"node_modules/.cache/lage/server.log\";\n options.reporter = options.reporter ?? \"verboseFileLog\";\n initializeReporters(logger, options);\n\n logger.info(`Starting server on http://${host}:${port}`);\n\n const abortController = new AbortController();\n\n const lageService = await createLageService({\n cwd: process.cwd(),\n serverControls: {\n abortController,\n countdownToShutdown: () => resetTimer(logger, timeout, abortController, server),\n clearCountdown: clearTimer,\n },\n logger,\n concurrency: options.concurrency,\n tasks,\n });\n const lageServer = await createServer(lageService, abortController);\n\n await lageServer.listen({ host, port });\n logger.info(`Server listening on http://${host}:${port}, timeout in ${timeout} seconds`);\n}\n\nlet timeoutHandle: NodeJS.Timeout | undefined;\nfunction resetTimer(logger: Logger, timeout: number, abortController: AbortController, server: any) {\n clearTimer();\n\n timeoutHandle = globalThis.setTimeout(() => {\n logger.info(`Server timed out after ${timeout} seconds`);\n abortController.abort();\n server.close();\n }, timeout * 1000);\n}\n\nfunction clearTimer() {\n if (timeoutHandle) {\n globalThis.clearTimeout(timeoutHandle);\n }\n}\n"],"names":["serverAction","options","server","timeout","tasks","host","port","parseServerOption","logger","createLogger","logLevel","logFile","reporter","initializeReporters","info","abortController","AbortController","lageService","createLageService","cwd","process","serverControls","countdownToShutdown","resetTimer","clearCountdown","clearTimer","concurrency","lageServer","createServer","listen","timeoutHandle","globalThis","setTimeout","abort","close","clearTimeout"],"mappings":";;;;+BAesBA;;;eAAAA;;;+DAfoB;qCAEN;6BACF;qBACL;mCACK;;;;;;AAU3B,eAAeA,aAAaC,OAAsB;IACvD,MAAM,EAAEC,SAAS,gBAAgB,EAAEC,UAAU,CAAC,EAAEC,KAAK,EAAE,GAAGH;IAE1D,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAE,GAAGC,IAAAA,oCAAiB,EAACL;IAEzC,MAAMM,SAASC,IAAAA,eAAY;IAC3BR,QAAQS,QAAQ,GAAGT,QAAQS,QAAQ,IAAI;IACvCT,QAAQU,OAAO,GAAGV,QAAQU,OAAO,IAAI;IACrCV,QAAQW,QAAQ,GAAGX,QAAQW,QAAQ,IAAI;IACvCC,IAAAA,wCAAmB,EAACL,QAAQP;IAE5BO,OAAOM,IAAI,CAAC,CAAC,0BAA0B,EAAET,KAAK,CAAC,EAAEC,MAAM;IAEvD,MAAMS,kBAAkB,IAAIC;IAE5B,MAAMC,cAAc,MAAMC,IAAAA,8BAAiB,EAAC;QAC1CC,KAAKC,QAAQD,GAAG;QAChBE,gBAAgB;YACdN;YACAO,qBAAqB,IAAMC,WAAWf,QAAQL,SAASY,iBAAiBb;YACxEsB,gBAAgBC;QAClB;QACAjB;QACAkB,aAAazB,QAAQyB,WAAW;QAChCtB;IACF;IACA,MAAMuB,aAAa,MAAMC,IAAAA,iBAAY,EAACX,aAAaF;IAEnD,MAAMY,WAAWE,MAAM,CAAC;QAAExB;QAAMC;IAAK;IACrCE,OAAOM,IAAI,CAAC,CAAC,2BAA2B,EAAET,KAAK,CAAC,EAAEC,KAAK,aAAa,EAAEH,QAAQ,QAAQ,CAAC;AACzF;AAEA,IAAI2B;AACJ,SAASP,WAAWf,MAAc,EAAEL,OAAe,EAAEY,eAAgC,EAAEb,MAAW;IAChGuB;IAEAK,gBAAgBC,WAAWC,UAAU,CAAC;QACpCxB,OAAOM,IAAI,CAAC,CAAC,uBAAuB,EAAEX,QAAQ,QAAQ,CAAC;QACvDY,gBAAgBkB,KAAK;QACrB/B,OAAOgC,KAAK;IACd,GAAG/B,UAAU;AACf;AAEA,SAASsB;IACP,IAAIK,eAAe;QACjBC,WAAWI,YAAY,CAACL;IAC1B;AACF"}
@@ -1,3 +1,3 @@
1
1
  import { Command } from "commander";
2
- declare const serverCommand: Command;
3
- export { serverCommand };
2
+ declare const command: Command;
3
+ export { command as serverCommand };
@@ -5,17 +5,16 @@ Object.defineProperty(exports, "__esModule", {
5
5
  Object.defineProperty(exports, "serverCommand", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return serverCommand;
8
+ return command;
9
9
  }
10
10
  });
11
11
  const _commander = require("commander");
12
12
  const _action = require("./action.js");
13
- const _addLoggerOptions = require("../addLoggerOptions.js");
14
- const serverCommand = new _commander.Command("server");
15
- serverCommand.option("-n|--node-arg <arg>", "node argument to pass to worker, just a single string to be passed into node like a NODE_OPTIONS setting");
16
- serverCommand.option("-c|--concurrency <number>", "max jobs to run at a time", (v)=>parseInt(v));
17
- serverCommand.option("-h|--host <host>", "lage server host", "localhost");
18
- serverCommand.option("-p|--port <port>", "lage worker server port", (v)=>parseInt(v), 5332);
19
- serverCommand.option("-t|--timeout <seconds>", "lage server autoshutoff timeout", (v)=>parseInt(v), 5 * 60);
20
- serverCommand.option("--tasks <tasks...>", "A list of tasks to run, separated by space e.g. 'build test'");
21
- (0, _addLoggerOptions.addLoggerOptions)(serverCommand).action(_action.serverAction);
13
+ const _addOptions = require("../addOptions.js");
14
+ const command = new _commander.Command("server");
15
+ command.action(_action.serverAction);
16
+ (0, _addOptions.addOptions)("server", command);
17
+ (0, _addOptions.addOptions)("pool", command);
18
+ (0, _addOptions.addOptions)("runner", command);
19
+ (0, _addOptions.addOptions)("logger", command);
20
+ command.action(_action.serverAction);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/server/index.ts"],"sourcesContent":["import os from \"os\";\nimport { Command } from \"commander\";\nimport { serverAction } from \"./action.js\";\nimport { addLoggerOptions } from \"../addLoggerOptions.js\";\n\nconst serverCommand = new Command(\"server\");\nserverCommand.option(\n \"-n|--node-arg <arg>\",\n \"node argument to pass to worker, just a single string to be passed into node like a NODE_OPTIONS setting\"\n);\nserverCommand.option(\"-c|--concurrency <number>\", \"max jobs to run at a time\", (v) => parseInt(v));\nserverCommand.option(\"-h|--host <host>\", \"lage server host\", \"localhost\");\nserverCommand.option<number>(\"-p|--port <port>\", \"lage worker server port\", (v) => parseInt(v), 5332);\nserverCommand.option<number>(\"-t|--timeout <seconds>\", \"lage server autoshutoff timeout\", (v) => parseInt(v), 5 * 60);\nserverCommand.option(\"--tasks <tasks...>\", \"A list of tasks to run, separated by space e.g. 'build test'\");\n\naddLoggerOptions(serverCommand).action(serverAction);\n\nexport { serverCommand };\n"],"names":["serverCommand","Command","option","v","parseInt","addLoggerOptions","action","serverAction"],"mappings":";;;;+BAkBSA;;;eAAAA;;;2BAjBe;wBACK;kCACI;AAEjC,MAAMA,gBAAgB,IAAIC,kBAAO,CAAC;AAClCD,cAAcE,MAAM,CAClB,uBACA;AAEFF,cAAcE,MAAM,CAAC,6BAA6B,6BAA6B,CAACC,IAAMC,SAASD;AAC/FH,cAAcE,MAAM,CAAC,oBAAoB,oBAAoB;AAC7DF,cAAcE,MAAM,CAAS,oBAAoB,2BAA2B,CAACC,IAAMC,SAASD,IAAI;AAChGH,cAAcE,MAAM,CAAS,0BAA0B,mCAAmC,CAACC,IAAMC,SAASD,IAAI,IAAI;AAClHH,cAAcE,MAAM,CAAC,sBAAsB;AAE3CG,IAAAA,kCAAgB,EAACL,eAAeM,MAAM,CAACC,oBAAY"}
1
+ {"version":3,"sources":["../../../src/commands/server/index.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { serverAction } from \"./action.js\";\nimport { addOptions } from \"../addOptions.js\";\n\nconst command = new Command(\"server\");\n\ncommand.action(serverAction);\naddOptions(\"server\", command);\naddOptions(\"pool\", command);\naddOptions(\"runner\", command);\naddOptions(\"logger\", command);\ncommand.action(serverAction);\n\nexport { command as serverCommand };\n"],"names":["serverCommand","command","Command","action","serverAction","addOptions"],"mappings":";;;;+BAaoBA;;;eAAXC;;;2BAbe;wBACK;4BACF;AAE3B,MAAMA,UAAU,IAAIC,kBAAO,CAAC;AAE5BD,QAAQE,MAAM,CAACC,oBAAY;AAC3BC,IAAAA,sBAAU,EAAC,UAAUJ;AACrBI,IAAAA,sBAAU,EAAC,QAAQJ;AACnBI,IAAAA,sBAAU,EAAC,UAAUJ;AACrBI,IAAAA,sBAAU,EAAC,UAAUJ;AACrBA,QAAQE,MAAM,CAACC,oBAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/cli",
3
- "version": "0.24.13",
3
+ "version": "0.25.0",
4
4
  "description": "Command Line Interface for Lage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function addFilterOptions(program: Command): Command;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "addFilterOptions", {
6
- enumerable: true,
7
- get: function() {
8
- return addFilterOptions;
9
- }
10
- });
11
- function addFilterOptions(program) {
12
- return program.option("--scope <scope...>", "scopes the run to a subset of packages (by default, includes the dependencies and dependents as well)").option("--no-deps|--no-dependents", "disables running any dependents of the scoped packages").option("--include-dependencies|--dependencies", 'adds the scoped packages dependencies as the "entry points" for the target graph run').option("--to <scope...>", "runs up to a package (shorthand for --scope=<scope...> --no-dependents)").option("--since <since>", "only runs packages that have changed since the given commit, tag, or branch").option("--ignore <ignore...>", "ignores files when calculating the scope with `--since` in addition to the files specified in lage.config", []);
13
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/addFilterOptions.ts"],"sourcesContent":["import type { Command } from \"commander\";\n\nexport function addFilterOptions(program: Command) {\n return program\n .option(\"--scope <scope...>\", \"scopes the run to a subset of packages (by default, includes the dependencies and dependents as well)\")\n .option(\"--no-deps|--no-dependents\", \"disables running any dependents of the scoped packages\")\n .option(\"--include-dependencies|--dependencies\", 'adds the scoped packages dependencies as the \"entry points\" for the target graph run')\n .option(\"--to <scope...>\", \"runs up to a package (shorthand for --scope=<scope...> --no-dependents)\")\n .option(\"--since <since>\", \"only runs packages that have changed since the given commit, tag, or branch\")\n .option(\n \"--ignore <ignore...>\",\n \"ignores files when calculating the scope with `--since` in addition to the files specified in lage.config\",\n []\n );\n}\n"],"names":["addFilterOptions","program","option"],"mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,iBAAiBC,OAAgB;IAC/C,OAAOA,QACJC,MAAM,CAAC,sBAAsB,yGAC7BA,MAAM,CAAC,6BAA6B,0DACpCA,MAAM,CAAC,yCAAyC,wFAChDA,MAAM,CAAC,mBAAmB,2EAC1BA,MAAM,CAAC,mBAAmB,+EAC1BA,MAAM,CACL,wBACA,6GACA,EAAE;AAER"}
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function addLoggerOptions(program: Command): Command;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "addLoggerOptions", {
6
- enumerable: true,
7
- get: function() {
8
- return addLoggerOptions;
9
- }
10
- });
11
- const _commander = require("commander");
12
- function addLoggerOptions(program) {
13
- const isCI = process.env.CI || process.env.TF_BUILD;
14
- return program.option("--reporter <reporter...>", "reporter").option("--grouped", "groups the logs", false).addOption(new _commander.Option("--progress").conflicts([
15
- "reporter",
16
- "grouped",
17
- "verbose"
18
- ]).default(!isCI)).addOption(new _commander.Option("--log-level <level>", "log level").choices([
19
- "info",
20
- "warn",
21
- "error",
22
- "verbose",
23
- "silly"
24
- ]).conflicts("verbose")).addOption(new _commander.Option("--log-file <file>", "when used with --reporter vfl, writes verbose, ungrouped logs to the specified file")).option("--verbose", "verbose output", false);
25
- }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/commands/addLoggerOptions.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { Option } from \"commander\";\n\nexport function addLoggerOptions(program: Command) {\n const isCI = process.env.CI || process.env.TF_BUILD;\n\n return program\n .option(\"--reporter <reporter...>\", \"reporter\")\n .option(\"--grouped\", \"groups the logs\", false)\n .addOption(new Option(\"--progress\").conflicts([\"reporter\", \"grouped\", \"verbose\"]).default(!isCI))\n .addOption(new Option(\"--log-level <level>\", \"log level\").choices([\"info\", \"warn\", \"error\", \"verbose\", \"silly\"]).conflicts(\"verbose\"))\n .addOption(new Option(\"--log-file <file>\", \"when used with --reporter vfl, writes verbose, ungrouped logs to the specified file\"))\n .option(\"--verbose\", \"verbose output\", false);\n}\n"],"names":["addLoggerOptions","program","isCI","process","env","CI","TF_BUILD","option","addOption","Option","conflicts","default","choices"],"mappings":";;;;+BAGgBA;;;eAAAA;;;2BAFO;AAEhB,SAASA,iBAAiBC,OAAgB;IAC/C,MAAMC,OAAOC,QAAQC,GAAG,CAACC,EAAE,IAAIF,QAAQC,GAAG,CAACE,QAAQ;IAEnD,OAAOL,QACJM,MAAM,CAAC,4BAA4B,YACnCA,MAAM,CAAC,aAAa,mBAAmB,OACvCC,SAAS,CAAC,IAAIC,iBAAM,CAAC,cAAcC,SAAS,CAAC;QAAC;QAAY;QAAW;KAAU,EAAEC,OAAO,CAAC,CAACT,OAC1FM,SAAS,CAAC,IAAIC,iBAAM,CAAC,uBAAuB,aAAaG,OAAO,CAAC;QAAC;QAAQ;QAAQ;QAAS;QAAW;KAAQ,EAAEF,SAAS,CAAC,YAC1HF,SAAS,CAAC,IAAIC,iBAAM,CAAC,qBAAqB,wFAC1CF,MAAM,CAAC,aAAa,kBAAkB;AAC3C"}