fix: fail on ident read

remove getRootFileContents util, easily replaced in the one place it's used
This commit is contained in:
2019-04-05 15:00:18 -07:00
parent 71f8bb7729
commit 9fb86bf32e

View File

@@ -27,12 +27,11 @@ exports.getFileContents = (filePath, opts = {}) => {
return content; return content;
}; };
exports.getRootFileContents = (filename, opts = {}) => {
return exports.getFileContents(path.join(exports.getRootPath(), filename), opts);
};
exports.getIdent = () => { exports.getIdent = () => {
const { name } = exports.getRootFileContents('package.json', { format: 'json' }); const { name } = exports.getFileContents(path.join(exports.getRootPath(), 'package.json'), {
format: 'json',
});
if (!name) throw new Error('Unable to read project name from package.json');
return name; return name;
}; };