@@ -64,7 +64,8 @@ module.exports = class AddonDocsDeployPlugin {
64
64
65
65
_verifyRedirectFile ( stagingDirectory ) {
66
66
let vendorDir = `${ __dirname } /../../vendor/ember-cli-addon-docs` ;
67
- let segmentCount = this . _getRootURL ( ) . split ( '/' ) . length ;
67
+ let rootURL = this . _getRootURL ( ) ;
68
+ let segmentCount = rootURL === '' ? 0 : rootURL . split ( '/' ) . length ;
68
69
let redirectContents = fs . readFileSync ( `${ vendorDir } /404.html` , 'utf-8' ) ;
69
70
let redirects = this . _discoverOldPaths ( stagingDirectory ) ;
70
71
@@ -151,9 +152,10 @@ module.exports = class AddonDocsDeployPlugin {
151
152
_updateIndexContents ( context , stagingDirectory , appRoot , deployVersion ) {
152
153
let indexPath = `${ stagingDirectory } /${ appRoot } /index.html` ;
153
154
let rootURL = [ this . _getRootURL ( ) , appRoot ] . filter ( Boolean ) . join ( '/' ) ;
155
+ let addonDocsRootURL = rootURL === '' ? '/' : `/${ rootURL } /` ;
154
156
let contents = fs . readFileSync ( indexPath , 'utf-8' ) ;
155
157
let encodedVersion = encodeURIComponent ( JSON . stringify ( deployVersion ) ) ;
156
- let updated = contents . replace ( / \/ ? A D D O N _ D O C S _ R O O T _ U R L \/ ? / g, `/ ${ rootURL } /` )
158
+ let updated = contents . replace ( / \/ ? A D D O N _ D O C S _ R O O T _ U R L \/ ? / g, addonDocsRootURL )
157
159
. replace ( / % 2 2 A D D O N _ D O C S _ D E P L O Y _ V E R S I O N % 2 2 / g, encodedVersion ) ;
158
160
159
161
fs . writeFileSync ( indexPath , updated ) ;
0 commit comments