Skip to content

Commit 3815df1

Browse files
committed
Merge packaged MIT notice
2 parents bfe49b8 + 12334a5 commit 3815df1

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

docs/release-checklist.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ MOUNT="$(hdiutil attach "$DMG" -nobrowse | awk '/\/Volumes\// {sub(/^.*\/Volumes
104104
trap 'hdiutil detach "$MOUNT" >/dev/null 2>&1 || true' EXIT
105105

106106
codesign --verify --deep --strict "$MOUNT/ReRouted.app"
107+
test -f "$MOUNT/ReRouted.app/Contents/Resources/LICENSE"
108+
test -f "$MOUNT/LICENSE.txt"
107109
xcrun stapler validate "$MOUNT/ReRouted.app"
108110
spctl --assess --type execute --verbose=4 "$MOUNT/ReRouted.app"
109111
xcrun stapler validate "$DMG"
@@ -113,6 +115,7 @@ shasum -a 256 "$DMG"
113115
UPDATE_DIR="$(mktemp -d)"
114116
ditto -x -k "$UPDATE_ZIP" "$UPDATE_DIR"
115117
codesign --verify --deep --strict "$UPDATE_DIR/ReRouted.app"
118+
test -f "$UPDATE_DIR/ReRouted.app/Contents/Resources/LICENSE"
116119
xcrun stapler validate "$UPDATE_DIR/ReRouted.app"
117120
spctl --assess --type execute --verbose=4 "$UPDATE_DIR/ReRouted.app"
118121
shasum -a 256 "$UPDATE_ZIP"

scripts/package-mac-dmg.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ async function main() {
175175
extraResource: [
176176
path.join(ROOT, "resources", "trayTemplate.png"),
177177
path.join(ROOT, "resources", "trayTemplate@2x.png"),
178+
path.join(ROOT, "LICENSE"),
178179
].filter((p) => fs.existsSync(p)),
179180
});
180181

@@ -185,6 +186,10 @@ async function main() {
185186

186187
// Ensure tray icons land in Resources (packager extraResource is fine; belt & suspenders)
187188
const resDir = path.join(appPath, "Contents", "Resources");
189+
const appLicense = path.join(resDir, "LICENSE");
190+
if (!fs.existsSync(appLicense)) {
191+
throw new Error("Packaged app is missing the MIT license notice");
192+
}
188193
for (const f of ["trayTemplate.png", "trayTemplate@2x.png"]) {
189194
const src = path.join(ROOT, "resources", f);
190195
if (fs.existsSync(src)) fs.copyFileSync(src, path.join(resDir, f));
@@ -250,6 +255,7 @@ async function main() {
250255
const stagedApp = path.join(stage, `${PRODUCT}.app`);
251256
run("ditto", [appPath, stagedApp]);
252257
run("ln", ["-s", "/Applications", path.join(stage, "Applications")]);
258+
fs.copyFileSync(path.join(ROOT, "LICENSE"), path.join(stage, "LICENSE.txt"));
253259

254260
fs.writeFileSync(
255261
path.join(stage, "Install.txt"),

tests/release-artifacts.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
const test = require("node:test");
44
const assert = require("node:assert/strict");
5+
const fs = require("node:fs");
6+
const path = require("node:path");
57

68
const { updateZipName, isRecognizedMacUpdateZip } = require("../scripts/release-artifacts");
79

@@ -16,3 +18,15 @@ test("rejects ZIP names the public update service cannot classify", () => {
1618
assert.equal(isRecognizedMacUpdateZip("ReRouted-0.3.1-mac-x64.zip"), false);
1719
assert.equal(isRecognizedMacUpdateZip("ReRouted-0.3.1-mac-arm64.dmg"), false);
1820
});
21+
22+
test("declares MIT and includes its notice in packaged release copies", () => {
23+
const root = path.resolve(__dirname, "..");
24+
const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
25+
const license = fs.readFileSync(path.join(root, "LICENSE"), "utf8");
26+
const packager = fs.readFileSync(path.join(root, "scripts", "package-mac-dmg.js"), "utf8");
27+
28+
assert.equal(pkg.license, "MIT");
29+
assert.match(license, /^MIT License\n/);
30+
assert.match(packager, /path\.join\(ROOT, "LICENSE"\)/);
31+
assert.match(packager, /path\.join\(stage, "LICENSE\.txt"\)/);
32+
});

0 commit comments

Comments
 (0)