Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: specify es-cookie version for deno #46

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading