Skip to content

Commit 07b259f

Browse files
authored
Give @native-sdk/core the provenance repository metadata npm requires (#121)
- npm publish --provenance rejected @native-sdk/core@0.5.0: the manifest carried no repository.url to validate against the workflow's repository. Add the repository (with the monorepo directory) and homepage, matching the CLI package. - check-version-sync now pins packages/core repository.url and homepage to the main package, exactly as it already did for the eight platform packages, and the package-manifest suite pins the fields as publish contract.
1 parent e2627ee commit 07b259f

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

packages/core/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
"name": "@native-sdk/core",
33
"version": "0.5.0",
44
"description": "The TypeScript authoring tier: the app-core subset, its dev-time transpiler to arena-backed Zig, and the SDK module cores import",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/vercel-labs/native.git",
8+
"directory": "packages/core"
9+
},
10+
"homepage": "https://native-sdk.dev",
511
"type": "module",
612
"types": "./sdk/core.ts",
713
"files": [

packages/core/test/package_manifest.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ test("the manifest names the published package and a real version", () => {
2929
assert.equal(manifest.type, "module");
3030
});
3131

32+
test("provenance metadata names the real repository", () => {
33+
// npm publish --provenance validates repository.url against the
34+
// publishing workflow's repository and rejects the tarball on any
35+
// mismatch — a publish-blocking field, not decoration.
36+
assert.equal(manifest.repository?.type, "git");
37+
assert.equal(manifest.repository?.url, "git+https://github.com/vercel-labs/native.git");
38+
assert.equal(manifest.repository?.directory, "packages/core");
39+
assert.equal(manifest.homepage, "https://native-sdk.dev");
40+
});
41+
3242
test("the artifact is exactly package.json + sdk/", () => {
3343
assert.deepEqual(manifest.files, ["sdk"]);
3444
// A bin entry would drag its target file into the tarball behind the

packages/native-sdk/scripts/check-version-sync.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,17 @@ if (coreJson.version !== expectedVersion) {
8282
console.error(`Version mismatch: packages/core/package.json=${coreJson.version}, expected ${expectedVersion}`);
8383
errors++;
8484
}
85+
// npm validates repository.url against publish provenance for
86+
// @native-sdk/core exactly as it does for the platform packages — a
87+
// missing or renamed URL fails the publish, so pin it to the main package.
88+
if (coreJson.repository?.url !== packageJson.repository?.url) {
89+
console.error(`Repository mismatch: packages/core/package.json repository.url is ${coreJson.repository?.url}, expected ${packageJson.repository?.url} from package.json`);
90+
errors++;
91+
}
92+
if (coreJson.homepage !== packageJson.homepage) {
93+
console.error(`Homepage mismatch: packages/core/package.json homepage is ${coreJson.homepage}, expected ${packageJson.homepage} from package.json`);
94+
errors++;
95+
}
8596
const coreLock = JSON.parse(readFileSync(join(repoRoot, 'packages', 'core', 'package-lock.json'), 'utf-8'));
8697
if (coreLock.version !== expectedVersion || coreLock.packages?.['']?.version !== expectedVersion) {
8798
console.error(`Version mismatch: packages/core/package-lock.json=${coreLock.version}/${coreLock.packages?.['']?.version}, expected ${expectedVersion}`);

0 commit comments

Comments
 (0)