mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-18 22:33:08 +00:00
fix: Update @github/copilot-sdk version and enhance version utility to locate package.json (#840)
- Changed @github/copilot-sdk dependency from "^0.1.16" to "0.1.16" in package.json and package-lock.json. - Improved version utility in version.ts to check multiple candidate paths for package.json, ensuring better reliability in locating the file.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* Version utility - Reads version from package.json
|
||||
*/
|
||||
|
||||
import { readFileSync } from 'fs';
|
||||
import { readFileSync, existsSync } from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname, join } from 'path';
|
||||
import { createLogger } from '@automaker/utils';
|
||||
@@ -24,7 +24,20 @@ export function getVersion(): string {
|
||||
}
|
||||
|
||||
try {
|
||||
const packageJsonPath = join(__dirname, '..', '..', 'package.json');
|
||||
const candidatePaths = [
|
||||
// Development via tsx: src/lib -> project root
|
||||
join(__dirname, '..', '..', 'package.json'),
|
||||
// Packaged/build output: lib -> server bundle root
|
||||
join(__dirname, '..', 'package.json'),
|
||||
];
|
||||
|
||||
const packageJsonPath = candidatePaths.find((candidate) => existsSync(candidate));
|
||||
if (!packageJsonPath) {
|
||||
throw new Error(
|
||||
`package.json not found in any expected location: ${candidatePaths.join(', ')}`
|
||||
);
|
||||
}
|
||||
|
||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
||||
const version = packageJson.version || '0.0.0';
|
||||
cachedVersion = version;
|
||||
|
||||
Reference in New Issue
Block a user