Skip to content

Commit f54d039

Browse files
committed
change docgen script to avoid ts restriction
1 parent 146da9c commit f54d039

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

scripts/docgen/docgen.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const PREFERRED_PARAMS = [
6565

6666
let authApiReportOriginal: string;
6767
let authApiConfigOriginal: string;
68+
let appPkgOriginal: string;
6869

6970
yargs
7071
.command(
@@ -119,6 +120,14 @@ function cleanup() {
119120
authApiReportOriginal
120121
);
121122
}
123+
// Restore original app/package.json
124+
if (authApiConfigOriginal) {
125+
console.log(`Restoring original app/package.json contents.`);
126+
fs.writeFileSync(
127+
`${projectRoot}/packages/app/package.json`,
128+
appPkgOriginal
129+
);
130+
}
122131
for (const excludedPackage of EXCLUDED_PACKAGES) {
123132
if (fs.existsSync(`${projectRoot}/temp/${excludedPackage}.skip`)) {
124133
console.log(
@@ -198,11 +207,26 @@ async function generateDocs(
198207
`"mainEntryPointFilePath": "<projectFolder>/dist/esm2017/index.doc.d.ts"`
199208
);
200209

210+
console.log(`Temporarily modifying packages/app/package.json for docgen.`);
211+
// Remove typesVersions restriction just for docgen
212+
appPkgOriginal = fs.readFileSync(
213+
`${projectRoot}/packages/app/package.json`,
214+
'utf8'
215+
);
216+
const appPkgModified = appPkgOriginal.replace(
217+
`./dist/typescript-not-supported.d.ts`,
218+
`./dist/app/src/index.d.ts`
219+
);
220+
201221
try {
202222
fs.writeFileSync(
203223
`${projectRoot}/packages/auth/api-extractor.json`,
204224
authApiConfigModified
205225
);
226+
fs.writeFileSync(
227+
`${projectRoot}/packages/app/package.json`,
228+
appPkgModified
229+
);
206230

207231
if (skipBuild) {
208232
await spawn('yarn', ['api-report'], {

0 commit comments

Comments
 (0)