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

使用Action保证代码格式 #159

Merged
merged 5 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
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
26 changes: 7 additions & 19 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Checkout To Pull Request
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr checkout ${{ github.event.pull_request.number }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand All @@ -30,20 +24,14 @@ jobs:
- name: 📦 Install Dependencies
run: yarn

- name: 🧐 Check Code
- name: 🧐 Check Code Types
run: yarn docs:tsc

- name: 🔧 Check Code Format
run: |
yarn docs:lint && exit 0
echo "请执行 `pnpm run docs:format` 以格式化代码"
exit 1

- name: 🌌 Build VitePress Docs
run: yarn docs:build

- name: 🔧 Format Code
run: yarn docs:format

- name: Push Formatted Code
run: |
git config user.name github-actions
git config user.email github-actions[bot]@users.noreply.github.com
git config push.default upstream
git add .
git commit -m "🔧 Formatted Code" || exit 0
git push || echo "Warn: cannot push the formatted code"
15 changes: 8 additions & 7 deletions docs/.vitepress/analyzers/mcla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ class MCLAWorker implements MCLAAPI {
const re = this.pendings.get(data._id)
if (re) {
this.pendings.delete(data._id)
if(data._error){
if (data._error) {
re[1](data._error)
}else{
} else {
re[0](data)
}
}
Expand All @@ -183,19 +183,19 @@ class MCLAWorker implements MCLAAPI {
case "string":
case "undefined":
return res
case "object":
case "object": {
if (res === null) {
return res
}
if (res instanceof Array) {
let obj = new Array(res.length)
const obj = new Array(res.length)
for (let i = 0; i < res.length; i++) {
obj[i] = this.unwrapObj(res[i])
}
return obj
}
if (res.__worker_function) {
let fn = async (...args): Promise<any> => {
const fn = async (...args): Promise<any> => {
return (
await this.ask({
type: "callObj",
Expand All @@ -207,11 +207,12 @@ class MCLAWorker implements MCLAAPI {
this.registry.register(fn, res.ptr)
return fn
}
let obj = new Object()
for (let k of Reflect.ownKeys(res)) {
const obj = new Object()
for (const k of Reflect.ownKeys(res)) {
obj[k] = this.unwrapObj(res[k])
}
return obj
}
}
throw new Error("Unexpected type of res: " + typeof res)
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"dependencies": {
"@gera2ld/tarjs": "^0.2.2",
"@types/umami": "^0.1.2",
"@typescript-eslint/parser": "^6.7.3",
"axios": "^1.4.0",
"directory-tree": "^3.5.1",
"jszip": "^3.10.1",
Expand Down
Loading