Skip to content

Commit

Permalink
Merge branch 'NervJS:next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
P4X666 authored Aug 7, 2022
2 parents 996fa71 + ef6016c commit 7e0fd67
Show file tree
Hide file tree
Showing 488 changed files with 64,399 additions and 12,410 deletions.
10 changes: 8 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,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 Down Expand Up @@ -77,6 +78,7 @@
]
},
"settings": {
"import/ignore": ["react-native"],
"react": {
"version": "detect"
}
Expand Down Expand Up @@ -176,7 +178,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 +189,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
130 changes: 130 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: publish
on:
# When Release Pull Request is merged
push:
branches:
- next
pull_request:
branches:
- next
types: [closed]

env:
CI: true
jobs:
publish:
name: publish
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [14.x]

steps:
# Setup
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: 14
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=%B -n 1)
echo "commitmsg=${COMMIT_MESSAGE}" >> $GITHUB_ENV
- name: Show commit message
run : echo "$commitmsg"

# Define ${CURRENT_VERSION}
- name: Set Current Version
if: startsWith( env.commitmsg , 'chore(release):' )
shell: bash -ex {0}
run: |
CURRENT_VERSION=$(node -p 'require("./lerna.json").version')
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
# Check git tag
- name: Tag Check
if: startsWith( env.commitmsg , '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 }}

# Bootstrap project
- name: install
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: yarn
- name: bootstrap
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: yarn run bootstrap
- name: build
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: yarn build

# Git stash
- name: Drop current changes
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: |
git add .
git stash
# Create git tag
- name: Create Git Tag
if: startsWith( env.commitmsg , '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: npm publish
if: steps.tag_check.outputs.exists_tag == 'false' && startsWith( env.commitmsg , 'chore(release):' )
run: yarn lerna publish from-package --yes
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.commitmsg , '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
50 changes: 50 additions & 0 deletions .github/workflows/rn-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
push:
tags: [ v* ]
workflow_dispatch:

jobs:
taro_release_job:
runs-on: ubuntu-latest
name: Taro Bundle Release
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Cache node_modules Folder
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: |
yarn
- name: Lerna Bootstrap
run: |
yarn bootstrap
- name: Release Taro React Native bundle
uses: zhiqingchen/taro-react-native-release@v1
with:
workingdirectory: ./packages/taro-ui-demo-rn
token: ${{ secrets.GITHUB_TOKEN }}
appname: Taro-UI-Demo
logo: https://pic5.58cdn.com.cn/nowater/fangfe/n_v25a185c1657984016926f26af591912c4.jpg
- name: Upload Qr Image
uses: actions/upload-artifact@v2
with:
name: bundle-qr-code
path: |
packages/taro-ui-demo-rn/release/qrcode/ios.png
packages/taro-ui-demo-rn/release/qrcode/android.png
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ stats.html

# Test files
coverage

# taro rn release
!packages/taro-ui-demo-rn/release/**
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
## 特性

- 基于 `Taro` 开发 UI 组件
- 一套组件可以在 `微信小程序``支付宝小程序``百度小程序``H5` 多端适配运行(`ReactNative` 端暂不支持)
- 提供友好的 API,可灵活的使用组件
- 一套组件可以在 `微信小程序``支付宝小程序``百度小程序``H5``ReactNative` 多端适配运行
- 提供友好的 API,可灵活的使用组件

## 关于 Taro

Expand Down
41 changes: 41 additions & 0 deletions RN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Taro UI For RN


### 开发


####
注意 React Native 版本需要保持一致
##### 自定义安装壳子
下载官方壳应用(NervJS/taro-native-shell)[https://github.com/NervJS/taro-native-shell] 选择与 taro-ui react-native 版本一致的分支

##### 使用发布商店 App 壳子
<img src="https://tva1.sinaimg.cn/large/008i3skNgy1gvzhk2732kj30fu0u0aax.jpg" width="300px" />

```
# 组件库与 demo 连接,lerna 对 packages 进行 symlink
lerna bootstrap
```

#### 组件开发
```
cd packages/taro-ui/rn
```

#### 发布
rn 源码发布

#### DEMO 启动
```
cd packages/taro-ui-demo-rn
yarn dev:rn
```
demo 适配开发,更改组件 style 样式,需要更改一下 packages/taro-ui-demo-rn/src/app.scss 触发一下样式重编。

#### DEMO release
需要打一个 tag,比如:
```sh
git tag -a 'v3.1.0-beta.3-rn' -m 'rn qrcode for v3.1.0-beta.3'
git push origin v3.1.0-beta.3-rn
```
git ci 部署,最后生成 release 信息
9 changes: 5 additions & 4 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"packages": [
"packages/taro-ui"
"packages/taro-ui",
"packages/taro-ui-demo",
"packages/taro-ui-demo-rn"
],
"command": {
"publish": {
Expand All @@ -11,7 +13,6 @@
"license": "MIT"
}
},
"version": "3.0.0-alpha.10",
"npmClient": "yarn",
"useWorkspaces": true
"version": "3.1.0-beta.3",
"npmClient": "yarn"
}
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
"url": "git@github.com:nervjs/taro-ui.git"
},
"license": "MIT",
"workspaces": {
"packages": [
"packages/*"
]
},
"scripts": {
"bootstrap": "lerna bootstrap",
"build": "lerna run build",
Expand All @@ -25,6 +20,7 @@
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"eslint-config-taro": "~3.0.2",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"conventional-changelog-cli": "^2.0.31",
Expand Down
8 changes: 8 additions & 0 deletions packages/taro-ui-demo-rn/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 3.0.1 (2020-04-18)

**Note:** Version bump only for package taro-ui-demo
13 changes: 13 additions & 0 deletions packages/taro-ui-demo-rn/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
[
'taro',
{
framework: 'react',
ts: true
}
]
]
}
8 changes: 8 additions & 0 deletions packages/taro-ui-demo-rn/config/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {},
weapp: {},
h5: {}
}
Loading

0 comments on commit 7e0fd67

Please sign in to comment.