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 7c3e039 commit bf41b7c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release-deno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'


- name: Install and Update ./src/*.ts for deno
run: npm install && node scripts/replace-files-for-deno.mjs

- name: Move files to ./deno folder
run: cp ./deno/deno.json README.md Mock-plugin.md CHANGELOG.md ./src/ && rm -f package.json

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"promise-polyfill": "^8.3.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"change-case": "^5.4.4"
"change-case": "^5.4.4",
"fast-glob": "^3.3.2"
},
"prettier": {
"printWidth": 100,
Expand Down
25 changes: 14 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions scripts/replace-files-for-deno.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import glob from 'fast-glob';
import fs from 'fs/promises';

async function start() {
const files = await glob(['./src/*.ts']);
const pluginFiles = await glob(['./src/plugins/*.ts']);

await Promise.all(
files.map((item) => {
const content = fs.readFile(item, 'utf8');
return fs.writeFile(item, content.replace(/'xior\/utils'/g, "'./utils'"));
})
);

await Promise.all(
pluginFiles.map((item) => {
const content = fs.readFile(item, 'utf8');
return fs.writeFile(item, content.replace(/'xior\/utils'/g, "'../utils'"));
})
);
}

start();

0 comments on commit bf41b7c

Please sign in to comment.