Skip to content

Commit 37a4854

Browse files
authored
Merge branch 'ENG-219/app-bootstrap' into ENG-219/command-i18n
2 parents 6a15f85 + a497018 commit 37a4854

1 file changed

Lines changed: 2 additions & 31 deletions

File tree

src/app.ts

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,8 @@
11
import { Command } from 'commander';
22
import { Config, getConfig, resetConfig } from './config.ts';
3-
import { fileURLToPath } from 'node:url';
4-
import path from 'node:path';
5-
import fs from 'fs-extra';
3+
import { version } from '../package.json';
64

7-
const __filename = fileURLToPath(import.meta.url);
8-
const __dirname = path.dirname(__filename);
9-
10-
/**
11-
* Reads the pup version from the nearest package.json.
12-
*
13-
* @since TBD
14-
*
15-
* @returns {string} The version string from package.json, or '2.0.0' as a fallback.
16-
*/
17-
function getVersion(): string {
18-
// Try to read from package.json
19-
const candidates = [
20-
path.resolve(__dirname, '..', 'package.json'),
21-
path.resolve(__dirname, '..', '..', 'package.json'),
22-
];
23-
24-
for (const candidate of candidates) {
25-
if (fs.existsSync(candidate)) {
26-
const pkg = JSON.parse(fs.readFileSync(candidate, 'utf-8')) as { version: string };
27-
return pkg.version;
28-
}
29-
}
30-
31-
return '2.0.0';
32-
}
33-
34-
export const PUP_VERSION = getVersion();
5+
export const PUP_VERSION = version;
356

367
/**
378
* Creates and configures the Commander program instance.

0 commit comments

Comments
 (0)