diff --git a/package.json b/package.json index 6ea9c3f..68b3148 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "import": "./dist/cli.js", "require": "./dist/cli.js" }, - "./mcpb-manifest.schema.json": "./dist/mcpb-manifest.schema.json", "./mcpb-manifest-v0.1.schema.json": "./dist/mcpb-manifest-v0.1.schema.json", "./mcpb-manifest-v0.2.schema.json": "./dist/mcpb-manifest-v0.2.schema.json", "./mcpb-manifest-v0.3.schema.json": "./dist/mcpb-manifest-v0.3.schema.json", diff --git a/scripts/build-mcpb-schema.js b/scripts/build-mcpb-schema.js index 4068f91..c669528 100644 --- a/scripts/build-mcpb-schema.js +++ b/scripts/build-mcpb-schema.js @@ -12,13 +12,17 @@ import path from "node:path"; const distDir = path.join(import.meta.dirname, "../dist"); const schemasDir = path.join(import.meta.dirname, "../schemas"); -// Versioned manifest schemas +// Versioned manifest schemas (for both dist/ and schemas/) const versionedManifestSchemas = { "mcpb-manifest-v0.1": McpbManifestSchema_v0_1, "mcpb-manifest-v0.2": McpbManifestSchema_v0_2, "mcpb-manifest-v0.3": McpbManifestSchema_v0_3, "mcpb-manifest-latest": McpbManifestSchemaLatest, - "mcpb-manifest": McpbManifestSchemaLatest, // Alias for latest +}; + +// Legacy alias (only for schemas/ directory, not exported from package) +const schemasOnlyAliases = { + "mcpb-manifest": McpbManifestSchemaLatest, }; // Other schemas @@ -26,11 +30,12 @@ const otherSchemas = { "mcpb-signature-info": McpbSignatureInfoSchema, }; -const allSchemas = { ...versionedManifestSchemas, ...otherSchemas }; - -// Generate all schemas to dist/ +// Generate versioned schemas and other schemas to dist/ await fs.mkdir(distDir, { recursive: true }); -for (const [key, schema] of Object.entries(allSchemas)) { +for (const [key, schema] of Object.entries({ + ...versionedManifestSchemas, + ...otherSchemas, +})) { const jsonSchema = zodToJsonSchema(schema); const filePath = path.join(distDir, `${key}.schema.json`); await fs.writeFile(filePath, JSON.stringify(jsonSchema, null, 2), { @@ -38,9 +43,12 @@ for (const [key, schema] of Object.entries(allSchemas)) { }); } -// Generate all versioned manifest schemas to schemas/ +// Generate all manifest schemas to schemas/ (including legacy alias) await fs.mkdir(schemasDir, { recursive: true }); -for (const [key, schema] of Object.entries(versionedManifestSchemas)) { +for (const [key, schema] of Object.entries({ + ...versionedManifestSchemas, + ...schemasOnlyAliases, +})) { const jsonSchema = zodToJsonSchema(schema); const filePath = path.join(schemasDir, `${key}.schema.json`); await fs.writeFile(filePath, JSON.stringify(jsonSchema, null, 2), {