File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1717 ],
1818 "author" :
" leoweyr <[email protected] >" ,
1919 "license" : " MIT" ,
20+ "devDependencies" : {
21+ "@types/node" : " ^22.10.7"
22+ },
2023 "dependencies" : {
2124 "typescript" : " ^5.7.3"
2225 },
Original file line number Diff line number Diff line change 1+ import * as Path from "path" ;
2+ import * as File from "fs" ;
3+
4+ import { Project } from "../project/Project" ;
5+
6+
7+ export class PackageConfiguration {
8+ private readonly filePath : string ;
9+
10+ public constructor ( project : Project ) {
11+ this . filePath = Path . join ( project . getPath ( ) , "package.json" ) ;
12+ }
13+
14+ public getPath ( ) : string {
15+ return this . filePath ;
16+ }
17+
18+ public getName ( ) : string {
19+ const packageJson : any = JSON . parse ( File . readFileSync ( this . filePath , "utf-8" ) ) ;
20+
21+ return packageJson . name ;
22+ }
23+
24+ public getVersion ( ) : string {
25+ const packageJson : any = JSON . parse ( File . readFileSync ( this . filePath , "utf-8" ) ) ;
26+
27+ return packageJson . version ;
28+ }
29+
30+ public getMainEntry ( ) : string {
31+ const packageJson : any = JSON . parse ( File . readFileSync ( this . filePath , "utf-8" ) ) ;
32+
33+ return packageJson . main ;
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ export interface Project {
2+ getPath ( ) : string ;
3+ }
You can’t perform that action at this time.
0 commit comments