Skip to content

Commit 970c5a9

Browse files
committed
Update version.js
1 parent d92553a commit 970c5a9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/version.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
3+
import url from 'node:url';
34

45
// For some reason, on mac we need to use console.log
56
// and on windows we need to use process.stdout.write
67

7-
const { version } = JSON.parse(
8-
fs.readFileSync(path.resolve('package.json'), 'utf-8'),
9-
);
8+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
9+
const packageJson = path.join(__dirname, '..', 'package.json');
1010

11-
const string = `APP_VERSION=${version}`
11+
const { version } = JSON.parse(fs.readFileSync(packageJson, 'utf-8'));
12+
const string = `APP_VERSION=${version}`;
1213

1314
if (process.platform === 'win32') {
1415
process.stdout.write(string);

0 commit comments

Comments
 (0)