fix: read package file instead of using require

require uses a cache, so if the package.json file was changed before running build, the changes won't exist in the build runtime. using fs.readFileSync instead ensures that the information read from package.json is current.

Original commit: elastic/kibana-plugin-helpers@f78e891838
This commit is contained in:
Joe Fleming 2017-11-06 11:25:19 -07:00
parent 7b8cf3c5b7
commit ca5c47defa

View file

@ -1,11 +1,12 @@
const resolve = require('path').resolve;
const statSync = require('fs').statSync;
const readFileSync = require('fs').readFileSync;
const configFile = require('./config_file');
module.exports = function (root) {
if (!root) root = process.cwd();
const pkg = require(resolve(root, 'package.json'));
const pkg = JSON.parse(readFileSync(resolve(root, 'package.json')));
const config = configFile(root);
const buildSourcePatterns = [