Skip to content

Commit 06abe11

Browse files
authored
feat: add xport lock-step manifest (#625)
Adds the xport tooling shared across the Socket fleet for declaring cross-repo lockstep dependencies (gitlinks, package versions). Files: scripts/xport.mts — runner scripts/xport-schema.mts — TypeBox source of truth scripts/xport-emit-schema.mts — generates xport.schema.json xport.schema.json — machine-generated, used by validators package.json — adds @sinclair/typebox 0.34.49 devDep pnpm-lock.yaml — refreshed for typebox Self-landable; no consumer of xport in this repo yet, but the schema emit + manifest validation can run in pnpm check once wired.
1 parent c3beacc commit 06abe11

6 files changed

Lines changed: 1839 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
},
6767
"devDependencies": {
6868
"@anthropic-ai/claude-code": "2.1.92",
69+
"@sinclair/typebox": "0.34.49",
6970
"@babel/generator": "7.28.5",
7071
"@babel/parser": "7.26.3",
7172
"@babel/traverse": "7.26.4",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/xport-emit-schema.mts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* @fileoverview Emit `xport.schema.json` from the TypeBox schema.
3+
*
4+
* The TypeBox schema in `scripts/xport-schema.mts` is the source of truth.
5+
* TypeBox schemas are JSON Schema natively — no conversion library needed,
6+
* just serialize the schema object and add the draft-2020-12 meta headers.
7+
*
8+
* Run via `pnpm run xport:emit-schema` when the schema changes.
9+
*/
10+
11+
import { writeFileSync } from 'node:fs'
12+
import path from 'node:path'
13+
import { fileURLToPath } from 'node:url'
14+
15+
import { getDefaultLogger } from '@socketsecurity/lib/logger'
16+
17+
import { XportManifestSchema } from './xport-schema.mts'
18+
19+
const logger = getDefaultLogger()
20+
21+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
22+
const rootDir = path.resolve(__dirname, '..')
23+
const outPath = path.join(rootDir, 'xport.schema.json')
24+
25+
// TypeBox schemas carry JSON Schema shape directly, plus a Symbol-keyed
26+
// [Kind] marker that JSON.stringify drops. Spreading the schema first
27+
// then layering the canonical $schema / $id / title on top gives a clean
28+
// draft-2020-12 document with the Socket-specific headers.
29+
const enriched = {
30+
$schema: 'https://json-schema.org/draft/2020-12/schema',
31+
$id: 'https://github.com/SocketDev/xport.schema.json',
32+
title: 'xport lock-step manifest',
33+
...XportManifestSchema,
34+
}
35+
36+
writeFileSync(outPath, JSON.stringify(enriched, null, 2) + '\n', 'utf8')
37+
logger.success(`wrote ${path.relative(rootDir, outPath)}`)

0 commit comments

Comments
 (0)