We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d92553a commit 970c5a9Copy full SHA for 970c5a9
scripts/version.js
@@ -1,14 +1,15 @@
1
import fs from 'node:fs';
2
import path from 'node:path';
3
+import url from 'node:url';
4
5
// For some reason, on mac we need to use console.log
6
// and on windows we need to use process.stdout.write
7
-const { version } = JSON.parse(
8
- fs.readFileSync(path.resolve('package.json'), 'utf-8'),
9
-);
+const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
+const packageJson = path.join(__dirname, '..', 'package.json');
10
11
-const string = `APP_VERSION=${version}`
+const { version } = JSON.parse(fs.readFileSync(packageJson, 'utf-8'));
12
+const string = `APP_VERSION=${version}`;
13
14
if (process.platform === 'win32') {
15
process.stdout.write(string);
0 commit comments