Skip to content

Commit 7e519af

Browse files
authored
Fix package.json location (#456) (#458)
From #456 Parse ohm's package.json file to obtain the version. cli.js was parsing the package.json in the current directory to obtain the package version. It now parses its own package.json file, not the one from the project that is using ohm. Co-authored-by: Andy Sturrock <andysturrock@users.noreply.github.com>
1 parent 1050ad0 commit 7e519af

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/cli/src/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import {Command} from 'commander';
22

33
import fs from 'fs';
44
import commands from './commands/index.js';
5+
import url from 'url';
56

6-
const {version} = JSON.parse(fs.readFileSync('./package.json'));
7+
const {version} = JSON.parse(fs.readFileSync(new url.URL('../package.json', import.meta.url)));
78

89
export function ohmCli(userArgs, optsForTesting = {}) {
910
const program = new Command();

0 commit comments

Comments
 (0)