@moku-labs/ci 1.0.0 → 1.1.1

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 (2) hide show
  1. package/dist/release.mjs +11 -9
  2. package/package.json +12 -3
package/dist/release.mjs CHANGED
@@ -2261,21 +2261,23 @@ function parseArgv(argv) {
2261
2261
  /** Exit code POSIX shells use for "command not found" — what a missing binary reports. */
2262
2262
  const COMMAND_NOT_FOUND = 127;
2263
2263
  /**
2264
- * Normalize whatever `execFile` rejected with into a {@link CommandOutput}. A non-zero exit
2265
- * carries `code` plus both streams; a missing binary carries an `ENOENT`-style string code
2266
- * and no exit status at all.
2264
+ * Normalize a failed `execFile` call into a {@link CommandOutput}. A non-zero exit carries
2265
+ * `code` and both streams; a missing binary carries an `ENOENT`-style string code, no exit
2266
+ * status and no output, so the error text stands in for stderr.
2267
2267
  *
2268
- * @param error - The rejection value from `execFile`.
2268
+ * @param error - The error `execFile` passed to its callback.
2269
+ * @param stdout - What the child wrote to stdout before it failed.
2270
+ * @param stderr - What the child wrote to stderr before it failed.
2269
2271
  * @returns The equivalent captured output.
2270
2272
  * @example
2271
- * fromExecError({ code: 1, stdout: "", stderr: "not logged in" });
2273
+ * fromExecError({ code: 1 }, "", "not logged in");
2272
2274
  */
2273
- function fromExecError(error) {
2275
+ function fromExecError(error, stdout, stderr) {
2274
2276
  const shape = error;
2275
2277
  return {
2276
2278
  code: typeof shape.code === "number" ? shape.code : COMMAND_NOT_FOUND,
2277
- stdout: shape.stdout ?? "",
2278
- stderr: shape.stderr ?? String(error)
2279
+ stdout,
2280
+ stderr: stderr === "" && stdout === "" ? String(error) : stderr
2279
2281
  };
2280
2282
  }
2281
2283
  /**
@@ -2300,7 +2302,7 @@ function createExecutor(cwd) {
2300
2302
  */
2301
2303
  const capture = (command, args, options = {}) => new Promise((resolve) => {
2302
2304
  const child = execFile(command, [...args], { cwd: options.cwd ?? cwd }, (error, stdout, stderr) => {
2303
- if (error) return resolve(fromExecError(error));
2305
+ if (error) return resolve(fromExecError(error, stdout, stderr));
2304
2306
  resolve({
2305
2307
  code: 0,
2306
2308
  stdout,
package/package.json CHANGED
@@ -1,13 +1,22 @@
1
1
  {
2
2
  "name": "@moku-labs/ci",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Central CI and release for the moku family: reusable workflows, caller examples and the moku-release CLI.",
5
5
  "type": "module",
6
- "sideEffects": ["./dist/release.mjs", "./src/index.ts"],
6
+ "sideEffects": [
7
+ "./dist/release.mjs",
8
+ "./src/index.ts"
9
+ ],
7
10
  "bin": {
8
11
  "moku-release": "./dist/release.mjs"
9
12
  },
10
- "files": ["dist", "examples", "rulesets", "LICENSE", "README.md"],
13
+ "files": [
14
+ "dist",
15
+ "examples",
16
+ "rulesets",
17
+ "LICENSE",
18
+ "README.md"
19
+ ],
11
20
  "engines": {
12
21
  "node": ">=24.0.0",
13
22
  "bun": ">=1.3.14"