v2: codemod iterations, canonical zod schema exports from sdk-shared (#2354)
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
This commit is contained in:
parent
7ea6fde1b6
commit
0fb8406d83
1 changed files with 2954 additions and 1665 deletions
|
|
@ -3,10 +3,12 @@ import fg from 'fast-glob';
|
|||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
// Find all package.json files under packages/ and build package list
|
||||
// Find all package.json files under packages/ and build package list.
|
||||
// Exclude node_modules and the codemod batch-test's cloned real-world repos, which are not part
|
||||
// of this SDK's public API surface (and would otherwise fail docs:check locally when present).
|
||||
const packageJsonPaths = await fg('packages/**/package.json', {
|
||||
cwd: process.cwd(),
|
||||
ignore: ['**/node_modules/**']
|
||||
ignore: ['**/node_modules/**', '**/batch-test/**']
|
||||
});
|
||||
const packages = packageJsonPaths.map(p => {
|
||||
const rootDir = join(process.cwd(), p.replace('/package.json', ''));
|
||||
|
|
@ -14,7 +16,12 @@ const packages = packageJsonPaths.map(p => {
|
|||
return { rootDir, manifest };
|
||||
});
|
||||
|
||||
const publicPackages = packages.filter(p => p.manifest.private !== true);
|
||||
// @modelcontextprotocol/core is published for direct schema imports (CallToolResultSchema.parse(...)),
|
||||
// but it's a thin re-export of the spec/OAuth Zod schemas whose JSDoc cross-references TYPES that live
|
||||
// in client/server — unresolvable from core's own per-package doc scope. We skip rendering its API docs
|
||||
// (the schemas mirror the documented types 1:1) so monorepo-wide invalid-link validation can stay ON.
|
||||
const DOCS_EXCLUDED_PACKAGES = new Set(['@modelcontextprotocol/core']);
|
||||
const publicPackages = packages.filter(p => p.manifest.private !== true && !DOCS_EXCLUDED_PACKAGES.has(p.manifest.name));
|
||||
const entryPoints = publicPackages.map(p => p.rootDir);
|
||||
|
||||
console.log(
|
||||
|
|
@ -48,7 +55,7 @@ export default {
|
|||
treatWarningsAsErrors: true,
|
||||
out: 'tmp/docs/',
|
||||
externalSymbolLinkMappings: {
|
||||
'@modelcontextprotocol/core': {
|
||||
'@modelcontextprotocol/core-internal': {
|
||||
StandardSchemaV1: 'https://standardschema.dev/',
|
||||
StandardJSONSchemaV1: 'https://standardschema.dev/'
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue