MCPcopy Create free account
hub / github.com/ReactiveX/rxjs / checkPackageDocs

Function checkPackageDocs

scripts/check-package-docs.mjs:56–82  ·  view source on GitHub ↗
(root = repositoryRoot)

Source from the content-addressed store, hash-verified

54}
55
56export async function checkPackageDocs(root = repositoryRoot) {
57 const documentPaths = [
58 'README.md',
59 'packages/rxjs/README.md',
60 'packages/rxjs/MIGRATION.md',
61 'packages/rxjs/CONTRIBUTING.md',
62 ...(await markdownFiles(root, 'packages/rxjs/docs')),
63 'packages/observable-polyfill/README.md',
64 'packages/observable-polyfill/test/wpt/README.md',
65 'packages/test/README.md',
66 'packages/migrate/README.md',
67 ...(await markdownFiles(root, 'packages/migrate/docs')),
68 ...(await markdownFiles(root, 'packages/migrate/skill')),
69 ];
70 const documents = await Promise.all(
71 documentPaths.map(async (documentPath) => [documentPath, await readFile(path.join(root, documentPath), 'utf8')])
72 );
73 const manifestEntries = await Promise.all(
74 Object.keys(packageRequirements).map(async (manifestPath) => [
75 manifestPath,
76 JSON.parse(await readFile(path.join(root, manifestPath), 'utf8')),
77 ])
78 );
79 const existingPaths = new Set(await allPaths(root));
80 const errors = auditPackageDocs({ documents, existingPaths, manifests: Object.fromEntries(manifestEntries) });
81 if (errors.length > 0) throw new Error(`Package documentation check failed:\n- ${errors.join('\n- ')}`);
82}
83
84async function markdownFiles(root, relativeDirectory) {
85 const entries = await readdir(path.join(root, relativeDirectory), { withFileTypes: true });

Callers 1

Calls 5

markdownFilesFunction · 0.85
allPathsFunction · 0.85
auditPackageDocsFunction · 0.85
mapMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected