Skip to content

Commit 03be6c4

Browse files
committed
feat: 添加发布工作流,删除form-item的虚拟目录,彻底实现多子组件在同目录下管理,给bem工具添加注释
1 parent a422def commit 03be6c4

5 files changed

Lines changed: 61 additions & 8 deletions

File tree

.changeset/wicked-cobras-sort.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'axis-ui': patch
3+
'@axis-ui/utils': patch
4+
---
5+
6+
text

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write # 允许创建 release 和提交代码
16+
pull-requests: write # 允许创建 PR (Version Packages)
17+
id-token: write # 用于 npm provenance (可选)
18+
19+
steps:
20+
- name: Checkout Repo
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v2
30+
with:
31+
version: 9
32+
33+
- name: Install Dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Build Packages
37+
run: pnpm build:all
38+
39+
- name: Create Release Pull Request or Publish to npm
40+
id: changesets
41+
uses: changesets/action@v1
42+
with:
43+
# 当有新的 changeset 时,执行 version 命令更新版本
44+
version: pnpm run version
45+
# 当合并 Version Packages PR 时,执行 release 命令发布
46+
publish: pnpm run release
47+
commit: 'chore: update versions'
48+
title: 'chore: version packages'
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

packages/components/form-item/index.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/components/vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export default defineConfig(({ mode }) => {
2828
: {
2929
index: resolve(__dirname, 'index.ts'),
3030
resolver: resolve(__dirname, 'resolver.ts'),
31-
'form-item': resolve(__dirname, 'form-item/index.ts'),
3231
},
3332
name: 'AxisUI',
3433
// ESM: 保留文件名; UMD: 固定文件名

packages/utils/create.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//block 代码块 element 元素 modifier 修饰符
22

3+
//用于拼接字符串:传入各部分单词,函数进行拼接
34
function _bem(
45
prefixName: string,
56
blockSuffix: string,
@@ -18,6 +19,7 @@ function _bem(
1819
return prefixName
1920
}
2021

22+
//提供多种函数,提供b()、e()、m()等多种方式拼接类名
2123
function createBEM(prefixName: string) {
2224
const b = (blockSuffix: string = '') => _bem(prefixName, blockSuffix, '', '')
2325
const e = (element: string = '') =>
@@ -55,6 +57,7 @@ function createBEM(prefixName: string) {
5557
}
5658
}
5759

60+
//拼接前缀为ax-,创建命名空间
5861
export function createNamespace(name: string) {
5962
const prefixName = `ax-${name}`
6063
return createBEM(prefixName)
@@ -70,4 +73,4 @@ console.log(bem.em('item', 'active')) // ax-tree__item--active
7073
console.log(bem.bm('node', 'active')) // ax-tree-node--active
7174
console.log(bem.bem('node', 'item', 'active')) // ax-tree-node__item--active
7275
console.log(bem.is('selected', true)) // is-selected
73-
**/
76+
**/

0 commit comments

Comments
 (0)