Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jdf2e/nutui-react
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.7.10
Choose a base ref
...
head repository: jdf2e/nutui-react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.0
Choose a head ref
Loading
Showing 1,752 changed files with 60,211 additions and 36,020 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .env
VITE_RTL=ltr
7 changes: 5 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
src/sites
src/packages/nutui.react.build.rn.ts
scripts
site_docs
coverage
@@ -10,12 +11,14 @@ iconfont.js
.vscode
**/nutui.react.build.ts
**/nutui.react.scss.ts
**/nutui.react.taro.scss.ts
**/nutui.react.scss.taro.ts
**/nutui.react.taro.ts
**/nutui.react.ts
**/nutui.taro.react.build.ts
**/nutui.react.build.taro.ts
**/app.config.ts
packages/nutui-taro-demo/**/*
packages/nutui-harmony/**/*
packages/nutui-jdharmony/**/*
packages/nutui-templates/**/*
packages/nutui-codemod/test/*
packages/nutui-codemod/transforms/__test__/*
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
33 changes: 33 additions & 0 deletions .github/workflows/add-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Add Label

on:
pull_request_target:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
add-label:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Determine label based on target branch
id: determine-label
run: |
echo "${{github.event_name}}"
if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then
echo "label=2.x" >> $GITHUB_ENV
elif [[ "${{ github.event.pull_request.base.ref }}" == "feat_v3.x" ]]; then
echo "label=3.x" >> $GITHUB_ENV
else
echo "label=" >> $GITHUB_ENV
fi
- name: Add label to Pull Request
if: env.label != ''
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ env.label }}
95 changes: 47 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -4,82 +4,81 @@ on:
push:
branches:
- next

- feat_v3.x
pull_request:
branches:
- next

types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Install pnpm
run: corepack enable pnpm
- name: Install pnpm
run: npm i -g pnpm@10

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
- name: Install dependencies
run: pnpm install

- name: Run linter
run: npm run lint
- name: Run linter
run: npm run lint

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Install pnpm
run: corepack enable pnpm
- name: Install pnpm
run: npm i -g pnpm@10

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
- name: Install dependencies
run: pnpm install

- name: Run test
run: npm run test
- name: Run test
run: npm run test

- name: Upload coverage reports to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage reports to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Install pnpm
run: corepack enable pnpm
- name: Install pnpm
run: npm i -g pnpm@10

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install
- name: Install dependencies
run: pnpm install

- name: Build NutUI-React
run: npm run build
- name: Build NutUI-React
run: npm run build

- name: Build NutUI-React-Taro
run: npm run build:taro
- name: Build NutUI-React-Taro
run: npm run build:taro

- name: Build NutUI-React Demo
run: npm run build:site
- name: Build NutUI-React Demo
run: npm run build:site

- name: Build NutUI-React Taro H5 Demo
run: npm run build:taro:site
- name: Build NutUI-React Taro H5 Demo
if: github.ref == 'refs/heads/next'
run: npm run build:taro:site
35 changes: 35 additions & 0 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: E2E Tests

on:
push:
branches:
- feat_v3.x
pull_request:
branches:
- feat_v3.x

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install pnpm
run: npm i -g pnpm@10

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run E2E Tests for H5
env:
CI: true
run: pnpm cypress install --force && pnpm e2e:run:h5

- name: Run E2E Tests for Taro
env:
CI: true
run: pnpm cypress install --force && pnpm e2e:run:taro
80 changes: 80 additions & 0 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: PR Review Labels

on:
schedule:
- cron: '0 */3 * * *'

pull_request_target:
types:
- opened
- reopened
- synchronize

permissions:
pull-requests: write
issues: write

jobs:
update-labels:
runs-on: ubuntu-latest
steps:
- name: Update PR labels
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
const { owner, repo } = context.repo;
// 获取所有开放的 PRs
const { data: prs } = await github.rest.pulls.list({
owner,
repo,
state: 'open'
});
for (const pr of prs) {
// 获取 PR 的所有 reviews
const { data: reviews } = await github.rest.pulls.listReviews({
owner,
repo,
pull_number: pr.number
});
// 计算最新的 approved 数量
const latestReviews = new Map();
reviews.forEach(review => {
latestReviews.set(review.user.id, review);
});
const approvedCount = Array.from(latestReviews.values())
.filter(review => review.state === 'APPROVED')
.length;
console.log(`PR #${pr.number} - Approved count:`, approvedCount);
// 获取当前标签
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
owner,
repo,
issue_number: pr.number
});
// 保留非 action 标签
const labelsToKeep = currentLabels
.filter(label => label.name !== 'action:merge' && label.name !== 'action:review')
.map(label => label.name);
// 添加新标签
const newLabel = approvedCount >= 2 ? 'action:merge' : 'action:review';
await github.rest.issues.setLabels({
owner,
repo,
issue_number: pr.number,
labels: [...labelsToKeep, newLabel]
});
}
} catch (error) {
console.error('Error:', error);
throw error;
}
2 changes: 1 addition & 1 deletion .github/workflows/realease-tag.yml
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4

- name: Install pnpm
run: corepack enable pnpm
run: npm i -g pnpm@10

- uses: actions/setup-node@v4
with:
76 changes: 76 additions & 0 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release 3x Beta

on:
# pull_request:
push:
branches:
- feat_v3.x
workflow_dispatch:

jobs:
release-3x-beta:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# ref: ${{ github.event.pull_request.head.sha }}

- name: Get commit message
run: |
COMMIT_MESSAGE=$(git log --format=%s -n 1)
FILTERED_MESSAGE="${COMMIT_MESSAGE//[^a-zA-Z0-9.()_:, -]/}"
echo "COMMIT_MESSAGE=${FILTERED_MESSAGE}" >> $GITHUB_ENV
- name: Show commit message
run: echo "$COMMIT_MESSAGE"

- name: Commit message compliance verification
if: |
!startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) ||
!contains( env.COMMIT_MESSAGE , '-beta' )
run: echo "ABORT=true" >> $GITHUB_ENV

- name: Get Tag message
if: contains( env.COMMIT_MESSAGE , '-beta')
run: echo "RELEASE_TAG=beta" >> $GITHUB_ENV
#
- name: Install pnpm
run: npm i -g pnpm@10

- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version: '20'
cache: 'pnpm'

- name: Install dependencies
if: env.ABORT != 'true'
run: pnpm install --frozen-lockfile

- name: Run Build
if: env.ABORT != 'true'
run: |
if ! pnpm build; then
echo "构建 nutui-react 失败"
exit 1
fi
if ! pnpm build:taro; then
echo "构建 nutui-react-taro 失败"
exit 1
fi
- name: Run Release @nutui/nutui-react
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: env.ABORT != 'true'
run: pnpm --dir ./release/h5 publish:beta

- name: Run Releases @nutui/nutui-react-taro
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: env.ABORT != 'true'
run: pnpm --dir ./release/taro publish:beta
Loading