Skip to content

Commit

Permalink
Some cleanin
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpetryk committed Feb 19, 2024
1 parent 0a339bd commit 78f3c07
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/dev.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import path from "path"
import path from "node:path"
import { spawn } from "node:child_process"
import { fileURLToPath } from "url"
import { fileURLToPath } from "node:url"

import ts from "typescript"
import docgen from "react-docgen-typescript"

import { writeDocgenResults } from "./docgen"

const dirname = path.join(fileURLToPath(import.meta.url), "..")
Expand All @@ -12,9 +14,10 @@ const docsRoot = path.join(projectRoot, "docs")

const tsconfig = path.join(projectRoot, "tsconfig.json")
const customDocgen = docgen.withCustomConfig(tsconfig, {})
const parse = customDocgen.parseWithProgramProvider

function startTSDocgen() {
const configPath = ts.findConfigFile("./", ts.sys.fileExists, "tsconfig.json")
const configPath = ts.findConfigFile(tsconfig, ts.sys.fileExists, "tsconfig.json")
if (!configPath) {
throw new Error("Could not find a valid 'tsconfig.json'.")
}
Expand All @@ -38,12 +41,9 @@ function startTSDocgen() {
.map((sf) => sf.fileName)
.filter((f) => f.startsWith(srcRoot))

const docgenInfo = customDocgen.parseWithProgramProvider(programFiles, () => {
return program.getProgram()
})

const docgenInfo = parse(programFiles, () => program.getProgram())
writeDocgenResults(docgenInfo)
origPostProgramCreate!(program)
origPostProgramCreate?.(program)
}

return ts.createWatchProgram(host)
Expand Down

0 comments on commit 78f3c07

Please sign in to comment.