Skip to content

Commit 4a9bfce

Browse files
Merge remote-tracking branch 'origin/develop'
2 parents 2322f93 + 2d7d4b9 commit 4a9bfce

File tree

665 files changed

+20273
-2712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

665 files changed

+20273
-2712
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ module.exports = {
107107
},
108108
},
109109
{
110-
files: ['example/**', '**/_example/**'],
110+
files: ['packages/tdesign-miniprogram/example/**', '**/_example/**'],
111111
rules: {
112112
'no-console': 0,
113113
},

.github/actions/install-dep/action.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
nodeVersion:
77
required: false
88
type: string
9-
default: '14'
9+
default: '18'
1010

1111
runs:
1212
using: 'composite'
@@ -18,18 +18,5 @@ runs:
1818
- name: Setup pnpm
1919
uses: pnpm/action-setup@v4
2020

21-
- name: Get pnpm store directory
22-
id: pnpm-cache
23-
shell: bash
24-
run: echo "dir=$(pnpm store path)" >> ${GITHUB_OUTPUT}
25-
26-
- uses: actions/cache@v4
27-
name: Setup pnpm cache
28-
with:
29-
path: ${{ steps.pnpm-cache.outputs.dir }}
30-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
31-
restore-keys: |
32-
${{ runner.os }}-pnpm-store-
33-
3421
- run: pnpm install
3522
shell: bash

.github/workflows/auto-release.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [develop]
66
types: [opened, synchronize, reopened, closed]
77
paths:
8-
- 'package.json'
8+
- 'packages/tdesign-miniprogram/package.json'
99
issue_comment:
1010
types: [edited]
1111

@@ -19,8 +19,14 @@ jobs:
1919
steps:
2020
- run: echo "The head of this PR starts with 'release/'"
2121
- uses: actions/checkout@v3
22+
- name: Extract version
23+
id: version
24+
run: |
25+
echo "version=$(node -p 'require("./packages/tdesign-miniprogram/package.json").version')" >> $GITHUB_OUTPUT
2226
- uses: TDesignOteam/tdesign-changelog-action@main
2327
id: changelog
28+
with:
29+
tag: ${{ steps.version.outputs.version }}
2430
env:
2531
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2632
- name: Add comment
@@ -57,8 +63,10 @@ jobs:
5763
env:
5864
BODY: ${{ github.event.comment.body }}
5965
run: |
60-
txt=$(cat packages/tdesign-miniprogram-site/CHANGELOG.md)
61-
echo "${txt%%##*}$BODY${txt##*---}" > packages/tdesign-miniprogram-site/CHANGELOG.md
66+
txt=$(cat packages/tdesign-miniprogram/CHANGELOG.md)
67+
chat_txt=$(cat packages/tdesign-miniprogram-chat/CHANGELOG.md)
68+
echo "${txt%%##*}$BODY${txt##*---}" > packages/tdesign-miniprogram/CHANGELOG.md
69+
echo "${chat_txt%%##*}$BODY${chat_txt##*---}" > packages/tdesign-miniprogram-chat/CHANGELOG.md
6270
git add .
6371
git config --local user.email "github-actions[bot]@users.noreply.github.com"
6472
git config --local user.name "github-actions[bot]"
@@ -78,7 +86,7 @@ jobs:
7886
token: ${{ secrets.PERSONAL_TOKEN }}
7987
- name: tag and push if needed
8088
run: |
81-
data=$(cat package.json)
89+
data=$(cat packages/tdesign-miniprogram/package.json)
8290
re="\"version\": \"([^\"]*)\""
8391
[[ $data =~ $re ]]
8492
echo "${BASH_REMATCH[1]}"

.github/workflows/pkg-pr-new.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919

2020
- uses: ./.github/actions/install-dep
2121

22-
- run: npm run build
22+
- run: pnpm run build
2323

2424
- uses: actions/setup-node@v4
2525
with:
2626
node-version: 20
2727

28-
- run: npx pkg-pr-new publish --compact
28+
- run: pnpm dlx pkg-pr-new publish 'packages/tdesign-miniprogram' --compact

.github/workflows/pr-compressed-size.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
with:
1616
repo-token: '${{ secrets.GITHUB_TOKEN }}'
1717
install-script: 'npm install --force'
18-
pattern: './miniprogram_dist/**/*.{js,wxs,wxml,json}'
18+
pattern: './packages/tdesign-miniprogram/miniprogram_dist/**/*.{js,wxs,wxml,json}'
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: preview-site-build
2+
3+
on:
4+
pull_request:
5+
branches: [develop, main]
6+
types: [opened, synchronize, reopened]
7+
8+
jobs:
9+
tdesign-miniprogram-site:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- run: echo ${{ github.event.number }} > pr-id.txt
13+
- uses: actions/upload-artifact@v4
14+
with:
15+
name: pr-id
16+
path: pr-id.txt
17+
retention-days: 5
18+
19+
- uses: actions/checkout@v4
20+
with:
21+
submodules: recursive
22+
23+
- uses: pnpm/action-setup@v4
24+
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 18
28+
29+
- run: pnpm install
30+
31+
- run: pnpm -C packages/tdesign-miniprogram/site run site:preview
32+
33+
- uses: actions/upload-artifact@v4
34+
with:
35+
name: tdesign-miniprogram-site
36+
path: packages/tdesign-miniprogram/site/dist
37+
retention-days: 5
38+
39+
tdesign-miniprogram-chat-site:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
submodules: recursive
45+
46+
- uses: pnpm/action-setup@v4
47+
48+
- uses: actions/setup-node@v4
49+
with:
50+
node-version: 18
51+
52+
- run: pnpm install
53+
54+
- run: pnpm -C packages/tdesign-miniprogram-chat/site run site:preview
55+
56+
- uses: actions/upload-artifact@v4
57+
with:
58+
name: tdesign-miniprogram-chat-site
59+
path: packages/tdesign-miniprogram-chat/site/dist
60+
retention-days: 5
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: preview-site-publish
2+
3+
on:
4+
workflow_run:
5+
workflows:
6+
- preview-site-build
7+
types:
8+
- completed
9+
10+
jobs:
11+
preview-context:
12+
if: github.event.workflow_run.conclusion == 'success'
13+
runs-on: ubuntu-latest
14+
outputs:
15+
pr_id: ${{ steps.pr.outputs.id }}
16+
tdesign_miniprogram_domain: ${{ steps.tdesign-miniprogram-domain.outputs.tdesign_miniprogram_domain }}
17+
tdesign_miniprogram_chat_domain: ${{ steps.tdesign-miniprogram-chat-domain.outputs.tdesign_miniprogram_chat_domain }}
18+
steps:
19+
- name: Download pr id
20+
uses: dawidd6/action-download-artifact@v8
21+
with:
22+
workflow: ${{ github.event.workflow_run.workflow_id }}
23+
run_id: ${{ github.event.workflow_run.id }}
24+
name: pr-id
25+
26+
- name: Set pr id
27+
id: pr
28+
run: echo "id=$(cat pr-id.txt)" >> $GITHUB_OUTPUT
29+
30+
- name: tdesign-miniprogram-domain
31+
id: tdesign-miniprogram-domain
32+
run: echo "tdesign_miniprogram_domain=https://preview-pr-${{ steps.pr.outputs.id }}-tdesign-miniprogram.surge.sh" >> $GITHUB_OUTPUT
33+
34+
- name: tdesign-miniprogram-chat-domain
35+
id: tdesign-miniprogram-chat-domain
36+
run: echo "tdesign_miniprogram_chat_domain=https://preview-pr-${{ steps.pr.outputs.id }}-tdesign-miniprogram-chat.surge.sh" >> $GITHUB_OUTPUT
37+
38+
tdesign-miniprogram:
39+
if: github.event.workflow_run.conclusion == 'success'
40+
runs-on: ubuntu-latest
41+
needs: preview-context
42+
steps:
43+
- uses: dawidd6/action-download-artifact@v8
44+
with:
45+
workflow: ${{ github.event.workflow_run.workflow_id }}
46+
run_id: ${{ github.event.workflow_run.id }}
47+
name: tdesign-miniprogram-site
48+
- run: |
49+
export DEPLOY_DOMAIN=${{ needs.preview-context.outputs.tdesign_miniprogram_domain }}
50+
npx surge --project ./ --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }}
51+
52+
tdesign-miniprogram-chat:
53+
if: github.event.workflow_run.conclusion == 'success'
54+
runs-on: ubuntu-latest
55+
needs: preview-context
56+
steps:
57+
- uses: dawidd6/action-download-artifact@v8
58+
with:
59+
workflow: ${{ github.event.workflow_run.workflow_id }}
60+
run_id: ${{ github.event.workflow_run.id }}
61+
name: tdesign-miniprogram-chat-site
62+
- run: |
63+
export DEPLOY_DOMAIN=${{ needs.preview-context.outputs.tdesign_miniprogram_chat_domain }}
64+
npx surge --project ./ --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }}
65+
66+
preview-comment:
67+
if: always()
68+
needs:
69+
- preview-context
70+
- tdesign-miniprogram
71+
- tdesign-miniprogram-chat
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: jobs report
75+
id: report
76+
uses: actions/github-script@v7
77+
with:
78+
script: |
79+
const pr_id = ${{ needs.preview-context.outputs.pr_id }};
80+
const tdesign_miniprogram_domain = "${{ needs.preview-context.outputs.tdesign_miniprogram_domain }}";
81+
const tdesign_miniprogram_chat_domain = "${{ needs.preview-context.outputs.tdesign_miniprogram_chat_domain }}";
82+
83+
const { data: { jobs } } = await github.rest.actions.listJobsForWorkflowRun({
84+
owner: context.repo.owner,
85+
repo: context.repo.repo,
86+
run_id: context.runId,
87+
per_page: 100
88+
})
89+
90+
const tdesign = {
91+
"tdesign-miniprogram": { status: "", report_url: "" },
92+
"tdesign-miniprogram-chat": { status: "", report_url: "" },
93+
};
94+
const preview_success = `<img width="300" alt="完成" src="https://user-images.githubusercontent.com/15634204/150816437-9f5bb788-cd67-4cbc-9897-b82d74e9aa65.png" />`;
95+
const preview_failure = `<img width="300" alt="失败" src="https://user-images.githubusercontent.com/5378891/75333447-1e63a280-58c1-11ea-975d-235367fd1522.png" />`;
96+
jobs
97+
.filter((job) => job.name.startsWith("tdesign-"))
98+
.map((job) => {
99+
tdesign[job.name].status = preview_failure;
100+
tdesign[job.name].report_url = job.html_url;
101+
102+
if (job.conclusion === "success") {
103+
tdesign[job.name].status = preview_success;
104+
if (job.name === "tdesign-miniprogram") {
105+
106+
tdesign[job.name].report_url = tdesign_miniprogram_domain;
107+
}
108+
if (job.name === "tdesign-miniprogram-chat") {
109+
tdesign[job.name].report_url = tdesign_miniprogram_chat_domain;
110+
}
111+
}
112+
});
113+
114+
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
115+
116+
const comment = `
117+
# TDesign Component Site Preview [Open](${runUrl})
118+
| Component | Preview |
119+
| --------- | :--: |
120+
${Object.keys(tdesign)
121+
.map((component) => {
122+
const preview_text = `[${tdesign[component].status}](${tdesign[component].report_url})`;
123+
let package_name = component;
124+
if (component === "tdesign-miniprogram-chat") {
125+
package_name = "@tdesign-miniprogram/chat";
126+
}
127+
128+
return `| ${package_name} | ${preview_text} | `;
129+
})
130+
.join("\n")}
131+
132+
<!-- AUTO_PREVIEW_HOOK -->
133+
`;
134+
135+
core.setOutput('comment', comment);
136+
137+
- name: comment
138+
uses: actions-cool/maintain-one-comment@v3
139+
with:
140+
token: ${{ secrets.TDESIGN_BOT_TOKEN }}
141+
number: ${{needs.preview-context.outputs.pr_id}}
142+
body: ${{ steps.report.outputs.comment }}
143+
body-include: '<!-- AUTO_PREVIEW_HOOK -->'

.github/workflows/tag-push.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ jobs:
77
runs-on: ubuntu-latest
88
if: github.event.ref_type == 'tag'
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
- uses: ./.github/actions/install-dep
12-
with:
13-
nodeVersion: '14.6.0'
14-
- run: npm run build
12+
- run: pnpm build
1513
shell: bash
1614
- name: release miniprogram
1715
uses: LeeJim/setup-miniprogram@main
@@ -28,8 +26,9 @@ jobs:
2826
MINI_APP_PRIVATE_KEY: ${{ secrets.TDESIGN_MINI_KEY }}
2927
- id: publish
3028
name: publish NPM
31-
uses: JS-DevTools/npm-publish@v1
29+
uses: JS-DevTools/npm-publish@v4
3230
with:
31+
package: packages/tdesign-miniprogram
3332
token: ${{ secrets.TDESIGN_NPM_TOKEN }}
3433
tag: ${{ contains(github.ref_name, 'beta') && 'beta' || 'latest' }}
3534
- if: steps.publish.outputs.type != 'none'

.gitignore

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
_site
1+
dist
22
miniprogram_dist
3+
34
_wechatide
4-
dist
5-
/_example
6-
example/pages/*
7-
!example/pages/gulp-error
8-
!example/pages/home
9-
test/e2e
10-
test/unit
11-
test/unit-virtualHost
5+
_example
6+
!packages/components/**/_example/
7+
!packages/pro-components/**/_example/
8+
9+
packages/tdesign-miniprogram/example/pages/*
10+
!packages/tdesign-miniprogram/example/pages/gulp-error
11+
!packages/tdesign-miniprogram/example/pages/home
12+
13+
packages/tdesign-miniprogram/test/e2e
14+
packages/tdesign-miniprogram/test/unit
15+
packages/tdesign-miniprogram/test/unit-virtualHost
16+
1217
.DS_Store
1318
node_modules
1419
package-lock.json
@@ -27,5 +32,3 @@ yarn-error.log*
2732
*.njsproj
2833
*.sln
2934
*.sw*
30-
/tdesign-miniprogram
31-
m2w_dist

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 贡献指南
3-
# description:
3+
# description:
44
spline: explain
55
---
66
## 开发规范
@@ -53,8 +53,8 @@ npm start
5353

5454
此时会同时启动 `dist``example` 的构建服务,对应的开发路径与构建路径分别为:
5555

56-
- `packages/components` -> `miniprogram_dist`
57-
- `packages/components/*/_example` -> `example` -> `_example`
56+
- `packages/components` -> `packages/tdesign-miniprogram/miniprogram_dist`
57+
- `packages/components/*/_example` -> `packages/tdesign-miniprogram/example` -> `_example`
5858

5959
使用微信开发者工具导入项目 `_example` 文件夹
6060

0 commit comments

Comments
 (0)