@rightkit/release 0.2.33 → 0.2.34
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/build-release.mjs +6 -4
- package/package.json +1 -1
- package/release-state.mjs +21 -0
- package/release-state.test.mjs +5 -0
- package/right-suite-contract.test.mjs +1 -1
- package/rightkit-versions.json +1 -1
package/build-release.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import path from "node:path";
|
|
21
21
|
import { spawn, spawnSync } from "node:child_process";
|
|
22
22
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
23
|
-
import { cacheFingerprint, releaseEnvironment, resolveReleaseLayout, runBuildStateMachine } from "./release-state.mjs";
|
|
23
|
+
import { cacheFingerprint, commandOutputPortable, releaseEnvironment, resolveReleaseLayout, runBuildStateMachine } from "./release-state.mjs";
|
|
24
24
|
|
|
25
25
|
const TOOL_ROOT = path.dirname(fileURLToPath(import.meta.url));
|
|
26
26
|
const WORKER = path.join(TOOL_ROOT, "release.mjs");
|
|
@@ -342,9 +342,11 @@ function commandExists(name) {
|
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
function commandOutput(cmd, runArgs) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
345
|
+
try {
|
|
346
|
+
return commandOutputPortable(cmd, runArgs);
|
|
347
|
+
} catch (error) {
|
|
348
|
+
fail(`required command failed: ${error.message}`);
|
|
349
|
+
}
|
|
348
350
|
}
|
|
349
351
|
|
|
350
352
|
function git(cwd, runArgs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rightkit/release",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"description": "Portable Right Suite release CLI/SDK: signed installers, updater artifacts, patch/update routing, hardening, R2 publish, and RightApps registration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/release-state.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
2
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
|
|
@@ -23,6 +24,26 @@ export function resolveReleaseLayout({ repoRoot, configPath }) {
|
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
export function commandOutputPortable(cmd, args, { cwd, env = process.env } = {}) {
|
|
28
|
+
const windows = process.platform === "win32";
|
|
29
|
+
if (windows && ![cmd, ...args].every((value) => /^[A-Za-z0-9._:/@+=-]+$/.test(value))) {
|
|
30
|
+
throw new Error("unsafe Windows command token");
|
|
31
|
+
}
|
|
32
|
+
const executable = windows ? (env.ComSpec || env.COMSPEC || "cmd.exe") : cmd;
|
|
33
|
+
const executableArgs = windows ? ["/d", "/s", "/c", [cmd, ...args].join(" ")] : args;
|
|
34
|
+
const result = spawnSync(executable, executableArgs, {
|
|
35
|
+
cwd,
|
|
36
|
+
env,
|
|
37
|
+
encoding: "utf8",
|
|
38
|
+
windowsHide: true,
|
|
39
|
+
});
|
|
40
|
+
if (result.status !== 0) {
|
|
41
|
+
const detail = result.error?.message || result.stderr?.trim() || `exit ${result.status}`;
|
|
42
|
+
throw new Error(`${cmd} ${args.join(" ")} failed: ${detail}`);
|
|
43
|
+
}
|
|
44
|
+
return result.stdout.trim();
|
|
45
|
+
}
|
|
46
|
+
|
|
26
47
|
export function releaseEnvironment({ root, platform, cacheKey, kind = "release" }) {
|
|
27
48
|
if (kind !== "release" && kind !== "test") throw new Error(`invalid target kind: ${kind}`);
|
|
28
49
|
const targetKind = kind === "release" ? "cargo-target" : "test-target";
|
package/release-state.test.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import test from "node:test";
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
cacheFingerprint,
|
|
10
|
+
commandOutputPortable,
|
|
10
11
|
resolveReleaseLayout,
|
|
11
12
|
releaseEnvironment,
|
|
12
13
|
runBuildStateMachine,
|
|
@@ -14,6 +15,10 @@ import {
|
|
|
14
15
|
verifySealedRelease,
|
|
15
16
|
} from "./release-state.mjs";
|
|
16
17
|
|
|
18
|
+
test("portable command capture resolves Windows command shims", { skip: process.platform !== "win32" }, () => {
|
|
19
|
+
assert.match(commandOutputPortable("pnpm", ["--version"]), /^11\.12\.0$/);
|
|
20
|
+
});
|
|
21
|
+
|
|
17
22
|
test("nested app configs keep the vault at repo root and build from the app root", () => {
|
|
18
23
|
const layout = resolveReleaseLayout({
|
|
19
24
|
repoRoot: "D:/suite/heardright",
|
|
@@ -317,7 +317,7 @@ test("Cargo version contract rejects staged versions that mismatch canonical man
|
|
|
317
317
|
test("RightKit exposes one current version manifest", () => {
|
|
318
318
|
assert.equal(existsSync(versionsPath), true, "rightkit-versions.json must be the single current-version source");
|
|
319
319
|
assert.match(versions.packageManager, /^pnpm@\d+\.\d+\.\d+$/);
|
|
320
|
-
assert.equal(versions.npm["@rightkit/release"], "0.2.
|
|
320
|
+
assert.equal(versions.npm["@rightkit/release"], "0.2.34");
|
|
321
321
|
assert.equal(versions.npm["@rightkit/legal"], "0.2.0");
|
|
322
322
|
assert.equal(versions.npm["@rightkit/license"], "0.1.5");
|
|
323
323
|
assert.equal(versions.npm["@rightkit/logs"], "0.1.3");
|
package/rightkit-versions.json
CHANGED