feat: create schema version map with CURRENT_MANIFEST_SCHEMA selector
This commit is contained in:
parent
fe733e3450
commit
3a0d4a8635
1 changed files with 42 additions and 8 deletions
|
|
@ -6,8 +6,7 @@ import { join, resolve } from "path";
|
|||
import prettyBytes from "pretty-bytes";
|
||||
|
||||
import { unpackExtension } from "../cli/unpack.js";
|
||||
import { McpbManifestSchema } from "../schemas/0.2.js";
|
||||
import { McpbManifestSchema as LooseMcpbManifestSchema } from "../schemas_loose/0.2.js";
|
||||
import { CURRENT_MANIFEST_SCHEMA, CURRENT_MANIFEST_SCHEMA_LOOSE } from "../shared/constants.js";
|
||||
|
||||
export function validateManifest(inputPath: string): boolean {
|
||||
try {
|
||||
|
|
@ -22,7 +21,7 @@ export function validateManifest(inputPath: string): boolean {
|
|||
const manifestContent = readFileSync(manifestPath, "utf-8");
|
||||
const manifestData = JSON.parse(manifestContent);
|
||||
|
||||
const result = McpbManifestSchema.safeParse(manifestData);
|
||||
const result = CURRENT_MANIFEST_SCHEMA.safeParse(manifestData);
|
||||
|
||||
if (result.success) {
|
||||
console.log("Manifest schema validation passes!");
|
||||
|
|
@ -72,7 +71,7 @@ export async function cleanMcpb(inputPath: string) {
|
|||
const manifestPath = resolve(unpackPath, "manifest.json");
|
||||
const originalManifest = await fs.readFile(manifestPath, "utf-8");
|
||||
const manifestData = JSON.parse(originalManifest);
|
||||
const result = LooseMcpbManifestSchema.safeParse(manifestData);
|
||||
const result = CURRENT_MANIFEST_SCHEMA_LOOSE.safeParse(manifestData);
|
||||
|
||||
if (!result.success) {
|
||||
throw new Error(
|
||||
|
|
|
|||
Loading…
Reference in a new issue