Skip to content

Commit c1255e1

Browse files
committed
Fix .version lookup (close #28)
1 parent 05fcfdc commit c1255e1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bin/hyp.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import subcommand from 'subcommand'
44
import fs from 'fs'
5+
import path from 'path'
6+
import { fileURLToPath } from 'url'
57

68
import * as hyper from '../lib/hyper/index.js'
79

@@ -74,7 +76,7 @@ match(argv)
7476
// error output when no/invalid command is given
7577
function none (args) {
7678
if (args.version) {
77-
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'))
79+
const packageJson = JSON.parse(fs.readFileSync(path.join(fileURLToPath(import.meta.url), '../../package.json'), 'utf8'))
7880
console.log(packageJson.version)
7981
process.exit(0)
8082
}

0 commit comments

Comments
 (0)