Skip to content

Commit

Permalink
Merge pull request #1 from yymzy/yym-3.x-swipe-action
Browse files Browse the repository at this point in the history
Yym 3.x swipe action
  • Loading branch information
yymzy authored Aug 15, 2024
2 parents e4be91d + 6e78309 commit 2ecf3bb
Show file tree
Hide file tree
Showing 192 changed files with 53,361 additions and 1,047 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ test/__mock__/
git_stats/
yarn-offline/
docs/
examples/
35 changes: 29 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
{
"files": [
"packages/**/*.ts",
"packages/**/*.tsx"
"packages/**/*.tsx",
"packages/**/*.d.ts"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
Expand Down Expand Up @@ -39,6 +40,7 @@
"@typescript-eslint/member-delimiter-style": [
"off"
],
"import/no-named-as-default": "off",
"class-methods-use-this": "off",
"prefer-rest-params": "off",
"react/jsx-filename-extension": [
Expand All @@ -52,12 +54,14 @@
]
}
],
"no-unused-vars": [
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"varsIgnorePattern": "React"
}
],
"@typescript-eslint/no-empty-interface": "off",
"no-console": [
"error",
{
Expand All @@ -74,11 +78,26 @@
"^UNSAFE_"
]
}
]
],
"@typescript-eslint/ban-ts-comment": "off"
},
"settings": {
"import/ignore": [
"react-native"
],
"react": {
"version": "detect"
},
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx",
".ts",
".tsx",
".d.ts"
]
}
}
}
},
Expand All @@ -87,7 +106,7 @@
"packages/**/*.js",
"packages/**/*.jsx"
],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 2017,
"ecmaFeatures": {
Expand Down Expand Up @@ -176,7 +195,9 @@
{
"files": [
"packages/taro-ui-demo/**/*.ts",
"packages/taro-ui-demo/**/*.tsx"
"packages/taro-ui-demo/**/*.tsx",
"packages/taro-ui-demo-rn/**/*.ts",
"packages/taro-ui-demo-rn/**/*.tsx"
],
"extends": [
"taro/react"
Expand All @@ -185,7 +206,9 @@
{
"files": [
"packages/taro-ui-demo/config/*.js",
"packages/taro-ui-demo/babel.config.js"
"packages/taro-ui-demo/babel.config.js",
"packages/taro-ui-demo-rn/**/*.ts",
"packages/taro-ui-demo-rn/**/*.tsx"
],
"rules": {
"import/no-commonjs": "off"
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Issues 是用来提交 Bug 或 Feature 相关的内容,一个 Bug Issue 应该

## 开发环境

请确保您的 Node 版本是 8.0+,并且 Taro 升级到最新版
请确保您的 Node 版本是 16.x,并且 Taro 升级到最新版

```bash
git clone [email protected]:NervJS/taro-ui.git
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/deploy-tcb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish root to TCB
on:
check_suite:
types: [completed]
push:
branches:
- next
schedule:
- cron: "0 21 * * *"

env:
CI: true
jobs:
publish:
name: Publish Docs to TCB
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- run: pnpm start

- name: Build taro-ui
run: pnpm run build:ui

- name: Build taro-ui-docs
run: pnpm run build:doc

- name: Deploy static to Tencent CloudBase
id: deployStatic
uses: TencentCloudBase/[email protected]
with:
secretId: ${{ secrets.TCB_SECRET_ID }}
secretKey: ${{ secrets.TCB_SECRET_KEY }}
envId: ${{ secrets.TCB_TARO_UI_ENV_ID }}
staticSrcPath: packages/taro-ui-docs/dist
44 changes: 44 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Node CI

on:
push:
branches:
- next
- feat/**
pull_request:
branches:
- next

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- run: pnpm start

- name: build
run: pnpm build

- name: build
run: pnpm build:demo
183 changes: 183 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: publish
on:
# When Release Pull Request is merged
push:
branches:
- 'chore/**'
- 'feat/**'
pull_request:
branches:
- next
types: [closed]

env:
CI: true
permissions: {}
jobs:
publish:
permissions:
contents: write # to create tags and refs
actions: write # to cancel running workflow (andymckay/cancel-action)
issues: write # to create comment
pull-requests: write # to create comment and so on

name: publish
runs-on: ubuntu-latest
steps:
# Setup
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: Git Identity
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Log meta
- name : GITHUB CONTEXT
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"

# Get commit message
- name: Get commit message
run: |
COMMIT_MESSAGE=$(git log --format=%s -n 1)
echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
- name: Show commit message
run : echo "$COMMIT_MESSAGE"

- name: Commit message compliance verification
if: startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) != true
uses: andymckay/[email protected]

- name: Publish push tag verification
if: github.event_name == 'push' && contains( env.COMMIT_MESSAGE , '--tag=' ) != true
uses: andymckay/[email protected]

# Get & check npm publish
- name: Get publish params
if: github.event_name == 'push'
run: |
PUBLISH_PARAMS=`echo $COMMIT_MESSAGE | grep -oE "^chore\(release\): publish \S*\s(.*)" | cut -d " " -f 4-`
echo "PUBLISH_PARAMS=${PUBLISH_PARAMS}" >> $GITHUB_ENV
- name: Show publish params
if: github.event_name == 'push'
run: echo "Publish pushing provide parameter [$PUBLISH_PARAMS]."

# Define ${CURRENT_VERSION}
- name: Set Current Version
if: startsWith( env.COMMIT_MESSAGE , 'chore(release):' )
shell: bash -ex {0}
run: |
CURRENT_VERSION=$(node -p 'require("./packages/taro-ui/package.json").version')
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
# Check git tag
- name: Tag Check
if: startsWith( env.COMMIT_MESSAGE , 'chore(release):' )
id: tag_check
shell: bash -ex {0}
run: |
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${CURRENT_VERSION}"
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
-H "Authorization: token ${GITHUB_TOKEN}")
if [ "$http_status_code" -ne "404" ] ; then
echo "::set-output name=exists_tag::true"
else
echo "::set-output name=exists_tag::false"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# ------------------ If git tag already exists, skip -------------

- name: Git tag verification
if: steps.tag_check.outputs.exists_tag == false
uses: andymckay/[email protected]

# Bootstrap project
- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: install
uses: pnpm/[email protected]
with:
version: 8
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: build
run: |
pnpm build
# Git stash
- name: Drop current changes
if: startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: |
git add .
git stash
# Create git tag
- name: Create Git Tag
if: startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
uses: azu/action-package-version-to-git-tag@v1
with:
version: ${{ env.CURRENT_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_repo: ${{ github.repository }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: "v"

# Publish
- name: Publish
run: |
if [ '${{ github.event_name }}' == 'pull_request' ] ; then
cd README.md packages/taro-ui & pnpm publish --registry=https://registry.npmjs.org/ --publish-branch=${{ github.ref }} -r
elif [ '${{ github.event_name }}' == 'push' ] ; then
cd README.md packages/taro-ui & pnpm publish --registry=https://registry.npmjs.org/ --publish-branch=${{ github.ref_name }} -r ${{ env.PUBLISH_PARAMS }}
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# Create relase when event is PR
- name: Create Release
id: create_release
if: startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.CURRENT_VERSION }}
# Copy Pull Request's tile and body to Release Note
release_name: ${{ github.event.pull_request.title }}
body: |
${{ github.event.pull_request.body }}
draft: false
prerelease: false

# Create PR page comment when event is PR
- uses: actions/github-script@v6
if: github.event.pull_request.merged == true
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'https://github.com/${{ github.repository }}/releases/tag/v${{ env.CURRENT_VERSION }} is released 🎉'
})
Loading

0 comments on commit 2ecf3bb

Please sign in to comment.