From 93be1c4ea31be5f2db07263235c1efa31fd84f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= Date: Thu, 31 Aug 2023 12:27:09 +0800 Subject: [PATCH 1/5] fix: github action close issue --- .github/workflows/close-issue.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/close-issue.yml diff --git a/.github/workflows/close-issue.yml b/.github/workflows/close-issue.yml new file mode 100644 index 0000000..0ae3362 --- /dev/null +++ b/.github/workflows/close-issue.yml @@ -0,0 +1,22 @@ +name: Close inactive issues +on: + schedule: + - cron: '30 1 * * *' + +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v5 + with: + days-before-issue-stale: 30 + days-before-issue-close: 14 + stale-issue-label: 'stale' + stale-issue-message: 'This issue is stale because it has been open for 30 days with no activity.' + close-issue-message: 'This issue was closed because it has been inactive for 14 days since being marked as stale.' + days-before-pr-stale: -1 + days-before-pr-close: -1 + repo-token: ${{ secrets.GITHUB_TOKEN }} From 7b4785760d9f2c236486f8a10ee92bcef8c53b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= Date: Fri, 1 Sep 2023 11:38:55 +0800 Subject: [PATCH 2/5] fix: #17 --- package.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index df8e158..4bc795b 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "@wtto00/jweixin-esm", - "version": "1.6.0-3", + "version": "1.6.0-4", "description": "微信JSSDK ESM模块 附带TS类型以及详细注释", "type": "module", - "exports": "./lib/jweixin-1.6.0.esm.js", + "module": "./lib/jweixin-1.6.0.esm.js", "types": "lib/index.d.ts", "files": [ "lib" @@ -34,5 +34,11 @@ "bugs": { "url": "https://github.com/wtto00/jweixin-esm/issues" }, - "homepage": "https://github.com/wtto00/jweixin-esm#readme" + "homepage": "https://github.com/wtto00/jweixin-esm#readme", + "scripts": { + "test": "tsc --traceResolution ./lib/index.d.ts" + }, + "devDependencies": { + "typescript": "^5.2.2" + } } From 389cc11d3e49186c32317883843e5f26897ef366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= Date: Fri, 1 Sep 2023 11:39:24 +0800 Subject: [PATCH 3/5] chore: check types & github action --- .github/workflows/check.yml | 41 +++++++++++++++++++ .../workflows/npm-publish-github-packages.yml | 3 +- jsconfig.json | 2 +- lib/index.d.ts | 6 +-- pnpm-lock.yaml | 18 ++++++++ 5 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/check.yml create mode 100644 pnpm-lock.yaml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..e6599c7 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,41 @@ +name: Check Test + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + type-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: 7 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + - name: Run Test + run: pnpm test diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml index 65aa544..be10f57 100644 --- a/.github/workflows/npm-publish-github-packages.yml +++ b/.github/workflows/npm-publish-github-packages.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest name: Version Check steps: - - uses: actions/checkout@v2.4.2 + - uses: actions/checkout@v3 # 检查npm包的版本号和本地packages.json的版本号是否重复 # https://github.com/marketplace/actions/version-check - id: cpv @@ -72,3 +72,4 @@ jobs: - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + NPM_CONFIG_PROVENANCE: true diff --git a/jsconfig.json b/jsconfig.json index 7da90e4..61cba29 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "esnext", "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "nodenext", "allowSyntheticDefaultImports": true, "jsx": "preserve", "checkJs": true, diff --git a/lib/index.d.ts b/lib/index.d.ts index 40a2fae..bd27e21 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -141,7 +141,7 @@ declare module WX { * 用户取消时:"xxx:cancel",其中xxx为调用的接口名 * 调用失败时:其值为具体错误信息 */ - type CommonApiOptionsCallbackParams = { + type CommonApiOptionsCallbackParams = { [key: string]: any errMsg: string } & T @@ -150,7 +150,7 @@ declare module WX { * T: success回调函数的参数 * D: complete回调函数的参数 */ - interface CommonApiOptions { + interface CommonApiOptions { /** * 接口调用成功时执行的回调函数。 */ @@ -710,7 +710,7 @@ declare module WX { /** * 小程序路由跳转参数 */ - interface MPRouterOptions extends CommonApiOptions { + interface MPRouterOptions extends CommonApiOptions { /** * 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。 * 参数与路径之间使用 ? 分隔,参数键与参数值用 = 相连,不同参数用 & 分隔; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..a5a737e --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,18 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +devDependencies: + typescript: + specifier: ^5.2.2 + version: 5.2.2 + +packages: + + /typescript@5.2.2: + resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} + engines: {node: '>=14.17'} + hasBin: true + dev: true From b83aca2242e2c6c06e9f1503d0e6ed162810d81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= Date: Fri, 1 Sep 2023 11:45:44 +0800 Subject: [PATCH 4/5] chore: ci --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e6599c7..a08981d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,7 +19,6 @@ jobs: - uses: pnpm/action-setup@v2 name: Install pnpm with: - version: 7 run_install: false - name: Get pnpm store directory @@ -37,5 +36,6 @@ jobs: - name: Install dependencies run: pnpm install + - name: Run Test run: pnpm test From 1868566fee0cd409f4b6999a00e20a89efd99665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AE=80=E9=9D=99=E5=87=A1?= Date: Fri, 1 Sep 2023 11:47:16 +0800 Subject: [PATCH 5/5] chore: ci --- .github/workflows/check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a08981d..74869af 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,6 +19,7 @@ jobs: - uses: pnpm/action-setup@v2 name: Install pnpm with: + version: 8 run_install: false - name: Get pnpm store directory