Skip to content

Commit

Permalink
version 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wtto00 committed Mar 23, 2023
1 parent 7f482e3 commit fdb23f1
Show file tree
Hide file tree
Showing 10 changed files with 1,642 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name-template: 'v$RESOLVED_VERSION 🌈'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
label: 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## 更新
$CHANGES
30 changes: 30 additions & 0 deletions .github/workflows/npm-package-version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Package Version Check

on:
pull_request:
branches:
- main

jobs:
version-check:
runs-on: ubuntu-latest
name: Version Check
steps:
- uses: actions/[email protected]
# 检查npm包的版本号和本地packages.json的版本号是否重复
# https://github.com/marketplace/actions/version-check
- id: cpv
uses: PostHog/check-package-version@v2

- name: cpv false output
if: steps.cpv.outputs.is-new-version == 'false' || steps.cpv.outputs.committed-version < steps.cpv.outputs.published-version
run: |
echo "Committed version: ${{ steps.cpv.outputs.committed-version }}"
echo "Published version: ${{ steps.cpv.outputs.published-version }}"
echo "Is new version: ${{ steps.cpv.outputs.is-new-version }}"
exit 1
- name: cpv output
if: steps.cpv.outputs.is-new-version == 'true'
run: |
echo "Committed version: ${{ steps.cpv.outputs.committed-version }}"
echo "Published version: ${{ steps.cpv.outputs.published-version }}"
53 changes: 53 additions & 0 deletions .github/workflows/npm-publish-github-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [published]

jobs:
publish-gpr:
runs-on: ubuntu-latest
name: Publish Github Package
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.release.target_commitish }}
- uses: pnpm/[email protected]
with:
version: latest
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
registry-url: https://npm.pkg.github.com/
- run: npm pkg set publishConfig.registry=https://npm.pkg.github.com
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

public-npm:
runs-on: ubuntu-latest
name: Publish Npm Package
steps:
- uses: actions/[email protected]
with:
ref: ${{ github.event.release.target_commitish }}
- uses: pnpm/[email protected]
with:
version: latest
- uses: actions/[email protected]
with:
node-version: 16
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- run: git config --global user.name "GitHub CD bot"
- run: git config --global user.email "[email protected]"
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "always",
"semi": false
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# jweixin-module
微信jssdk 附带ts类型
# jweixin-esm

微信 JSSDK, ESM 模块, 附带 TS 类型以及详细注释

![官方版本:1.6.0](https://img.shields.io/badge/官方版本-1.6.0-blue?style=flat-square&logo=Tencent%20QQ) ![Types](https://img.shields.io/badge/Types-TypeScript-blue?style=flat-square&logo=TypeScript&&labelColor=success) ![PR:WELCOME](https://img.shields.io/badge/PR-WELCOME-blue?style=flat-square) ![ISSUE:WELCOME](https://img.shields.io/badge/ISSUE-WELCOME-blue?style=flat-square)

## Install

```shell
pnpm add jweixin-esm
# npm i jweixin-esm
# yarn add jweixin-esm
```

## Useage

```typescript
import weixin from 'jweixin-esm'
// or:
// import 'jweixin-esm'

// weixin的类型是WX,已全局声明

console.log(weixin) // 导入的名称
console.log(window.wx) // wx已全局暴露
console.log(window.jWeixin) // jWeixin已全局暴露

// 这里 weixin=window.wx=window.jWeixin
// 所有的类型全部在WX中,可以直接使用,不用额外导入或配置。已全局声明。

const configData: WX.ConfigOptions = {
debug: true,
appId: '',
timestamp: '',
nonceStr: '',
signature: '',
jsApiList: [] // WX.JsApi[]
}
weixin.config(configData)
```

## About

基于微信官方的 JSSDK [jweixin-1.6.0.js](http://res.wx.qq.com/open/js/jweixin-1.6.0.js) 改造。[官方文档](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html)
11 changes: 11 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"checkJs": true,
"lib": ["DOM", "ESNext"]
}
}
Loading

0 comments on commit fdb23f1

Please sign in to comment.