@rightkit/git 0.2.12 → 0.2.14
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/render.test.mjs +2 -3
- package/sync.mjs +20 -0
- package/sync.test.mjs +38 -0
- package/templates/profiles/rust-hybrid/release-candidate.yml +0 -2
package/package.json
CHANGED
package/render.test.mjs
CHANGED
|
@@ -69,7 +69,7 @@ test("rust-hybrid release candidate renders product scripts, artifact handoff, a
|
|
|
69
69
|
);
|
|
70
70
|
assert.match(content, /pnpm run ci:candidate/);
|
|
71
71
|
assert.match(content, /pnpm run ci:candidate-check/);
|
|
72
|
-
assert.
|
|
72
|
+
assert.doesNotMatch(content, /bash \.\/scripts\/gate\.sh/);
|
|
73
73
|
assert.match(content, /RIGHT_GIT_ARTIFACT_ROOT/);
|
|
74
74
|
assert.match(content, /os: "macos-latest"/);
|
|
75
75
|
assert.match(content, /platform: "windows"/);
|
|
@@ -165,8 +165,7 @@ test("rust-hybrid multi-architecture candidates bind every native target to exac
|
|
|
165
165
|
assert.match(content, new RegExp(`targetTriple: ${JSON.stringify(triple).replace(/[.*+?^${}()|[\\]\\]/g, "\\$&")}`));
|
|
166
166
|
}
|
|
167
167
|
assert.match(content, /targets: \$\{\{ matrix\.targetTriple \}\}/);
|
|
168
|
-
assert.
|
|
169
|
-
assert.ok(content.indexOf("bash ./scripts/gate.sh") < content.indexOf("Build unsigned release candidate"));
|
|
168
|
+
assert.doesNotMatch(content, /bash \.\/scripts\/gate\.sh/);
|
|
170
169
|
assert.match(content, /windows-sign:[\s\S]*matrix:[\s\S]*windows-11-arm/);
|
|
171
170
|
assert.match(content, /macos-sign:[\s\S]*matrix:[\s\S]*macos-15-intel/);
|
|
172
171
|
assert.match(content, /name: widgets-unsigned-\$\{\{ matrix\.platform \}\}-\$\{\{ matrix\.architecture \}\}-22\.23\.2/);
|
package/sync.mjs
CHANGED
|
@@ -12,6 +12,22 @@ import { renderTemplate, MANAGED_MARKER } from "./render.mjs";
|
|
|
12
12
|
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)));
|
|
13
13
|
const TEMPLATES_DIR = path.join(packageRoot, "templates");
|
|
14
14
|
const WORKFLOWS_SUBDIR = path.join(".github", "workflows");
|
|
15
|
+
const PUBLISHED_NPM_VERSION = /^\d+\.\d+\.\d+$/;
|
|
16
|
+
|
|
17
|
+
function releaseChainDependencyError(repoPath, manifest) {
|
|
18
|
+
if (!manifest.candidate?.releaseChain) return null;
|
|
19
|
+
let pkg;
|
|
20
|
+
try {
|
|
21
|
+
pkg = JSON.parse(fs.readFileSync(path.join(repoPath, "package.json"), "utf8"));
|
|
22
|
+
} catch {
|
|
23
|
+
return "release-candidate releaseChain requires a readable package.json with direct devDependency @rightkit/release";
|
|
24
|
+
}
|
|
25
|
+
const version = pkg.devDependencies?.["@rightkit/release"];
|
|
26
|
+
if (typeof version !== "string" || !PUBLISHED_NPM_VERSION.test(version)) {
|
|
27
|
+
return "release-candidate releaseChain requires direct devDependency @rightkit/release pinned to a published npm version";
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
15
31
|
|
|
16
32
|
/** Render every lane declared in the manifest. Returns { lane, filename, content }[]. */
|
|
17
33
|
export function renderLanes(manifest, repoPath) {
|
|
@@ -82,6 +98,10 @@ export async function planSync(repoPath, deps = {}, manifestOverride = null) {
|
|
|
82
98
|
if (!loaded.ok) {
|
|
83
99
|
return { ok: false, stage: "manifest", errors: loaded.errors, changes: [] };
|
|
84
100
|
}
|
|
101
|
+
const dependencyError = releaseChainDependencyError(repoPath, loaded.manifest);
|
|
102
|
+
if (dependencyError) {
|
|
103
|
+
return { ok: false, stage: "dependency", errors: [dependencyError], changes: [] };
|
|
104
|
+
}
|
|
85
105
|
|
|
86
106
|
const rendered = renderLanes(loaded.manifest, repoPath);
|
|
87
107
|
const wantedFilenames = new Set(rendered.map((r) => r.filename));
|
package/sync.test.mjs
CHANGED
|
@@ -54,6 +54,44 @@ test("sync reports manifest errors instead of writing files", async () => {
|
|
|
54
54
|
assert.equal(result.stage, "manifest");
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
test("sync rejects a Membrane-like release chain without root @rightkit/release", async () => {
|
|
58
|
+
const manifest = {
|
|
59
|
+
schemaVersion: 1,
|
|
60
|
+
lanes: ["ci", "release-candidate"],
|
|
61
|
+
matrix: { os: ["windows-2025", "macos-15"], node: ["22.23.2"] },
|
|
62
|
+
packageManager: "pnpm@11.24.0",
|
|
63
|
+
templateVersion: "1.5.0",
|
|
64
|
+
profile: "rust-hybrid",
|
|
65
|
+
gate: { path: "scripts/ci/run-ci.sh" },
|
|
66
|
+
candidate: {
|
|
67
|
+
buildScript: "release:candidate:build",
|
|
68
|
+
checkScript: "release:candidate:check",
|
|
69
|
+
artifactRoot: "membrane-release-candidate",
|
|
70
|
+
os: ["windows-2025", "macos-15"],
|
|
71
|
+
signWindows: true,
|
|
72
|
+
signMacos: true,
|
|
73
|
+
releaseChain: {
|
|
74
|
+
windowsFinalizeScript: "release:finalize:windows",
|
|
75
|
+
macosFinalizeScript: "release:finalize:macos",
|
|
76
|
+
installedQualificationScript: "release:qualify:installed",
|
|
77
|
+
publishScript: "release:publish:qualified",
|
|
78
|
+
qualificationRunnerVariable: "MEMBRANE_QUALIFICATION_RUNNER_LABEL",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
const dir = makeTempRepo(manifest, { packageJson: { name: "membrane", devDependencies: { "@rightkit/git": "0.2.13" } } });
|
|
83
|
+
const missing = await syncCommand(dir, { deps: PUBLIC_DEPS });
|
|
84
|
+
assert.equal(missing.ok, false);
|
|
85
|
+
assert.equal(missing.stage, "dependency");
|
|
86
|
+
assert.match(missing.errors[0], /direct devDependency @rightkit\/release/);
|
|
87
|
+
assert.equal(fs.existsSync(path.join(dir, ".github", "workflows")), false);
|
|
88
|
+
|
|
89
|
+
fs.writeFileSync(path.join(dir, "package.json"), JSON.stringify({ name: "membrane", devDependencies: { "@rightkit/git": "0.2.13", "@rightkit/release": "0.2.84" } }), "utf8");
|
|
90
|
+
const present = await syncCommand(dir, { deps: PUBLIC_DEPS });
|
|
91
|
+
assert.equal(present.ok, true);
|
|
92
|
+
assert.ok(fs.existsSync(path.join(dir, ".github", "workflows", "release-candidate.yml")));
|
|
93
|
+
});
|
|
94
|
+
|
|
57
95
|
test("sync refuses an unmanaged same-name workflow", async () => {
|
|
58
96
|
const dir = makeTempRepo(SAMPLE_MANIFEST);
|
|
59
97
|
const target = path.join(dir, ".github", "workflows", "ci.yml");
|
|
@@ -38,8 +38,6 @@ ${PACKAGE_MANAGER_SETUP}
|
|
|
38
38
|
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
39
39
|
with:
|
|
40
40
|
workspaces: engine
|
|
41
|
-
- name: Run full CI validation
|
|
42
|
-
run: bash ./${GATE_PATH}
|
|
43
41
|
- run: ${INSTALL_COMMAND}
|
|
44
42
|
- name: Build unsigned release candidate
|
|
45
43
|
run: ${PM_RUN} ${CANDIDATE_BUILD_SCRIPT}
|