From 9d6ed42b65b9ebee848c5f5b00641bb300a5cdd9 Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Sat, 2 Mar 2024 19:28:03 +0900 Subject: [PATCH] fix: specify es-cookie version for deno --- scripts/deno.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/deno.ts b/scripts/deno.ts index 63674d5..91f4866 100644 --- a/scripts/deno.ts +++ b/scripts/deno.ts @@ -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)) @@ -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!')