Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
suhaotian committed Nov 15, 2024
1 parent 683df7b commit e7d7f96
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/replace-files-for-deno.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import fs from 'fs/promises';
async function start() {
const files = await glob(['./src/*.ts']);
const pluginFiles = await glob(['./src/plugins/*.ts']);
const nestedPluginFiles = await glob(['./src/plugins/**/*.ts']);

await Promise.all(
files.map(async (item) => {
Expand All @@ -26,6 +27,18 @@ async function start() {
return fs.writeFile(item, content);
})
);

await Promise.all(
nestedPluginFiles.map(async (item) => {
if (pluginFiles.includes(item)) return;
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);
})
);
}

start();

0 comments on commit e7d7f96

Please sign in to comment.