Skip to content

Commit cbaa87b

Browse files
authored
docs: changelog of 1.0.0-alpha.0 (#100)
* chore: mod pre-publish scripts - use local CI run lint,compile,test - delete github access token * chore: add the version.ts file to gitignore * docs: changelog of 1.0.0-alpha.0 * chore: update .gitignore * docs: fix changelog lint error
1 parent 9cd8c4f commit cbaa87b

File tree

10 files changed

+71
-209
lines changed

10 files changed

+71
-209
lines changed

.dumi/preset/components-changelog-cn.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

.dumi/preset/components-changelog-en.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

.dumi/preset/misc-changelog.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,9 @@ server/
4545
# Docs templates
4646
components/version/token-meta.json
4747
components/version/token.json
48+
components/version/version.ts
49+
components/version/version.tsx
50+
.dumi/preset/components-changelog*
51+
.dumi/preset/misc-changelog.json
4852
report.html
4953
dist/

CHANGELOG.en-US.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@ tag: vVERSION
1616

1717
---
1818

19+
## 1.0.0-alpha.0
20+
21+
`2024-09-05`
22+
23+
- 🔥 New Component Bubble. [#19](https://github.com/ant-design/x/pull/19) [@li-jia-nan](https://github.com/li-jia-nan)
24+
- 🔥 Bubble support direction [#52](https://github.com/ant-design/x/pull/52) [@li-jia-nan](https://github.com/li-jia-nan)
25+
- 🔥 New Component Bubble.List. [#57](https://github.com/ant-design/x/pull/57) [@zombieJ](https://github.com/zombieJ)
26+
- 🔥 New Component Conversations. [#48](https://github.com/ant-design/x/pull/48) [@YumoImer](https://github.com/YumoImer)
27+
- 🔥 New Component Prompts. [#55](https://github.com/ant-design/x/pull/55) [@YumoImer](https://github.com/YumoImer)
28+
- 🔥 New Component Sender. [#46](https://github.com/ant-design/x/pull/46) [@ONLY-yours](https://github.com/ONLY-yours)
29+
- 🔥 New Component ThoughtChain. [#86](https://github.com/ant-design/x/pull/86) [@YumoImer](https://github.com/YumoImer)
30+
- 📦 Use `father` to build. [#84](https://github.com/ant-design/x/pull/84) [@zombieJ](https://github.com/zombieJ)
31+
- 🛠 Fix ThemeContext instances being inconsistent when using `antd` es or lib package. [#88](https://github.com/ant-design/x/pull/88) [@YumoImer](https://github.com/YumoImer)
32+
- 🛠 Refactor: API Naming Conventions [#73](https://github.com/ant-design/x/pull/73) [@zombieJ](https://github.com/zombieJ)
33+
- 🛠 MISC: CI, Github Actions, Publish
34+
- 🛠 [#59](https://github.com/ant-design/x/pull/59) [@zombieJ](https://github.com/zombieJ)
35+
- 🛠 [#62](https://github.com/ant-design/x/pull/62) [@zombieJ](https://github.com/zombieJ)
36+
- 🛠 [#71](https://github.com/ant-design/x/pull/71) [@ONLY-yours](https://github.com/ONLY-yours)
37+
- 🛠 [#72](https://github.com/ant-design/x/pull/72) [@YumoImer](https://github.com/YumoImer)
38+
- 🛠 [#98](https://github.com/ant-design/x/pull/98) [@YumoImer](https://github.com/YumoImer)
39+
- 📖 Update README.md
40+
- 📖 [#81](https://github.com/ant-design/x/pull/81) [@zombieJ](https://github.com/zombieJ)
41+
- 📖 [#82](https://github.com/ant-design/x/pull/82) [@zombieJ](https://github.com/zombieJ)
42+
- 📖 [#61](https://github.com/ant-design/x/pull/61) [@afc163](https://github.com/afc163)
43+
1944
## 0.0.0-alpha.0
2045

2146
`2024-05-10`

CHANGELOG.zh-CN.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,31 @@ tag: vVERSION
1515

1616
---
1717

18+
## 1.0.0-alpha.0
19+
20+
`2024-09-05`
21+
22+
- 🔥 新组件 Bubble. [#19](https://github.com/ant-design/x/pull/19) [@li-jia-nan](https://github.com/li-jia-nan)
23+
- 🔥 Bubble 支持方向 [#52](https://github.com/ant-design/x/pull/52) [@li-jia-nan](https://github.com/li-jia-nan)
24+
- 🔥 新组件 Bubble.List. [#57](https://github.com/ant-design/x/pull/57) [@zombieJ](https://github.com/zombieJ)
25+
- 🔥 新组件 Conversations. [#48](https://github.com/ant-design/x/pull/48) [@YumoImer](https://github.com/YumoImer)
26+
- 🔥 新组件 Prompts. [#55](https://github.com/ant-design/x/pull/55) [@YumoImer](https://github.com/YumoImer)
27+
- 🔥 新组件 Sender. [#46](https://github.com/ant-design/x/pull/46) [@ONLY-yours](https://github.com/ONLY-yours)
28+
- 🔥 新组件 ThoughtChain. [#86](https://github.com/ant-design/x/pull/86) [@YumoImer](https://github.com/YumoImer)
29+
- 📦 使用 `father` 构建. [#84](https://github.com/ant-design/x/pull/84) [@zombieJ](https://github.com/zombieJ)
30+
- 🛠 修复使用 `antd` 的 es 或 lib 包时 ThemeContext 实例不一致的问题. [#88](https://github.com/ant-design/x/pull/88) [@YumoImer](https://github.com/YumoImer)
31+
- 🛠 重构:API 命名规范 [#73](https://github.com/ant-design/x/pull/73) [@zombieJ](https://github.com/zombieJ)
32+
- 🛠 杂项:CI、Github Actions、发布
33+
- 🛠 [#59](https://github.com/ant-design/x/pull/59) [@zombieJ](https://github.com/zombieJ)
34+
- 🛠 [#62](https://github.com/ant-design/x/pull/62) [@zombieJ](https://github.com/zombieJ)
35+
- 🛠 [#71](https://github.com/ant-design/x/pull/71) [@ONLY-yours](https://github.com/ONLY-yours)
36+
- 🛠 [#72](https://github.com/ant-design/x/pull/72) [@YumoImer](https://github.com/YumoImer)
37+
- 🛠 [#98](https://github.com/ant-design/x/pull/98) [@YumoImer](https://github.com/YumoImer)
38+
- 📖 更新 README.md
39+
- 📖 [#81](https://github.com/ant-design/x/pull/81) [@zombieJ](https://github.com/zombieJ)
40+
- 📖 [#82](https://github.com/ant-design/x/pull/82) [@zombieJ](https://github.com/zombieJ)
41+
- 📖 [#61](https://github.com/ant-design/x/pull/61) [@afc163](https://github.com/afc163)
42+
1843
## 0.0.0-alpha.0
1944

2045
`2024-05-10`

components/version/version.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ant-design/x",
3-
"version": "0.0.0-alpha.0",
3+
"version": "1.0.0-alpha.0",
44
"description": "Crafting AI-driven interfaces with React, seamlessly integrating smart chat components and API services at your fingertips.",
55
"keywords": [
66
"AI",

scripts/check-repo.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function exitProcess(code = 1) {
1818

1919
async function checkVersion() {
2020
spinner.start('正在检查当前版本是否已经存在');
21-
const { versions } = await fetch('http://registry.npmjs.org/@ant-design/x').then((res: Response) =>
22-
res.json(),
21+
const { versions } = await fetch('http://registry.npmjs.org/@ant-design/x').then(
22+
(res: Response) => res.json(),
2323
);
2424
if (version in versions) {
2525
spinner.fail(chalk.yellow('😈 Current version already exists. Forget update package.json?'));
@@ -63,34 +63,17 @@ async function checkRemote() {
6363
if (!remote?.includes('ant-design/x')) {
6464
const { value } = await git.getConfig('remote.origin.url');
6565
if (!value?.includes('ant-design/x')) {
66-
spinner.fail(
67-
chalk.red('🧐 Your remote origin is not ant-design/x, did you fork it?'),
68-
);
66+
spinner.fail(chalk.red('🧐 Your remote origin is not ant-design/x, did you fork it?'));
6967
exitProcess();
7068
}
7169
}
7270
spinner.succeed('远程分支检查通过');
7371
}
7472

75-
async function checkToken() {
76-
if (!process.env.GITHUB_ACCESS_TOKEN) {
77-
console.log(
78-
spinner.fail(
79-
chalk.red(
80-
'🚨 请先设置 GITHUB_ACCESS_TOKEN 环境变量到本地,请不要泄露给任何在线页面: https://octokit.github.io/rest.js/v20#authentication',
81-
),
82-
),
83-
);
84-
exitProcess();
85-
}
86-
spinner.succeed('GITHUB_ACCESS_TOKEN 检查通过');
87-
}
88-
8973
export default async function checkRepo() {
9074
const status = await git.status();
9175
await checkVersion();
9276
await checkBranch(status);
9377
await checkCommit(status);
9478
await checkRemote();
95-
await checkToken();
9679
}

scripts/pre-publish.ts

Lines changed: 13 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
/* eslint-disable camelcase, no-async-promise-executor */
2-
import fs from 'node:fs';
32
import runScript from '@npmcli/run-script';
4-
import { Octokit } from '@octokit/rest';
5-
import AdmZip from 'adm-zip';
6-
import axios from 'axios';
73
import chalk from 'chalk';
84
import Spinnies from 'spinnies';
95

@@ -12,8 +8,6 @@ import checkRepo from './check-repo';
128
const { Notification: Notifier } = require('node-notifier');
139
const simpleGit = require('simple-git');
1410

15-
const blockStatus = ['failure', 'cancelled', 'timed_out'] as const;
16-
1711
const spinner = { interval: 80, frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'] };
1812
const spinnies = new Spinnies({ spinner });
1913

@@ -64,61 +58,13 @@ process.on('SIGINT', () => {
6458
process.exit(1);
6559
});
6660

67-
const emojify = (status: string = '') => {
68-
if (!status) {
69-
return '';
70-
}
71-
const emoji = {
72-
/* status */
73-
completed: '✅',
74-
queued: '🕒',
75-
in_progress: '⌛',
76-
/* conclusion */
77-
success: '✅',
78-
failure: '❌',
79-
neutral: '⚪',
80-
cancelled: '❌',
81-
skipped: '⏭️',
82-
timed_out: '⌛',
83-
action_required: '🔴',
84-
}[status];
85-
return `${emoji || ''} ${(status || '').padEnd(15)}`;
86-
};
87-
88-
const toMB = (bytes: number) => (bytes / 1024 / 1024).toFixed(2);
89-
90-
async function downloadArtifact(msgKey: string, url: string, filepath: string, token?: string) {
91-
const headers: Record<string, string> = {};
92-
if (token) {
93-
headers.Authorization = `token ${token}`;
94-
}
95-
96-
const response = await axios.get(url, {
97-
headers,
98-
responseType: 'arraybuffer',
99-
onDownloadProgress: (progressEvent) => {
100-
const { loaded, total = 0 } = progressEvent;
101-
102-
showMessage(
103-
`下载进度 ${toMB(loaded)}MB/${toMB(total)}MB (${((loaded / total) * 100).toFixed(2)}%)`,
104-
true,
105-
msgKey,
106-
);
107-
},
108-
});
109-
110-
fs.writeFileSync(filepath, Buffer.from(response.data));
111-
112-
return filepath;
113-
}
114-
11561
const runPrePublish = async () => {
11662
await checkRepo();
117-
showMessage(chalk.black.bgGreenBright('本次发布将跳过本地 CI 检查,远程 CI 通过后方可发布'));
63+
11864
const git = simpleGit();
119-
const octokit = new Octokit({ auth: process.env.GITHUB_ACCESS_TOKEN });
12065
const { current: currentBranch } = await git.branch();
12166

67+
// 本地-远程分支同步
12268
showMessage(`正在拉取远程分支 ${currentBranch}`, true);
12369
await git.pull('origin', currentBranch);
12470
showMessage(`成功拉取远程分支 ${currentBranch}`, 'succeed');
@@ -130,145 +76,28 @@ const runPrePublish = async () => {
13076
const { latest } = await git.log();
13177
const sha = process.env.TARGET_SHA || latest.hash;
13278

79+
// 最后一次 commit 信息
13380
showMessage(`找到本地最新 commit:`, 'succeed');
13481
showMessage(chalk.cyan(` hash: ${sha}`));
13582
showMessage(chalk.cyan(` date: ${latest.date}`));
13683
showMessage(chalk.cyan(` message: ${latest.message}`));
13784
showMessage(chalk.cyan(` author_name: ${latest.author_name}`));
13885

139-
const owner = 'ant-design';
140-
const repo = 'ant-design';
141-
showMessage(`开始检查远程分支 ${currentBranch} 的 CI 状态`, true);
142-
143-
const failureUrlList: string[] = [];
144-
const {
145-
data: { check_runs },
146-
} = await octokit.checks.listForRef({
147-
owner,
148-
repo,
149-
ref: sha,
150-
});
151-
showMessage(`远程分支 CI 状态(${check_runs.length}):`, 'succeed');
152-
check_runs.forEach((run) => {
153-
showMessage(` ${run.name.padEnd(36)} ${emojify(run.status)} ${emojify(run.conclusion || '')}`);
154-
if (blockStatus.some((status) => run.conclusion === status)) {
155-
failureUrlList.push(run.html_url!);
156-
}
157-
});
158-
const conclusions = check_runs.map((run) => run.conclusion);
159-
if (blockStatus.some((status) => conclusions.includes(status))) {
160-
showMessage(chalk.bgRedBright('远程分支 CI 执行异常,无法继续发布,请尝试修复或重试'), 'fail');
161-
showMessage(` 点此查看状态:https://github.com/${owner}/${repo}/commit/${sha}`);
162-
163-
failureUrlList.forEach((url) => {
164-
showMessage(` - ${url}`);
165-
});
166-
167-
process.exit(1);
168-
}
169-
170-
const statuses = check_runs.map((run) => run.status);
171-
if (check_runs.length < 1 || statuses.includes('queued') || statuses.includes('in_progress')) {
172-
showMessage(chalk.bgRedBright('远程分支 CI 还在执行中,请稍候再试'), 'fail');
173-
showMessage(` 点此查看状态:https://github.com/${owner}/${repo}/commit/${sha}`);
174-
process.exit(1);
175-
}
176-
showMessage(`远程分支 CI 已通过`, 'succeed');
17786
// clean up
17887
await runScript({ event: 'clean', path: '.', stdio: 'inherit' });
17988
showMessage(`成功清理构建产物目录`, 'succeed');
18089

181-
// 从 github artifact 中下载产物
182-
const downloadArtifactPromise = Promise.resolve().then(async () => {
183-
showMessage('开始查找远程分支构建产物', true, '[Github]');
184-
185-
const {
186-
data: { workflow_runs },
187-
} = await octokit.rest.actions.listWorkflowRunsForRepo({
188-
owner,
189-
repo,
190-
head_sha: sha,
191-
per_page: 100,
192-
exclude_pull_requests: true,
193-
event: 'push',
194-
status: 'completed',
195-
conclusion: 'success',
196-
head_branch: currentBranch,
197-
});
198-
const testWorkflowRun = workflow_runs.find((run) => run.name === '✅ test');
199-
if (!testWorkflowRun) {
200-
throw new Error('找不到远程构建工作流');
201-
}
202-
203-
const {
204-
data: { artifacts },
205-
} = await octokit.actions.listWorkflowRunArtifacts({
206-
owner,
207-
repo,
208-
run_id: testWorkflowRun?.id || 0,
209-
});
210-
const artifact = artifacts.find((item) => item.name === 'build artifacts');
211-
if (!artifact) {
212-
throw new Error('找不到远程构建产物');
213-
}
214-
215-
showMessage(`准备从远程分支下载构建产物`, true, '[Github]');
216-
const { url } = await octokit.rest.actions.downloadArtifact.endpoint({
217-
owner,
218-
repo,
219-
artifact_id: artifact.id,
220-
archive_format: 'zip',
221-
});
222-
223-
// 返回下载后的文件路径
224-
return downloadArtifact('[Github]', url, 'artifacts.zip', process.env.GITHUB_ACCESS_TOKEN);
225-
});
226-
downloadArtifactPromise
227-
.then(() => {
228-
showMessage(`成功下载构建产物`, 'succeed', '[Github]');
229-
})
230-
.catch((e: Error) => {
231-
showMessage(chalk.bgRedBright(e.message), 'fail', '[Github]');
232-
});
233-
234-
// 从 OSS 下载产物
235-
const downloadOSSPromise = Promise.resolve().then(async () => {
236-
const url = `https://antd-visual-diff.oss-cn-shanghai.aliyuncs.com/${sha}/oss-artifacts.zip`;
237-
238-
showMessage(`准备从远程 OSS 下载构建产物`, true, '[OSS]');
239-
240-
// 返回下载后的文件路径
241-
return downloadArtifact('[OSS]', url, 'oss-artifacts.zip');
242-
});
243-
downloadOSSPromise
244-
.then(() => {
245-
showMessage(`成功下载构建产物`, 'succeed', '[OSS]');
246-
})
247-
.catch((e: Error) => {
248-
showMessage(chalk.bgRedBright(e.message), 'fail', '[OSS]');
249-
});
250-
251-
// 任意一个完成,则完成
252-
let firstArtifactFile: string;
253-
254-
try {
255-
// @ts-ignore
256-
firstArtifactFile = await Promise.any([downloadArtifactPromise, downloadOSSPromise]);
257-
} catch (error) {
258-
showMessage(
259-
chalk.bgRedBright(`下载失败,请确认你当前 ${sha.slice(0, 6)} 位于 main 分支中`),
260-
'fail',
261-
);
262-
process.exit(1);
263-
}
264-
265-
showMessage(`成功从远程分支下载构建产物`, 'succeed');
90+
// CI
91+
showMessage(`[CI] 正在执行 lint`, true);
92+
await runScript({ event: 'lint', path: '.', stdio: 'inherit' });
93+
showMessage(`[CI] lint 执行成功`, 'succeed');
94+
showMessage(`[CI] 正在执行 compile`, true);
95+
await runScript({ event: 'compile', path: '.', stdio: 'inherit' });
96+
showMessage(`[CI] compile 执行成功`, 'succeed');
97+
showMessage(`[CI] 正在执行 test`, true);
98+
await runScript({ event: 'test', path: '.', stdio: 'inherit' });
99+
showMessage(`[CI] test 执行成功`, 'succeed');
266100

267-
// unzip
268-
showMessage(`正在解压构建产物`, true);
269-
const zip = new AdmZip(firstArtifactFile);
270-
zip.extractAllTo('./', true);
271-
showMessage(`成功解压构建产物`, 'succeed');
272101
await runScript({ event: 'test:dekko', path: '.', stdio: 'inherit' });
273102
await runScript({ event: 'test:package-diff', path: '.', stdio: 'inherit' });
274103
showMessage(`文件检查通过,准备发布!`, 'succeed');

0 commit comments

Comments
 (0)