refactor: remove non-versioned mcpb-manifest.schema.json export
Remove the generic mcpb-manifest.schema.json export from package.json in favor of explicit versioned exports. Changes: - Removed ./mcpb-manifest.schema.json from package exports - Stop generating mcpb-manifest.schema.json in dist/ - Keep mcpb-manifest.schema.json in schemas/ for backward compatibility Consumers should now use: - mcpb-manifest-latest.schema.json (for latest version) - mcpb-manifest-v0.1.schema.json (for specific version) - etc. This makes versioning explicit and prevents ambiguity about which schema version is being used.
This commit is contained in:
parent
b5fa7df6eb
commit
eeb9dca819
2 changed files with 16 additions and 9 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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), {
|
||||
|
|
|
|||
Loading…
Reference in a new issue