Skip to content

Commit 8e38973

Browse files
authored
fix: handle buildDir = / (#42)
1 parent 1d5905c commit 8e38973

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ const { env } = require('process')
33

44
const makeSitemap = require('./make_sitemap')
55

6+
const getInputsDir = ({ inputs }) => inputs.dir || inputs.distPath || inputs.buildDir
7+
68
const getBuildDir = ({ inputs, constants }) => {
79
// Backwards compat... Correct opt is buildDir
8-
const buildDir = inputs.dir || inputs.distPath || inputs.buildDir || constants.PUBLISH_DIR
10+
const buildDir = getInputsDir({ inputs }) || constants.PUBLISH_DIR
911
// remove leading / to treat the dir a a relative one
1012
const trimmedBuildDir = buildDir.startsWith('/') ? buildDir.slice(1) : buildDir
11-
return trimmedBuildDir
13+
return trimmedBuildDir || '.'
1214
}
1315

1416
module.exports = {

0 commit comments

Comments
 (0)