File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { promises as fs } from 'node:fs'
2
2
import { resolve } from 'node:path'
3
3
import { fileURLToPath } from 'node:url'
4
4
import { isExists } from './utils.ts'
5
+ import { readPackageJSON } from 'pkg-types'
5
6
6
7
const __dirname = fileURLToPath ( new URL ( '.' , import . meta. url ) )
7
8
@@ -39,9 +40,15 @@ async function main() {
39
40
console . log ( `${ resolve ( sourcePath , target ) } -> ${ resolve ( destPath , target ) } ` )
40
41
}
41
42
43
+ const pkgJSON = await readPackageJSON ( projectPath )
44
+ const devDependencies = pkgJSON . devDependencies || { }
45
+
42
46
// add `npm:` prefix
43
47
const webCode = await fs . readFile ( resolve ( destPath , 'web.ts' ) , 'utf-8' )
44
- const replacedWebCode = webCode . replace ( "from 'cookie-es'" , "from 'npm:cookie-es'" )
48
+ const replacedWebCode = webCode . replace (
49
+ "from 'cookie-es'" ,
50
+ `from 'npm:cookie-es@${ devDependencies [ 'cookie-es' ] } '` ,
51
+ )
45
52
await fs . writeFile ( resolve ( destPath , 'web.ts' ) , replacedWebCode , 'utf8' )
46
53
47
54
console . log ( '... 🦕 done!' )
You can’t perform that action at this time.
0 commit comments