fix: fail on ident read
remove getRootFileContents util, easily replaced in the one place it's used
This commit is contained in:
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user