Skip to content

Commit

Permalink
Fix package.json location (#456) (#458)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
andysturrock and andysturrock authored Aug 16, 2023
1 parent 1050ad0 commit 7e519af
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/cli/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import {Command} from 'commander';

import fs from 'fs';
import commands from './commands/index.js';
import url from 'url';

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

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

0 comments on commit 7e519af

Please sign in to comment.