11import path from "path" ;
2- import { fileURLToPath } from "url" ;
2+ import { fileURLToPath } from "node: url" ;
33import { Application } from "typedoc" ;
44import getArgs from "./get-args.mjs" ;
55
66const product = "ignite-ui-angular" ;
77const { localize, jsonExport, jsonImport } = getArgs ( ) ;
88const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
9- const toPosix = ( p ) => p . split ( path . sep ) . join ( path . posix . sep ) ;
10-
11- const DEST = path . join . bind (
12- null ,
13- path . resolve ( __dirname , "../dist/igniteui-angular/docs" ) ,
14- ) ;
9+ const toPosix = ( p ) => String ( p ) . replace ( / \\ / g, "/" ) ;
10+ const ROOT = ( ...segments ) => toPosix ( path . resolve ( __dirname , ".." , ...segments ) ) ;
1511
1612/*
1713 * Determines the entry points for the documentation generation.
1814 */
1915function entryPoints ( ) {
2016 if ( localize === "jp" ) {
21- return path . resolve (
22- __dirname ,
23- "../i18nRepo/typedoc/ja/igniteui-angular.json" ,
24- ) ;
17+ return ROOT ( "i18nRepo" , "typedoc" , "ja" , "igniteui-angular.json" ) ;
2518 }
2619
2720 if ( jsonImport ) {
28- return path . resolve (
29- __dirname ,
30- "../dist/igniteui-angular/docs/typescript-exported/igniteui-angular.json" ,
31- ) ;
21+ return ROOT ( "dist" , "igniteui-angular" , "docs" , "typescript-exported" , "igniteui-angular.json" ) ;
3222 }
3323
34- return path . resolve (
35- __dirname ,
36- "../projects/igniteui-angular/src/public_api.ts" ,
37- ) ;
24+ return ROOT ( "projects" , "igniteui-angular" , "src" , "public_api.ts" ) ;
3825}
3926
4027/*
4128 * The output directory for the static site or json generation.
4229 */
4330const OUT_DIR = jsonExport
44- ? toPosix ( DEST ( "/ typescript-exported/ igniteui-angular.json") )
45- : toPosix ( DEST ( "/ typescript") ) ;
31+ ? ROOT ( "dist" , "igniteui-angular" , "docs" , " typescript-exported" , " igniteui-angular.json")
32+ : ROOT ( "dist" , "igniteui-angular" , "docs" , " typescript") ;
4633
4734/*
4835 * The Typedoc configuration object.
@@ -52,11 +39,8 @@ const CONFIG = {
5239 entryPoints : entryPoints ( ) ,
5340 entryPointStrategy : jsonImport || localize === "jp" ? "merge" : "resolve" ,
5441 plugin : [
55- path . resolve (
56- __dirname ,
57- "../node_modules/typedoc-plugin-localization/dist/index.js" ,
58- ) ,
59- path . resolve ( __dirname , "../node_modules/ig-typedoc-theme/dist/index.js" ) ,
42+ ROOT ( "node_modules" , "typedoc-plugin-localization" , "dist" , "index.js" ) ,
43+ ROOT ( "node_modules" , "ig-typedoc-theme" , "dist" , "index.js" ) ,
6044 ] ,
6145 theme : "igtheme" ,
6246 excludePrivate : true ,
@@ -66,7 +50,7 @@ const CONFIG = {
6650 out : OUT_DIR ,
6751 router : "structure" ,
6852 logLevel : "Verbose" ,
69- tsconfig : path . resolve ( __dirname , "../ tsconfig.typedoc.json") ,
53+ tsconfig : ROOT ( " tsconfig.typedoc.json")
7054} ;
7155
7256async function main ( ) {
@@ -77,10 +61,7 @@ async function main() {
7761 app . options . setValue ( 'versioning' , true ) ;
7862
7963 if ( localize === "jp" ) {
80- const jpTemplateStrings = path . resolve (
81- __dirname ,
82- "../extras/template/strings/shell-strings.json" ,
83- ) ;
64+ const jpTemplateStrings = ROOT ( "extras" , "template" , "strings" , "shell-strings.json" ) ;
8465 app . options . setValue ( "templateStrings" , jpTemplateStrings ) ;
8566 }
8667
0 commit comments