Open andysturrock opened 1 year ago
Thanks for the bug report! I think a more appropriate fix would be to use a module-relative URL...e.g. something like:
fs.readFileSync(new URL('../package.json', import.meta.url));
Yep that makes more sense.
PR https://github.com/ohmjs/ohm/pull/458 created
Line 6 of cli.js reads the package.json file from the current directory:
const {version} = JSON.parse(fs.readFileSync('./package.json'));
If that package.json file does not have a version key thennpx ohm generateBundles
fails with:TypeError: Cannot read properties of undefined (reading 'option')
If the local file does have a version then the -v flag will return that, rather than the version of ohmjs.To get the current version of ohmjs, I think it should be:
const {version} = JSON.parse(fs.readFileSync('./node_modules/@ohm-js/cli/package.json'));
If you agree I am happy to submit a PR.