fix: publish compiled .js + .d.ts instead of raw .ts sources
- Add tsc --build pipeline for json-cas, json-cas-fs, json-cas-workflow
- Update package.json exports to point to dist/ (types + import)
- Fix Store type error: use BootstrapCapableStore for stores with bootstrap
- Export BootstrapCapableStore type from json-cas
- Fix meta-schema: nodeSchema now uses real JSON Schema (draft 2020-12)
- Exclude test files from tsc compilation
Breaking: bootstrap hash changes due to meta-schema payload update.
小橘 🍊(NEKO Team)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
dist/
|
||||
*.d.ts.map
|
||||
dist/
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"typescript": "^5.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc --build packages/json-cas packages/json-cas-fs packages/json-cas-workflow",
|
||||
"test": "bun test",
|
||||
"check": "biome check .",
|
||||
"format": "biome format --write ."
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
"name": "@uncaged/json-cas-fs",
|
||||
"version": "0.3.0",
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": ["dist", "src"],
|
||||
"scripts": {
|
||||
"test": "bun test"
|
||||
},
|
||||
|
||||
@@ -8,7 +8,11 @@ import {
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import type { CasNode, Hash, Store } from "@uncaged/json-cas";
|
||||
import type {
|
||||
BootstrapCapableStore,
|
||||
CasNode,
|
||||
Hash,
|
||||
} from "@uncaged/json-cas";
|
||||
|
||||
import {
|
||||
BOOTSTRAP_STORE,
|
||||
@@ -110,7 +114,7 @@ function appendToTypeIndex(
|
||||
typeIndex.set(type, list);
|
||||
}
|
||||
|
||||
export function createFsStore(dir: string): Store {
|
||||
export function createFsStore(dir: string): BootstrapCapableStore {
|
||||
const data = new Map<Hash, CasNode>();
|
||||
loadDir(dir, data);
|
||||
const indexDir = join(dir, INDEX_DIR);
|
||||
@@ -136,7 +140,7 @@ export function createFsStore(dir: string): Store {
|
||||
return hash;
|
||||
}
|
||||
|
||||
const store: Store = {
|
||||
const store: BootstrapCapableStore = {
|
||||
async put(typeHash: Hash, payload: unknown): Promise<Hash> {
|
||||
const hash = await computeHash(typeHash, payload);
|
||||
|
||||
|
||||
@@ -4,5 +4,9 @@
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src"],
|
||||
"exclude": ["src/**/*.test.ts"],
|
||||
"references": [
|
||||
{ "path": "../json-cas" }
|
||||
]
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,10 +2,15 @@
|
||||
"name": "@uncaged/json-cas-workflow",
|
||||
"version": "0.3.0",
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": ["dist", "src"],
|
||||
"scripts": {
|
||||
"test": "bun test"
|
||||
},
|
||||
|
||||
@@ -4,5 +4,9 @@
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src"],
|
||||
"exclude": ["src/**/*.test.ts"],
|
||||
"references": [
|
||||
{ "path": "../json-cas" }
|
||||
]
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,10 +2,15 @@
|
||||
"name": "@uncaged/json-cas",
|
||||
"version": "0.3.0",
|
||||
"type": "module",
|
||||
"main": "./src/index.ts",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": ["dist", "src"],
|
||||
"scripts": {
|
||||
"test": "bun test"
|
||||
},
|
||||
|
||||
@@ -13,9 +13,15 @@ const BOOTSTRAP_PAYLOAD = {
|
||||
hashAlgorithm: "xxh64",
|
||||
hashEncoding: "crockford-base32-13",
|
||||
nodeSchema: {
|
||||
payload: "any",
|
||||
timestamp: "number",
|
||||
type: "Hash",
|
||||
$schema: "https://json-schema.org/draft/2020-12/schema",
|
||||
type: "object",
|
||||
required: ["type", "payload", "timestamp"],
|
||||
properties: {
|
||||
type: { type: "string", description: "Hash of the type descriptor node (or self for bootstrap)" },
|
||||
payload: { description: "Arbitrary data" },
|
||||
timestamp: { type: "number", description: "Unix epoch ms when the node was first stored" },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
payloadEncoding: "cbor-rfc8949-deterministic",
|
||||
version: "1",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export { bootstrap } from "./bootstrap.js";
|
||||
export { BOOTSTRAP_STORE } from "./bootstrap-capable.js";
|
||||
export type { BootstrapCapableStore } from "./bootstrap-capable.js";
|
||||
export { cborEncode } from "./cbor.js";
|
||||
export { computeHash, computeSelfHash } from "./hash.js";
|
||||
export type { JSONSchema } from "./schema.js";
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { BOOTSTRAP_STORE } from "./bootstrap-capable.js";
|
||||
import {
|
||||
BOOTSTRAP_STORE,
|
||||
type BootstrapCapableStore,
|
||||
} from "./bootstrap-capable.js";
|
||||
import { computeHash, computeSelfHash } from "./hash.js";
|
||||
import type { CasNode, Hash, Store } from "./types.js";
|
||||
import type { CasNode, Hash } from "./types.js";
|
||||
|
||||
export function createMemoryStore(): Store {
|
||||
export function createMemoryStore(): BootstrapCapableStore {
|
||||
const data = new Map<Hash, CasNode>();
|
||||
const byType = new Map<Hash, Set<Hash>>();
|
||||
|
||||
@@ -24,7 +27,7 @@ export function createMemoryStore(): Store {
|
||||
return hash;
|
||||
}
|
||||
|
||||
const store: Store = {
|
||||
const store: BootstrapCapableStore = {
|
||||
async put(typeHash: Hash, payload: unknown): Promise<Hash> {
|
||||
const hash = await computeHash(typeHash, payload);
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src"],
|
||||
"exclude": ["src/**/*.test.ts"]
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user