Comparing version 0.7.0 to 0.8.0
'use strict'; | ||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
@@ -8,14 +7,17 @@ const JSON5 = require('json5'); | ||
module.exports = argv => new Promise((resolve) => { | ||
module.exports = argv => new Promise(resolve => { | ||
if (argv.verbose) console.log('reading spec'); | ||
// read duh.json | ||
const folderName = path.basename(process.cwd()); | ||
const fileName = argv.filename || folderName + '.json5'; | ||
fs.readFile(fileName, 'utf-8') | ||
.then(duhRaw => { | ||
const duh = JSON5.parse(duhRaw); | ||
// json dereference | ||
jsonRefs.resolveRefs(duh) | ||
.then(value => resolve(value.resolved)); | ||
}); | ||
// json dereference | ||
jsonRefs.resolveRefs({$ref: fileName}, { | ||
loaderOptions: { | ||
processContent: function (res, cb) { | ||
let ml = JSON5.parse(res.text); | ||
cb(undefined, ml); | ||
} | ||
} | ||
}).then(res => { | ||
resolve(res.resolved); | ||
}); | ||
}); |
{ | ||
"name": "duh-core", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "DUH core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
153
0