File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 1- import pkgJson from '../package.json' assert { type : 'json ' }
21import { createRequire } from 'node:module' ;
3- import path from 'node:path' ;
2+ import { dirname , join , resolve } from 'node:path' ;
3+ import { readFileSync } from 'node:fs' ;
4+ import { fileURLToPath } from 'node:url' ;
5+
6+ const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
7+ const pkgJson = JSON . parse ( readFileSync ( join ( __dirname , '..' , 'package.json' ) , 'utf8' ) ) ;
48
59const packages = {
610 '0http' : { hasRouter : true , package : '0http' } ,
@@ -39,7 +43,7 @@ const _choices = []
3943Object . keys ( packages ) . forEach ( pkg => {
4044 if ( ! packages [ pkg ] . version ) {
4145 const module = pkgJson . dependencies [ pkg ] ? pkg : packages [ pkg ] . package
42- const version = require ( path . resolve ( `node_modules/${ module } /package.json` ) ) . version
46+ const version = require ( resolve ( `node_modules/${ module } /package.json` ) ) . version
4347 packages [ pkg ] . version = version
4448 }
4549 _choices . push ( pkg )
You can’t perform that action at this time.
0 commit comments