File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ process.on("SIGINT", () => process.exit(0));
9
9
process . on ( "SIGTERM" , ( ) => process . exit ( 0 ) ) ;
10
10
11
11
async function main ( ) {
12
- const packageInfo = await getPackageInfo ( ) ;
12
+ const packageInfo = getPackageInfo ( ) ;
13
13
14
14
const program = new Command ( )
15
15
. name ( "@dojoengine" )
Original file line number Diff line number Diff line change @@ -3,7 +3,16 @@ import fs from "fs-extra";
3
3
import { type PackageJson } from "type-fest" ;
4
4
5
5
export function getPackageInfo ( ) {
6
- const packageJsonPath = path . join ( "package.json" ) ;
7
-
8
- return fs . readJSONSync ( packageJsonPath ) as PackageJson ;
6
+ const packageJsonPath = path . join ( process . cwd ( ) , "package.json" ) ;
7
+ try {
8
+ return fs . readJSONSync ( packageJsonPath ) as PackageJson ;
9
+ } catch ( error ) {
10
+ const errorMessage =
11
+ error instanceof Error ? error . message : "Unknown error" ;
12
+ console . warn ( `Failed to read package.json: ${ errorMessage } ` ) ;
13
+ console . warn ( 'Falling back to default version "1.0.0"' ) ;
14
+ return {
15
+ version : "1.0.0" ,
16
+ } as PackageJson ;
17
+ }
9
18
}
You can’t perform that action at this time.
0 commit comments