( config: BuildConfig, docsApiJsonPath: string, apiOuputDir: string, subPkgName: string )
| 74 | } |
| 75 | |
| 76 | async function createApiData( |
| 77 | config: BuildConfig, |
| 78 | docsApiJsonPath: string, |
| 79 | apiOuputDir: string, |
| 80 | subPkgName: string |
| 81 | ) { |
| 82 | const apiExtractedJson = JSON.parse(readFileSync(docsApiJsonPath, 'utf-8')); |
| 83 | |
| 84 | const apiData: ApiData = { |
| 85 | id: subPkgName.replace('@builder.io/', '').replace(/\//g, '-'), |
| 86 | package: subPkgName, |
| 87 | members: [], |
| 88 | }; |
| 89 | |
| 90 | function addMember(apiExtract: any, hierarchyStr: string) { |
| 91 | const apiName = apiExtract.name || ''; |
| 92 | const apiKind = apiExtract.kind || ''; |
| 93 | if (apiName.length === 0) { |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | if (apiKind === 'PropertySignature') { |
| 98 | if (!apiName.includes(':')) { |
| 99 | // do not include PropertySignatures unless they are namespaced |
| 100 | // like q:slot or preventdefault:click |
| 101 | return; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | const hierarchySplit = hierarchyStr.split('/').filter((m) => m.length > 0); |
| 106 | hierarchySplit.push(apiName); |
| 107 | |
| 108 | const hierarchy = hierarchySplit.map((h) => { |
| 109 | return { |
| 110 | name: h, |
| 111 | id: getCanonical(hierarchySplit), |
| 112 | }; |
| 113 | }); |
| 114 | |
| 115 | const id = getCanonical(hierarchySplit); |
| 116 | |
| 117 | const mdFile = getMdFile(subPkgName, hierarchySplit); |
| 118 | const mdPath = join(apiOuputDir, mdFile); |
| 119 | |
| 120 | const content: string[] = []; |
| 121 | |
| 122 | if (existsSync(mdPath)) { |
| 123 | const mdSrcLines = readFileSync(mdPath, 'utf-8').split(/\r?\n/); |
| 124 | |
| 125 | for (const line of mdSrcLines) { |
| 126 | if (line.startsWith('## ')) { |
| 127 | continue; |
| 128 | } |
| 129 | if (line.startsWith('[Home]')) { |
| 130 | continue; |
| 131 | } |
| 132 | if (line.startsWith('<!-- ')) { |
| 133 | continue; |
no test coverage detected
searching dependent graphs…