File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 6
6
"bin" : {
7
7
"smodg" : " ./index.js"
8
8
},
9
+ "exports" : {
10
+ "./package.json" : " ./package.json"
11
+ },
9
12
"scripts" : {
10
13
"test" : " jest" ,
11
14
"test:watch" : " jest --watch" ,
Original file line number Diff line number Diff line change 2
2
3
3
import fs from 'node:fs'
4
4
import minimist from 'minimist' ;
5
+ import path from 'path' ;
5
6
import { generateModelInputs } from './parser' ;
6
7
import { modelTemplate , migrationTemplate } from './templates' ;
7
8
import { kebabCase } from './formatters' ;
8
9
9
- const version = require ( '../package.json' ) . version
10
+ let packageJsonPath : string ;
11
+
12
+ if ( process . env . NODE_ENV === 'development' || process . env . NODE_ENV === 'test' ) {
13
+ packageJsonPath = path . resolve ( __dirname , '..' , 'package.json' ) ;
14
+ } else {
15
+ packageJsonPath = path . resolve ( __dirname , 'package.json' ) ;
16
+ }
17
+
18
+ const version = require ( packageJsonPath ) . version
10
19
11
20
export const main = ( args : minimist . ParsedArgs ) => {
12
21
You can’t perform that action at this time.
0 commit comments