Skip to content

Commit 23a60c2

Browse files
authored
Merge pull request #753 from actiontech/feature/kit-auto-deploy
Feature/kit auto deploy
2 parents d94e620 + 05728a9 commit 23a60c2

32 files changed

+3376
-125
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dist
2929

3030
# misc
3131
.DS_Store
32+
.env
3233
.env.local
3334
.env.development.local
3435
.env.test.local
@@ -47,3 +48,9 @@ es
4748

4849
# cursor
4950
.cursor
51+
52+
verdaccio
53+
ftp-data
54+
55+
56+
/scripts/cli/dms-kit-publish/docs

Makefile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,5 @@ docker_build_ee: pull_image docker_install_node_modules
4646
docker_build_demo: pull_image docker_install_node_modules
4747
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "pnpm build:demo"
4848

49-
docker_build_icons_docs: pull_image docker_install_node_modules
50-
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "pnpm icon:docs:g && pnpm icon:docs:build && mv packages/icons/docs-dist ./docs-dist && tar zcf $(ICONS_DOCS_OUTER_BUILD_NAME) ./docs-dist"
51-
52-
docker_upload_icons_docs:
53-
curl -T $(ICONS_DOCS_OUTER_BUILD_NAME) \
54-
ftp://$(RELEASE_FTP_HOST)/actiontech-dms-ui/icons/$(ICONS_DOCS_OUTER_BUILD_NAME) --ftp-create-dirs
55-
56-
docker_sync_icons_docs_static:
57-
curl -X POST ${SYNC_ICONS_DOCS_STATIC_HOST}/sync-static
49+
docker_dms_kit_publish: docker_install_node_modules
50+
$(DOCKER) run -v $(MAIN_MODULE):/usr/src/app --user $(UID):$(GID) -w /usr/src/app --rm $(DOCKER_IMAGE) sh -c "pnpm dms-kit:publish"

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434
"api_client:g": "npm_config_registry=http://10.186.18.19:4873 pnpx @actiontech/cli api-client -y",
3535
"api_mocks:g": "npm_config_registry=http://10.186.18.19:4873 pnpx @actiontech/cli api-mocks -y",
3636
"ai-doc": "npm_config_registry=http://10.186.18.19:4873 pnpx @actiontech/cli ai-doc",
37-
"postinstall": "pnpm --filter @actiontech/dms-kit build"
37+
"postinstall": "pnpm --filter @actiontech/dms-kit build",
38+
"dms-kit:publish": "pnpm --filter @actiontech/cli-dms-kit-publish build && dms-kit-publish"
3839
},
3940
"keywords": [],
4041
"author": "",
4142
"devDependencies": {
4243
"@actiontech/cli-create-dms-page": "workspace:^",
44+
"@actiontech/cli-dms-kit-publish": "workspace:^",
4345
"@cfaester/enzyme-adapter-react-18": "^0.7.0",
4446
"@eslint/js": "^9.23.0",
4547
"@testing-library/dom": "9.3.4",
@@ -92,6 +94,7 @@
9294
"stylelint-config-styled-components": "^0.1.1",
9395
"stylelint-prettier": "^4.0.2",
9496
"ts-jest": "27.1.5",
97+
"tsx": "^4.20.5",
9598
"typescript": "^5.0.2",
9699
"typescript-eslint": "^8.28.0",
97100
"vite": "^5.2.6",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"include": [
4+
"**/*"
5+
]
6+
}

packages/dms-kit/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
"test:c": "jest --watchAll=false --coverage",
2424
"test:ci": "jest --ci --watchAll=false --coverage --color --silent --testLocationInResults"
2525
},
26-
"publishConfig": {
27-
"registry": "http://10.186.18.19:4873/",
28-
"access": "restricted"
29-
},
3026
"dependencies": {
3127
"ahooks": "^3.7.0",
3228
"axios": ">=0.27.2",

packages/icons/.dumi/tsconfig.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"include": [
4+
"**/*"
5+
]
6+
}

packages/icons/docs/icon/Common.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,20 @@ import { EyeClosedOutlined } from '@actiontech/icons';
361361
export default () => <EyeClosedOutlined width={32} height={32} />
362362
```
363363

364+
## FaLessThanEqualOutlined
365+
```jsx
366+
import { FaLessThanEqualOutlined } from '@actiontech/icons';
367+
368+
export default () => <FaLessThanEqualOutlined width={32} height={32} />
369+
```
370+
371+
## FilterOutlined
372+
```jsx
373+
import { FilterOutlined } from '@actiontech/icons';
374+
375+
export default () => <FilterOutlined width={32} height={32} />
376+
```
377+
364378
## HexagonOutlined
365379
```jsx
366380
import { HexagonOutlined } from '@actiontech/icons';

packages/icons/docs/icon/Data.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ import { TrendCardFilled } from '@actiontech/icons';
144144
export default () => <TrendCardFilled width={32} height={32} />
145145
```
146146

147+
## DashboardOutlined
148+
```jsx
149+
import { DashboardOutlined } from '@actiontech/icons';
150+
151+
export default () => <DashboardOutlined width={32} height={32} />
152+
```
153+
147154
## DoubleDatabaseOutlined
148155
```jsx
149156
import { DoubleDatabaseOutlined } from '@actiontech/icons';

packages/icons/package_publish.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@actiontech/icons",
3-
"version": "0.0.1-rc.7",
43
"description": "",
4+
"version": "0.0.1-rc.7",
55
"main": "./dist/index.js",
66
"module": "./es/index.js",
77
"types": "./es/index.d.ts",
@@ -21,10 +21,6 @@
2121
"es",
2222
"dist"
2323
],
24-
"publishConfig": {
25-
"registry": "http://10.186.18.19:4873/",
26-
"access": "restricted"
27-
},
2824
"scripts": {
2925
"start": "dumi dev",
3026
"docs:build": "dumi build",
@@ -46,4 +42,4 @@
4642
"peerDependencies": {
4743
"react": ">=17"
4844
}
49-
}
45+
}

packages/icons/publish-icons.mjs

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ import { fileURLToPath } from 'node:url';
55
import { spawnSync } from 'node:child_process';
66
import readline from 'node:readline';
77

8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const iconsDir = __dirname;
11+
812
function parseArgs(argv) {
9-
const args = { version: '', skipConfirm: false };
13+
const args = { version: '', skipConfirm: false, registry: '', auth: '' };
1014
for (let i = 2; i < argv.length; i += 1) {
1115
const key = argv[i];
1216
const val = argv[i + 1];
@@ -15,6 +19,10 @@ function parseArgs(argv) {
1519
i += 1;
1620
} else if (key === '--skip-confirm' || key === '-y') {
1721
args.skipConfirm = true;
22+
} else if (key === '--registry' || key === '-r') {
23+
args.registry = val || '';
24+
} else if (key === '--auth' || key === '-a') {
25+
args.auth = val || '';
1826
}
1927
}
2028
return args;
@@ -124,31 +132,10 @@ async function confirmPublish() {
124132
});
125133
}
126134

127-
function updatePackagePublishVersion(iconsDir, version) {
128-
const pubPkgPath = path.join(iconsDir, 'package_publish.json');
129-
try {
130-
const pubPkgContent = readJson(pubPkgPath);
131-
pubPkgContent.version = version;
132-
writeJson(pubPkgPath, pubPkgContent);
133-
console.log(`✅ 已更新 package_publish.json 版本号为: ${version}`);
134-
} catch (err) {
135-
console.warn(`⚠️ 更新 package_publish.json 版本号失败: ${err.message}`);
136-
}
137-
}
138-
139135
async function main() {
140-
const { version, skipConfirm } = parseArgs(process.argv);
141-
if (!version) {
142-
console.error('请通过 --version 或 -v 指定版本号,例如:');
143-
console.error(
144-
' node packages/icons/publish-icons.mjs --version 0.0.1-rc.3'
145-
);
146-
process.exit(1);
147-
}
136+
const { skipConfirm, registry, auth } = parseArgs(process.argv);
148137

149-
const __filename = fileURLToPath(import.meta.url);
150-
const __dirname = path.dirname(__filename);
151-
const iconsDir = __dirname;
138+
const version = readJson(path.join(iconsDir, 'package.json')).version;
152139

153140
const pubPkg = path.join(iconsDir, 'package_publish.json');
154141
ensureFileExists(pubPkg, '发布用 package_publish.json');
@@ -158,12 +145,11 @@ async function main() {
158145
const originalVersion = originalPubPkgContent.version;
159146

160147
const tmpBase = path.join(__dirname, '..');
161-
const tmpDir = fs.mkdtempSync(
162-
path.join(tmpBase, 'actiontech-icons-publish-')
163-
);
148+
const tmpDir = path.join(tmpBase, 'actiontech-icons-publish');
164149

165150
try {
166151
console.log(`[1/7] 创建临时目录: ${tmpDir}`);
152+
fs.mkdirSync(tmpDir, { recursive: true });
167153

168154
console.log('[2/7] 复制整个 icons 包到临时目录');
169155
// 复制整个包目录,但排除一些不需要的文件
@@ -226,12 +212,14 @@ async function main() {
226212
return;
227213
}
228214
}
229-
230-
console.log('[6/7] 执行发布: npm publish');
231-
runCmd('npm', ['publish'], tmpDir);
232-
233-
console.log('[7/7] 更新 package_publish.json 版本号');
234-
updatePackagePublishVersion(iconsDir, version);
215+
console.log('[6/7] 配置认证');
216+
runCmd('pnpm', ['config', 'set', auth], tmpDir);
217+
console.log('[7/7] 执行发布: pnpm publish');
218+
runCmd(
219+
'pnpm',
220+
['publish', '--registry', registry, '--no-git-checks'],
221+
tmpDir
222+
);
235223

236224
console.log('✅ 发布完成');
237225
} catch (err) {
@@ -250,7 +238,7 @@ async function main() {
250238
console.warn(`⚠️ 还原版本号失败: ${restoreErr.message}`);
251239
}
252240
} finally {
253-
console.log('[8/7] 清理临时目录');
241+
console.log('[7/7] 清理临时目录');
254242
try {
255243
if (fs.existsSync(tmpDir)) {
256244
fs.rmSync(tmpDir, { recursive: true, force: true });

0 commit comments

Comments
 (0)