Skip to content

Commit

Permalink
fix: read version from package.json trough fs instead of require
Browse files Browse the repository at this point in the history
  • Loading branch information
joneff committed Jan 6, 2023
1 parent 75df125 commit 9d03081
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import fs from 'fs';
import path from 'path';
import argsParser from 'yargs-parser';

import * as commands from './commands';
Expand All @@ -7,6 +9,8 @@ import {
logger
} from '../utils';

const version = JSON.parse( fs.readFileSync( path.resolve( __dirname, '../../package.json' ), 'utf8' ) ).version;

export function cli() {
logger.time('cli:start');

Expand All @@ -31,8 +35,6 @@ export function cli() {
}

if (argv.version) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const version = require('../package.json').version;
process.stdout.write(`${version}\n`);
process.exit(0);
}
Expand Down

0 comments on commit 9d03081

Please sign in to comment.