Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@hyperframes/cli",
"version": "0.7.56",
"description": "HyperFrames CLI — create, preview, and render HTML video compositions",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/heygen-com/hyperframes",
Expand Down
17 changes: 15 additions & 2 deletions scripts/verify-packed-manifests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ function readPackedPackage(filename) {
return JSON.parse(packedPackageJson);
}

export function verifyCliLicense(workspace, sourcePackage, packedPackage) {
if (workspace !== "packages/cli") return;

const expectedLicense = "Apache-2.0";
if (sourcePackage.license !== expectedLicense) {
throw new Error(`${workspace} must declare license ${expectedLicense}`);
}
if (packedPackage.license !== sourcePackage.license) {
throw new Error(`${workspace} packed manifest must preserve license ${expectedLicense}`);
}
}

function assertNoWorkspaceRefs(workspace, packedPackage) {
const packedRefs = listWorkspaceRefs(packedPackage);
if (packedRefs.length === 0) return;
Expand All @@ -271,10 +283,11 @@ function assertNoWorkspaceRefs(workspace, packedPackage) {
);
}

function verifyPackedWorkspace(workspace, filename) {
function verifyPackedWorkspace(workspace, sourcePackage, filename) {
const packedPackage = readPackedPackage(filename);
const packedFiles = listPackedFiles(filename);

verifyCliLicense(workspace, sourcePackage, packedPackage);
assertNoWorkspaceRefs(workspace, packedPackage);
verifyPackedEntrypoints(workspace, packedPackage, packedFiles);
verifyPackedJavaScriptImports(workspace, filename, packedFiles);
Expand Down Expand Up @@ -395,7 +408,7 @@ function packAndVerifyWorkspace(workspace, packDir) {

assertPublishedExportsMatchSource(workspace, sourcePackageJson);
const filename = packWorkspace(workspace, packDir);
verifyPackedWorkspace(workspace, filename);
verifyPackedWorkspace(workspace, sourcePackageJson, filename);
const packedPackage = readPackedPackage(filename);
console.log(`Verified ${workspace}: packed manifest is publish-safe.`);
return { workspace, filename, packedPackage };
Expand Down
15 changes: 15 additions & 0 deletions scripts/verify-packed-manifests.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@ import {
listPackedExportContracts,
listPackedJavaScriptImportIssues,
packageExportSpecifier,
verifyCliLicense,
} from "./verify-packed-manifests.mjs";

describe("packed manifest verifier", () => {
it("requires the CLI package and tarball to declare Apache-2.0", () => {
assert.throws(
() => verifyCliLicense("packages/cli", {}, {}),
/packages\/cli must declare license Apache-2\.0/,
);
assert.throws(
() => verifyCliLicense("packages/cli", { license: "Apache-2.0" }, { license: "UNLICENSED" }),
/packages\/cli packed manifest must preserve license Apache-2\.0/,
);
assert.doesNotThrow(() =>
verifyCliLicense("packages/cli", { license: "Apache-2.0" }, { license: "Apache-2.0" }),
);
});

it("derives consumer specifiers from the packed export map", () => {
assert.equal(packageExportSpecifier("@hyperframes/sdk", "."), "@hyperframes/sdk");
assert.equal(
Expand Down
Loading