Skip to content

Commit b978266

Browse files
authored
fix: create PUBLISH_DIR if it doesn't exist (#48)
1 parent 0b38edd commit b978266

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"dependencies": {
2929
"@iarna/toml": "^2.2.5",
3030
"cpx": "^1.5.0",
31+
"make-dir": "^3.1.0",
3132
"netlify-lambda": "satyarohith/netlify-lambda#88eac6a37bfb0920897c86ecda8682944a2bf5be",
3233
"netlify-redirect-parser": "^2.5.0",
3334
"nimbella-cli": "https://apigcp.nimbella.io/downloads/nim/nim-v1.8.0/nim-v1.8.0.tar.gz"

src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ module.exports = {
222222
}
223223

224224
if (redirectRules.length > 0) {
225+
if (!existsSync(constants.PUBLISH_DIR)) {
226+
const mkdir = require('make-dir');
227+
await mkdir(constants.PUBLISH_DIR);
228+
}
229+
225230
await appendFile(redirectsFile, redirectRules.join('\n'));
226231
}
227232
}

0 commit comments

Comments
 (0)