MCPcopy Create free account
hub / github.com/arktypeio/arktype / jsDocGen

Function jsDocGen

ark/repo/jsdocGen.ts:142–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140let apiDocsByGroup: ApiDocsByGroup = {} as ApiDocsByGroup
141
142export const jsDocGen = () => {
143 const project = createProject()
144
145 const sourceFiles = project.getSourceFiles()
146
147 console.log(
148 `✍️ Generating JSDoc for ${sourceFiles.length} files in ${typeBuildDir} and ${schemaBuildDir}...`
149 )
150
151 for (const file of project.getSourceFiles()) docgenForFile(file)
152
153 project.saveSync()
154
155 const docs = getAllJsDoc(project)
156
157 const blocks = docs.flatMap(doc => parseBlock(doc) ?? [])
158
159 assertTypeMembersCovered(project, blocks)
160
161 const traversalNames = blocks
162 .filter(block => block.group === "Traversal")
163 .map(block => block.name)
164 const typeApiNames = [
165 ...Object.keys(typeApiGroupByMember),
166 ...typeMembersInProse
167 ]
168
169 for (const block of blocks) {
170 const pageNames =
171 block.group === "Traversal" ? traversalNames : typeApiNames
172 block.summary = block.summary.map(part => resolveReference(part, pageNames))
173 block.notes = block.notes.map(note =>
174 note.map(part => resolveReference(part, pageNames))
175 )
176 }
177
178 // Type rows follow typeApiGroups, Traversal rows their source order
179 blocks.sort(
180 (l, r) => typeApiNames.indexOf(l.name) - typeApiNames.indexOf(r.name)
181 )
182
183 apiDocsByGroup = flatMorph(blocks, (i, block) => [
184 { group: block.group },
185 block
186 ])
187
188 writeApiDataFile()
189
190 console.log(
191 `📚 Successfully updated ${updateCount} JSDoc comments on your build output.`
192 )
193}
194
195export const writeApiDataFile = () => {
196 writeFile(

Callers 1

build.tsFile · 0.90

Calls 11

createProjectFunction · 0.85
docgenForFileFunction · 0.85
getAllJsDocFunction · 0.85
parseBlockFunction · 0.85
assertTypeMembersCoveredFunction · 0.85
resolveReferenceFunction · 0.85
flatMorphFunction · 0.85
writeApiDataFileFunction · 0.85
filterMethod · 0.80
sortMethod · 0.80
mapMethod · 0.65

Tested by

no test coverage detected