@lage-run/cli 0.23.1 → 0.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,37 @@
2
2
  "name": "@lage-run/cli",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 04 Oct 2024 23:41:31 GMT",
5
+ "date": "Tue, 08 Oct 2024 20:03:26 GMT",
6
+ "version": "0.23.3",
7
+ "tag": "@lage-run/cli_v0.23.3",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/cli",
13
+ "commit": "e0b1d9352f881fd802d982231471152127c65d39",
14
+ "comment": "uses the shell scripts to have a different executable name"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Mon, 07 Oct 2024 19:33:13 GMT",
21
+ "version": "0.23.2",
22
+ "tag": "@lage-run/cli_v0.23.2",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "kchau@microsoft.com",
27
+ "package": "@lage-run/cli",
28
+ "commit": "43e4f422ae3436c5dedaa961469420ee683098b1",
29
+ "comment": "Fixing the action command generation to handle the case of launching as server without --server"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Fri, 04 Oct 2024 23:41:44 GMT",
6
36
  "version": "0.23.1",
7
37
  "tag": "@lage-run/cli_v0.23.1",
8
38
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,28 @@
1
1
  # Change Log - @lage-run/cli
2
2
 
3
- <!-- This log was last generated on Fri, 04 Oct 2024 23:41:31 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Tue, 08 Oct 2024 20:03:26 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.23.3
8
+
9
+ Tue, 08 Oct 2024 20:03:26 GMT
10
+
11
+ ### Patches
12
+
13
+ - uses the shell scripts to have a different executable name (kchau@microsoft.com)
14
+
15
+ ## 0.23.2
16
+
17
+ Mon, 07 Oct 2024 19:33:13 GMT
18
+
19
+ ### Patches
20
+
21
+ - Fixing the action command generation to handle the case of launching as server without --server (kchau@microsoft.com)
22
+
7
23
  ## 0.23.1
8
24
 
9
- Fri, 04 Oct 2024 23:41:31 GMT
25
+ Fri, 04 Oct 2024 23:41:44 GMT
10
26
 
11
27
  ### Patches
12
28
 
@@ -15,6 +15,7 @@ const _filterArgsForTasks = require("../run/filterArgsForTasks.js");
15
15
  const _simulateFileAccess = require("./simulateFileAccess.js");
16
16
  const _execa = /*#__PURE__*/ _interop_require_default(require("execa"));
17
17
  const _getBinPaths = require("../../getBinPaths.js");
18
+ const _parseServerOption = require("../parseServerOption.js");
18
19
  function _interop_require_default(obj) {
19
20
  return obj && obj.__esModule ? obj : {
20
21
  default: obj
@@ -74,12 +75,9 @@ async function executeOnServer(args, client, logger) {
74
75
  async function executeRemotely(options, command) {
75
76
  // launch a 'lage-server.js' process, detached if it is not already running
76
77
  // send the command to the server process
77
- const { server ="localhost:5332" } = options;
78
+ const { server } = options;
78
79
  const timeout = options.timeout ?? 120;
79
- const serverString = typeof options.server === "boolean" && options.server ? "localhost:5332" : !server ? "localhost:5332" : server;
80
- const parts = serverString.split(":");
81
- const host = parts[0];
82
- const port = parseInt(parts[1] ?? "5332");
80
+ const { host , port } = (0, _parseServerOption.parseServerOption)(server);
83
81
  const logger = (0, _logger.default)();
84
82
  options.logLevel = options.logLevel ?? "info";
85
83
  options.reporter = options.reporter ?? "json";
@@ -91,7 +89,6 @@ async function executeRemotely(options, command) {
91
89
  const binPaths = (0, _getBinPaths.getBinPaths)();
92
90
  const lageServerBinPath = binPaths["lage-server"];
93
91
  const lageServerArgs = [
94
- lageServerBinPath,
95
92
  "--host",
96
93
  host,
97
94
  "--port",
@@ -100,8 +97,8 @@ async function executeRemotely(options, command) {
100
97
  timeout,
101
98
  ...args
102
99
  ];
103
- logger.info(`Launching lage-server with these parameters: "${process.execPath}" ${lageServerArgs.join(" ")}`);
104
- const child = (0, _execa.default)(process.execPath, lageServerArgs, {
100
+ logger.info(`Launching lage-server with these parameters: ${lageServerArgs.join(" ")}`);
101
+ const child = (0, _execa.default)(lageServerBinPath, lageServerArgs, {
105
102
  detached: true,
106
103
  stdio: "ignore"
107
104
  });
@@ -20,6 +20,7 @@ const _initializeReporters = require("../initializeReporters.js");
20
20
  const _runners = require("@lage-run/runners");
21
21
  const _getBinPaths = require("../../getBinPaths.js");
22
22
  const _runnerPickerOptions = require("../../runnerPickerOptions.js");
23
+ const _parseServerOption = require("../parseServerOption.js");
23
24
  function _interop_require_default(obj) {
24
25
  return obj && obj.__esModule ? obj : {
25
26
  default: obj
@@ -110,12 +111,12 @@ function generateCommand(target, taskArgs, config, options, binPaths) {
110
111
  ];
111
112
  return command;
112
113
  } else if (target.type === "worker" && shouldRunWorkersAsService) {
114
+ const { host , port } = (0, _parseServerOption.parseServerOption)(options.server);
113
115
  const command = [
114
- process.execPath,
115
116
  binPaths["lage"],
116
117
  "exec",
117
118
  "--server",
118
- options.server
119
+ `${host}:${port}`
119
120
  ];
120
121
  if (options.concurrency) {
121
122
  command.push("--concurrency", options.concurrency.toString());
@@ -130,7 +131,6 @@ function generateCommand(target, taskArgs, config, options, binPaths) {
130
131
  return command;
131
132
  } else if (target.type === "worker") {
132
133
  const command = [
133
- process.execPath,
134
134
  binPaths.lage,
135
135
  "exec"
136
136
  ];
@@ -0,0 +1,4 @@
1
+ export declare function parseServerOption(server: boolean | string | undefined): {
2
+ host: string;
3
+ port: number;
4
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "parseServerOption", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return parseServerOption;
9
+ }
10
+ });
11
+ function parseServerOption(server) {
12
+ const isBooleanAndTrue = typeof server === "boolean" && server;
13
+ const isEmptyServer = typeof server === "undefined" || server === false;
14
+ const serverString = isBooleanAndTrue ? "localhost:5332" : isEmptyServer ? "localhost:5332" : server;
15
+ if (serverString.includes(":")) {
16
+ const parts = serverString.split(":");
17
+ const host = parts[0];
18
+ const port = parseInt(parts[1] ?? "5332");
19
+ return {
20
+ host,
21
+ port
22
+ };
23
+ } else if (serverString.length === 0) {
24
+ return {
25
+ host: "localhost",
26
+ port: 5332
27
+ };
28
+ } else {
29
+ return {
30
+ host: serverString,
31
+ port: 5332
32
+ };
33
+ }
34
+ }
@@ -10,24 +10,37 @@ Object.defineProperty(exports, "getBinPaths", {
10
10
  });
11
11
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
12
12
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
13
+ const _os = /*#__PURE__*/ _interop_require_default(require("os"));
13
14
  function _interop_require_default(obj) {
14
15
  return obj && obj.__esModule ? obj : {
15
16
  default: obj
16
17
  };
17
18
  }
18
- function getBinPaths() {
19
- let dir = __dirname;
20
- let packageJsonPath = "";
21
- while(dir !== "/"){
22
- packageJsonPath = _path.default.join(dir, "package.json");
23
- if (_fs.default.existsSync(packageJsonPath)) {
24
- break;
19
+ function findUp(name, dir) {
20
+ let currentDir = dir;
21
+ while(currentDir !== "/"){
22
+ const fullPath = _path.default.join(currentDir, name);
23
+ if (_fs.default.existsSync(fullPath)) {
24
+ return fullPath;
25
25
  }
26
- dir = _path.default.dirname(dir);
26
+ currentDir = _path.default.dirname(currentDir);
27
+ }
28
+ return undefined;
29
+ }
30
+ function getBinPaths() {
31
+ const bins = _os.default.platform() === "win32" ? [
32
+ "lage.cmd",
33
+ "lage-server.cmd"
34
+ ] : [
35
+ "lage",
36
+ "lage-server"
37
+ ];
38
+ const binPaths = bins.map((bin)=>findUp("node_modules/.bin/" + bin, __dirname));
39
+ if (binPaths.some((binPath)=>binPath === undefined)) {
40
+ throw new Error("Could not find bin paths for lage or lage-server");
27
41
  }
28
- const packageJson = JSON.parse(_fs.default.readFileSync(_path.default.join(dir, "package.json"), "utf8"));
29
42
  return {
30
- lage: _path.default.join(dir, packageJson.bin.lage),
31
- "lage-server": _path.default.join(dir, packageJson.bin["lage-server"])
43
+ lage: binPaths[0],
44
+ "lage-server": binPaths[1]
32
45
  };
33
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/cli",
3
- "version": "0.23.1",
3
+ "version": "0.23.3",
4
4
  "description": "Command Line Interface for Lage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "scripts": {
18
18
  "build": "tsc",
19
19
  "start": "tsc -w --preserveWatchOutput",
20
- "test": "jest",
20
+ "test": "monorepo-scripts jest",
21
21
  "lint": "monorepo-scripts lint"
22
22
  },
23
23
  "dependencies": {