From 7106d177a9a72c64a9bf40a135985d186c1b97e6 Mon Sep 17 00:00:00 2001 From: suhaotian Date: Fri, 15 Nov 2024 14:13:54 +1100 Subject: [PATCH] fix --- scripts/replace-files-for-deno.mjs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/replace-files-for-deno.mjs b/scripts/replace-files-for-deno.mjs index 209c7ef..b404213 100644 --- a/scripts/replace-files-for-deno.mjs +++ b/scripts/replace-files-for-deno.mjs @@ -7,15 +7,23 @@ async function start() { await Promise.all( files.map(async (item) => { - const content = await fs.readFile(item, 'utf8'); - return fs.writeFile(item, content.replace(/'xior\/utils'/g, "'./utils'")); + let content = await fs.readFile(item, 'utf8'); + content = content.replace(/'xior\/utils'/g, "'./utils'"); + content = content.replace(/from '\.(.*)';/g, (a, b, c) => { + return "from '." + b + ".ts';"; + }); + return fs.writeFile(item, content); }) ); await Promise.all( pluginFiles.map(async (item) => { - const content = await fs.readFile(item, 'utf8'); - return fs.writeFile(item, content.replace(/'xior\/utils'/g, "'../utils'")); + let content = await fs.readFile(item, 'utf8'); + content = content.replace(/'xior\/utils'/g, "'../utils'"); + content = content.replace(/from '\.(.*)';/g, (a, b, c) => { + return "from '." + b + ".ts';"; + }); + return fs.writeFile(item, content); }) ); }