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