Skip to content

Commit

Permalink
fix(metadata): Don't assume metadata folder exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Sep 10, 2018
1 parent e8def19 commit 33edfec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Empty file modified bin.js 100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -30,6 +30,7 @@
"hat": "0.0.3",
"inert": "^5.1.0",
"js-yaml": "^3.12.0",
"mkdirp": "^0.5.1",
"mongoose": "^5.2.14",
"pino": "^5.5.0",
"request": "^2.88.0",
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Expand Up @@ -12,6 +12,7 @@ const prom = (fnc) => new Promise((resolve, reject) => fnc((err, res) => err ? r
const request = require('request')
const truncate = require('truncate')
const yaml = require('js-yaml')
const mkdir = require('mkdirp').sync

const fs = require('fs')
const path = require('path')
Expand Down Expand Up @@ -252,6 +253,9 @@ module.exports = ({redis, mongodb, adminPW, secret, fdroidRepoPath, port, host,
if (fs.existsSync(metaName)) {
meta = Object.assign(yaml.safeLoad(fs.readFileSync(metaName, 'utf8')), meta)
}
if (!fs.existsSync(path.dirname(metaName))) {
mkdir(path.dirname(metaName))
}
fs.writeFileSync(metaName, yaml.safeDump(meta))

await Promise.all(app.variants.filter(v => v.enabled).map(async (v) => {
Expand Down

0 comments on commit 33edfec

Please sign in to comment.