Skip to content

Commit 4591485

Browse files
authored
fix: specify es-cookie version for deno (#46)
1 parent 4be2c4c commit 4591485

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/deno.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { promises as fs } from 'node:fs'
22
import { resolve } from 'node:path'
33
import { fileURLToPath } from 'node:url'
44
import { isExists } from './utils.ts'
5+
import { readPackageJSON } from 'pkg-types'
56

67
const __dirname = fileURLToPath(new URL('.', import.meta.url))
78

@@ -39,9 +40,15 @@ async function main() {
3940
console.log(`${resolve(sourcePath, target)} -> ${resolve(destPath, target)}`)
4041
}
4142

43+
const pkgJSON = await readPackageJSON(projectPath)
44+
const devDependencies = pkgJSON.devDependencies || {}
45+
4246
// add `npm:` prefix
4347
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+
)
4552
await fs.writeFile(resolve(destPath, 'web.ts'), replacedWebCode, 'utf8')
4653

4754
console.log('... 🦕 done!')

0 commit comments

Comments
 (0)