@@ -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,48 @@ 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-
108109 const tsConfig = resolve ( SOURCE_BASE , path , "tsconfig.json" ) ;
109-
110110 const outDir = OUT_DIR + path ;
111- const navigationJson = `${ outDir } /nav.json` ;
111+
112+ const localNodeModules = resolve ( packageDir , "node_modules" ) . replaceAll ( "\\" , "/" ) ;
113+ const rootNodeModules = resolve ( SOURCE_BASE , "../node_modules" ) . replaceAll ( "\\" , "/" ) ;
112114
113115 const options : TypeDocOptions & PluginOptions & { path : string } = {
114116 ...DEFAULT_OPTIONS ,
115117 path,
116118 entryPoints : [ entryPoint ] ,
117119 tsconfig : tsConfig ,
118120 out : outDir ,
119- navigationJson,
121+ navigationJson : ` ${ outDir } /nav.json` ,
120122 compilerOptions : {
121- moduleResolution : "node" ,
122- baseUrl : WORKSPACE_ROOT ,
123+ target : "ESNext" ,
124+ jsx : "react-jsx" ,
125+ lib : [ "ESNext" , "DOM" , "DOM.Iterable" ] ,
126+ module : "ESNext" ,
127+ moduleResolution : "Bundler" ,
128+
129+ baseUrl : packageDir . replaceAll ( "\\" , "/" ) ,
123130 paths : COMPILER_PATHS ,
131+
132+ typeRoots : [
133+ `${ localNodeModules } /@types` ,
134+ `${ rootNodeModules } /@types` ,
135+ localNodeModules ,
136+ rootNodeModules ,
137+ ] ,
138+
139+ allowJs : true ,
140+ esModuleInterop : true ,
141+ forceConsistentCasingInFileNames : true ,
142+ strict : true ,
124143 skipLibCheck : true ,
125- jsx : "react-jsx" ,
144+
145+ preserveSymlinks : true ,
146+
147+ rootDir : SOURCE_BASE . replaceAll ( "\\" , "/" ) ,
148+ composite : false ,
149+ declaration : false ,
150+ allowArbitraryExtensions : true ,
126151 } ,
127152 } ;
128153
0 commit comments