Skip to content

Commit

Permalink
fix: specify es-cookie version for deno
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Mar 2, 2024
1 parent 4be2c4c commit 9d6ed42
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { promises as fs } from 'node:fs'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { isExists } from './utils.ts'
import { readPackageJSON } from 'pkg-types'

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

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

const pkgJSON = await readPackageJSON(projectPath)
const devDependencies = pkgJSON.devDependencies || {}

// add `npm:` prefix
const webCode = await fs.readFile(resolve(destPath, 'web.ts'), 'utf-8')
const replacedWebCode = webCode.replace("from 'cookie-es'", "from 'npm:cookie-es'")
const replacedWebCode = webCode.replace(
"from 'cookie-es'",
`from 'npm:cookie-es@${devDependencies['cookie-es']}'`,
)
await fs.writeFile(resolve(destPath, 'web.ts'), replacedWebCode, 'utf8')

console.log('... 🦕 done!')
Expand Down

0 comments on commit 9d6ed42

Please sign in to comment.