Skip to content

Commit 9aae9cb

Browse files
committed
Fix version checker path to package.json
The compiled file is at dist/lib/version-checker.js, so we need to traverse up two directories (../../) to reach package.json, not one.
1 parent b9df046 commit 9aae9cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/version-checker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ const __dirname = dirname(__filename)
1212

1313
/**
1414
* Gets the local package version from package.json
15+
* Note: In compiled output, this file is at dist/lib/version-checker.js
16+
* so we need to go up two levels to reach package.json
1517
*/
1618
export function getLocalVersion(): string {
1719
try {
18-
const pkgPath = join(__dirname, '../package.json')
20+
const pkgPath = join(__dirname, '../../package.json')
1921
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
2022
return pkg.version
2123
} catch {

0 commit comments

Comments
 (0)