@rightkit/release 0.2.24 → 0.2.25
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/package.json +1 -1
- package/right-suite-contract.test.mjs +1 -1
- package/rightkit-versions.json +1 -1
- package/upload-large.mjs +38 -1
- package/upload-large.test.mjs +41 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rightkit/release",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
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": {
|
|
@@ -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.25");
|
|
321
321
|
assert.equal(versions.npm["@rightkit/legal"], "0.1.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
package/upload-large.mjs
CHANGED
|
@@ -8,6 +8,12 @@ const BUCKETS = new Map([
|
|
|
8
8
|
["public", "rightapps-downloads"],
|
|
9
9
|
["private", "rightapps-updates"],
|
|
10
10
|
]);
|
|
11
|
+
// Wrangler always runs remotely through a package runner; which one exists is machine-specific
|
|
12
|
+
// (a node install without npm/npx is normal when pnpm is the pinned package manager).
|
|
13
|
+
const RUNNERS = [
|
|
14
|
+
{ cmd: "npx", prefix: [] },
|
|
15
|
+
{ cmd: "pnpm", prefix: ["dlx"] },
|
|
16
|
+
];
|
|
11
17
|
|
|
12
18
|
const [, , localFile, r2Key, bucketAlias = "public"] = process.argv;
|
|
13
19
|
if (!localFile || !r2Key) {
|
|
@@ -36,11 +42,24 @@ const env = cleanCloudflareEnv(process.env);
|
|
|
36
42
|
console.log(`Uploading ${path.basename(localFile)} (${(fileSize / 1024 / 1024).toFixed(1)} MB) -> ${object}`);
|
|
37
43
|
console.log(`wrangler r2 object put ${object} --file ${path.resolve(localFile)} --remote`);
|
|
38
44
|
|
|
45
|
+
// Resolve the package runner before the dry-run exit: a release box without one cannot upload,
|
|
46
|
+
// and that must fail here rather than after a signed build has already been produced.
|
|
47
|
+
const runner = resolveRunner(env);
|
|
48
|
+
if (!runner) {
|
|
49
|
+
console.error(
|
|
50
|
+
"upload-large: no package runner found. Tried: " +
|
|
51
|
+
`${RUNNERS.map((entry) => [entry.cmd, ...entry.prefix].join(" ")).join(", ")}. ` +
|
|
52
|
+
"Install one, or set RIGHT_RELEASE_WRANGLER_RUNNER (e.g. \"pnpm dlx\").",
|
|
53
|
+
);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
console.log(`runner: ${[runner.cmd, ...runner.prefix].join(" ")}`);
|
|
57
|
+
|
|
39
58
|
if (process.env.RIGHT_RELEASE_UPLOAD_DRY_RUN === "1") {
|
|
40
59
|
process.exit(0);
|
|
41
60
|
}
|
|
42
61
|
|
|
43
|
-
const result = spawnSync(
|
|
62
|
+
const result = spawnSync(runner.cmd, [...runner.prefix, ...wranglerArgs], {
|
|
44
63
|
env,
|
|
45
64
|
stdio: "inherit",
|
|
46
65
|
shell: process.platform === "win32",
|
|
@@ -53,6 +72,24 @@ if (result.error) {
|
|
|
53
72
|
}
|
|
54
73
|
process.exit(result.status ?? 1);
|
|
55
74
|
|
|
75
|
+
function resolveRunner(env) {
|
|
76
|
+
const override = process.env.RIGHT_RELEASE_WRANGLER_RUNNER?.trim();
|
|
77
|
+
if (override) {
|
|
78
|
+
const [cmd, ...prefix] = override.split(/\s+/);
|
|
79
|
+
return { cmd, prefix };
|
|
80
|
+
}
|
|
81
|
+
for (const candidate of RUNNERS) {
|
|
82
|
+
const probe = spawnSync(candidate.cmd, ["--version"], {
|
|
83
|
+
env,
|
|
84
|
+
stdio: "ignore",
|
|
85
|
+
shell: process.platform === "win32",
|
|
86
|
+
windowsHide: true,
|
|
87
|
+
});
|
|
88
|
+
if (!probe.error && probe.status === 0) return candidate;
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
56
93
|
function cleanCloudflareEnv(source) {
|
|
57
94
|
const env = { ...source, CLOUDFLARE_ACCOUNT_ID: source.CLOUDFLARE_ACCOUNT_ID || ACCOUNT_ID };
|
|
58
95
|
delete env.CLOUDFLARE_API_KEY;
|
package/upload-large.test.mjs
CHANGED
|
@@ -42,3 +42,44 @@ test("refuses unknown bucket aliases", () => {
|
|
|
42
42
|
assert.notEqual(result.status, 0);
|
|
43
43
|
assert.match(result.stderr, /expected public\|private/);
|
|
44
44
|
});
|
|
45
|
+
|
|
46
|
+
test("resolves a real package runner for wrangler on this machine", () => {
|
|
47
|
+
const result = run("public");
|
|
48
|
+
assert.equal(result.status, 0, result.stderr);
|
|
49
|
+
// A node install carrying neither npm nor npx is normal where pnpm is the pinned package
|
|
50
|
+
// manager; the uploader must find a runner that actually exists rather than assume npx.
|
|
51
|
+
assert.match(result.stdout, /^runner: (npx|pnpm dlx)$/m);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("fails loudly when no package runner exists instead of skipping the upload", () => {
|
|
55
|
+
const result = spawnSync(
|
|
56
|
+
process.execPath,
|
|
57
|
+
[uploader, fixtureFile(), "fixture/installers/windows/current/Artifact.exe", "public"],
|
|
58
|
+
{
|
|
59
|
+
encoding: "utf8",
|
|
60
|
+
env: {
|
|
61
|
+
...process.env,
|
|
62
|
+
RIGHT_RELEASE_UPLOAD_DRY_RUN: "1",
|
|
63
|
+
RIGHT_RELEASE_WRANGLER_RUNNER: "",
|
|
64
|
+
PATH: path.join(os.tmpdir(), "right-upload-empty-path"),
|
|
65
|
+
Path: path.join(os.tmpdir(), "right-upload-empty-path"),
|
|
66
|
+
PATHEXT: process.env.PATHEXT ?? "",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
assert.notEqual(result.status, 0, "a box with no runner must not report a successful upload");
|
|
71
|
+
assert.match(result.stderr, /no package runner found/);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("honours an explicit runner override", () => {
|
|
75
|
+
const result = spawnSync(
|
|
76
|
+
process.execPath,
|
|
77
|
+
[uploader, fixtureFile(), "fixture/installers/windows/current/Artifact.exe", "public"],
|
|
78
|
+
{
|
|
79
|
+
encoding: "utf8",
|
|
80
|
+
env: { ...process.env, RIGHT_RELEASE_UPLOAD_DRY_RUN: "1", RIGHT_RELEASE_WRANGLER_RUNNER: "pnpm dlx" },
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
assert.equal(result.status, 0, result.stderr);
|
|
84
|
+
assert.match(result.stdout, /^runner: pnpm dlx$/m);
|
|
85
|
+
});
|