@@ -39,18 +39,20 @@ const SOURCE_BASE = RELEASE_PATH
3939 ? resolve ( RELEASE_PATH , "packages" )
4040 : resolve ( __dirname , PACKAGES_DIR ) ;
4141
42+ const COMPILER_BASE = RELEASE_PATH ? resolve ( RELEASE_PATH ) : resolve ( __dirname , "../../" ) ;
43+
4244const COMPILER_PATHS : Record < string , string [ ] > = {
43- "*" : [ "node_modules/*" ] ,
45+ "*" : [ resolve ( COMPILER_BASE , "node_modules/*" ) . replaceAll ( "\\" , "/" ) ] ,
4446} ;
4547
4648PACKAGE_PATHS . forEach ( ( path ) => {
4749 const name = packagePathToName ( path ) ;
48- COMPILER_PATHS [ name ] = [ `packages/${ path } ` ] ;
49- COMPILER_PATHS [ `${ name } /*` ] = [ `packages/${ path } /*` ] ;
50+ // Point to the source files in the release directory
51+ const absolutePkgPath = resolve ( SOURCE_BASE , path , "src/main.ts" ) . replaceAll ( "\\" , "/" ) ;
52+ COMPILER_PATHS [ name ] = [ absolutePkgPath ] ;
53+ COMPILER_PATHS [ `${ name } /*` ] = [ resolve ( SOURCE_BASE , path , "src/*" ) . replaceAll ( "\\" , "/" ) ] ;
5054} ) ;
5155
52- const WORKSPACE_ROOT = resolve ( __dirname , "../../" ) . replaceAll ( "\\" , "/" ) ;
53-
5456const logger = new Logger ( ) ;
5557
5658program . name ( "typedoc-helper" )
@@ -104,25 +106,28 @@ program.command("run", { isDefault: true })
104106async function generateDocs ( path : string , dryRun : boolean ) {
105107 const packageDir = resolve ( SOURCE_BASE , path ) ;
106108 const entryPoint = resolve ( packageDir , "src/main.ts" ) . replaceAll ( "\\" , "/" ) ;
107-
108- const tsConfig = resolve ( SOURCE_BASE , path , "tsconfig.json" ) ;
109-
109+ const tsConfig = resolve ( packageDir , "tsconfig.json" ) ; // Use the local tsconfig
110110 const outDir = OUT_DIR + path ;
111- const navigationJson = `${ outDir } /nav.json` ;
112111
113- const options : TypeDocOptions & PluginOptions & { path : string } = {
112+ const options = {
114113 ...DEFAULT_OPTIONS ,
115114 path,
116115 entryPoints : [ entryPoint ] ,
117116 tsconfig : tsConfig ,
118117 out : outDir ,
119- navigationJson,
118+ navigationJson : `${ outDir } /nav.json` ,
119+ // We minimize overrides to let the package's own config do the work
120120 compilerOptions : {
121- moduleResolution : "node" ,
122- baseUrl : WORKSPACE_ROOT ,
121+ baseUrl : SOURCE_BASE . replaceAll ( "\\" , "/" ) ,
123122 paths : COMPILER_PATHS ,
123+ // Tell TS to look for types in the root node_modules specifically
124+ typeRoots : [
125+ resolve ( process . cwd ( ) , "node_modules/@types" ) . replaceAll ( "\\" , "/" ) ,
126+ resolve ( process . cwd ( ) , "node_modules" ) . replaceAll ( "\\" , "/" ) ,
127+ ] ,
128+ // Crucial for pnpm symlinks in CI
129+ preserveSymlinks : true ,
124130 skipLibCheck : true ,
125- jsx : "react-jsx" ,
126131 } ,
127132 } ;
128133
0 commit comments