Skip to content

Commit

Permalink
Fix an issue with cache folder not existing
Browse files Browse the repository at this point in the history
  • Loading branch information
KittyGiraudel committed Oct 22, 2017
1 parent 9c12a75 commit e612b61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 1 addition & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -14,6 +14,7 @@
"commander": "^2.11.0",
"dotenv": "^4.0.0",
"github": "^11.0.0",
"mkdirp": "^0.5.1",
"moment": "^2.18.1",
"semver": "^5.4.1"
},
Expand Down
6 changes: 4 additions & 2 deletions src/get-releases.js
@@ -1,15 +1,17 @@
const fs = require('fs')
const util = require('util')
const { writeFileSync } = require('fs')
const path = require('path')
const github = require('./get-github-client')
const { PER_PAGE } = require('./constants')
const readFile = util.promisify(fs.readFile)
const mkdirp = util.promisify(require('mkdirp'))

const readCache = cacheFile =>
readFile(cacheFile, 'utf8').then(JSON.parse)

const writeCache = (cacheFile, data) =>
writeFileSync(cacheFile, JSON.stringify(data), 'utf8')
mkdirp(path.dirname(cacheFile))
.then(() => fs.writeFileSync(cacheFile, JSON.stringify(data), 'utf8'))

const fetchReleasesBatch = (page, options) =>
new Promise((resolve, reject) => {
Expand Down

0 comments on commit e612b61

Please sign in to comment.