@@ -10,9 +10,10 @@ program
10
10
. option ( '-c, --config <location>' , 'Location of the exported Insomnia JSON config.' )
11
11
. option ( '-l, --logo <location>' , 'Project logo location (48x48px PNG).' )
12
12
. option ( '-o, --output <location>' , 'Where to save the file (defaults to current working directory).' )
13
+ . option ( '-d, --data-root <docs-root>' , 'Docs root for the API documentation.' , '' )
13
14
. parse ( process . argv ) ;
14
15
15
- const { config, logo, output } = program ;
16
+ const { config, logo, output, dataRoot } = program ;
16
17
17
18
if ( ! config ) {
18
19
console . log ( 'You must provide an exported Insomnia config (Preferences -> Data -> Export Data -> Current Workspace).' ) ;
@@ -47,6 +48,19 @@ mkdirp(outputPath, err => {
47
48
fs . copyFileSync ( logoPath , path . join ( outputPath , 'logo.png' ) ) ;
48
49
}
49
50
51
+ try {
52
+ const data = fs . readFileSync ( path . join ( outputPath , 'index.html' ) , 'utf8' )
53
+ var result = data . replace ( 'DATAROOT' , dataRoot ) ;
54
+ } catch ( err ) {
55
+ console . error ( err )
56
+ }
57
+
58
+ try {
59
+ fs . writeFileSync ( path . join ( outputPath , 'index.html' ) , result )
60
+ } catch ( err ) {
61
+ console . error ( err )
62
+ }
63
+
50
64
console . log ( '\n * * * Done! * * *\nYour documentation has been created and it\'s ready to be deployed!' ) ;
51
65
52
66
process . exit ( ) ;
0 commit comments