Skip to content

Commit 5d42823

Browse files
authored
feat: 依赖升级,工程化定期改造 (#232)
1 parent 7b530bf commit 5d42823

File tree

8 files changed

+1684
-1355
lines changed

8 files changed

+1684
-1355
lines changed

package.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,29 @@
1818
"preinstall": "npx only-allow pnpm && chmod +x ./scripts/*",
1919
"postinstall": "rm -rf .git/hooks && npx simple-git-hooks",
2020
"clean": "npx fa clean --dist --deps --vite --all --ignore-tips",
21-
"clean:hooks": "rm -rf .git/hooks",
21+
"clean:hooks": "npx fa clean --git-hooks --all --ignore-tips",
2222
"lint": "npx fa lint",
2323
"lint:fix": "npx fa lint --fix",
2424
"dev": "npx vuepress dev docs",
2525
"build": "npx vuepress build docs --clean-temp --clean-cache",
2626
"build:proxy": "NEED_PROXY=true npx vuepress build docs --clean-temp --clean-cache",
27-
"release": "npx fa release --vip"
27+
"release": "npx fa release --vip --check-branch next --check-branch main",
28+
"check:commit": "npx node --loader ts-node/esm --no-warnings scripts/core/verify-commit.ts"
2829
},
2930
"devDependencies": {
30-
"@142vip/eslint-config": "0.0.1-alpha.3",
31-
"@142vip/fairy-cli": "0.0.3-alpha.21",
32-
"@142vip/utils": "0.0.1-alpha.31",
33-
"@142vip/vuepress": "0.0.1-alpha.11",
31+
"@142vip/commit-linter": "0.0.1-alpha.1",
32+
"@142vip/eslint-config": "0.0.1-alpha.4",
33+
"@142vip/fairy-cli": "0.0.3-alpha.24",
34+
"@142vip/utils": "0.0.1-alpha.36",
35+
"@142vip/vuepress": "0.0.1-alpha.12",
3436
"@vuepress/bundler-vite": "2.0.0-rc.20",
3537
"only-allow": "1.2.1",
3638
"simple-git-hooks": "2.11.1",
39+
"ts-node": "^10.9.2",
3740
"vuepress": "2.0.0-rc.20"
3841
},
3942
"simple-git-hooks": {
40-
"pre-commit": "pnpm lint",
41-
"prepare-commit-msg": "pnpm build"
43+
"pre-commit": "pnpm lint:fix",
44+
"commit-msg": "pnpm check:commit"
4245
}
4346
}

pnpm-lock.yaml

Lines changed: 1639 additions & 1281 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build-image

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
npx node --loader ts-node/esm --no-warnings scripts/core/build-image.ts

scripts/ci

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#!/bin/bash
2-
##
3-
## 依赖安装脚本
4-
## 使用:
5-
## ./scripts/ci
6-
##
2+
3+
#
4+
# 依赖安装脚本
5+
# 使用:
6+
# ./scripts/ci
7+
#
78

89
NPM_REGISTRY="https://mirrors.tencent.com/npm/"
910

1011
## 获取所有参数
1112
echo "运行命令: export COREPACK_NPM_REGISTRY=$NPM_REGISTRY && corepack enable pnpm && pnpm i --registry $NPM_REGISTRY --frozen-lockfile $*"
1213

1314
# 导出corepack环境变量,安装pnpm版本
14-
export COREPACK_NPM_REGISTRY=$NPM_REGISTRY COREPACK_INTEGRITY_KEYS=0 && corepack enable pnpm
15+
export COREPACK_NPM_REGISTRY=$NPM_REGISTRY COREPACK_INTEGRITY_KEYS=0 && corepack enable pnpm
1516

16-
# 安装项目依赖 -w -F @142vip/fairy-cli
17+
# 安装项目依赖
1718
pnpm i --registry $NPM_REGISTRY --frozen-lockfile "$@"

scripts/bundle renamed to scripts/core/build-image.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
#!/usr/bin/env node
2-
1+
import { OPEN_SOURCE_ADDRESS, OPEN_SOURCE_AUTHOR, VipDocker, VipGit, VipNodeJS, VipPackageJSON } from '@142vip/utils'
32
/**
43
* 功能:构建Docker镜像
5-
* 使用:
6-
* - ./scripts/bundle
7-
* - ./scripts/bundle --proxy
84
*/
9-
10-
import {
11-
OPEN_SOURCE_ADDRESS,
12-
OPEN_SOURCE_AUTHOR,
13-
VipDocker,
14-
VipGit,
15-
VipNodeJS,
16-
VipPackageJSON,
17-
} from '@142vip/utils'
18-
19-
(async () => {
5+
async function buildImageMain(): Promise<void> {
206
try {
217
// 获取package.json文件
22-
const { name, version, description } = VipPackageJSON.getPackageJSON()
8+
const { name, version, description } = VipPackageJSON.getPackageJSON<{ description: string }>()
239

2410
// 镜像地址
2511
const imageName = `${OPEN_SOURCE_ADDRESS.DOCKER_ALIYUNCS_VIP}/docs:${name}-${version}`
@@ -50,4 +36,6 @@ import {
5036
catch (e) {
5137
console.log('异常信息:', e)
5238
}
53-
})()
39+
}
40+
41+
void buildImageMain()

scripts/core/verify-commit.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { commitLiner } from '@142vip/commit-linter'
2+
import { VipColor, VipConsole, vipLogger } from '@142vip/utils'
3+
4+
/**
5+
* 验证Git Commit信息
6+
*/
7+
async function verifyCommitMain() {
8+
const { type, scope, subject, commit } = commitLiner()
9+
10+
// 提交符合规范,打印相关信息
11+
VipConsole.log(`type: ${type}, scope: ${scope}, subject: ${subject}`)
12+
vipLogger.logByBlank(`${VipColor.greenBright('Git Commit: ')} ${VipColor.green(commit)}`)
13+
}
14+
15+
void verifyCommitMain()

scripts/sync

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

vuepress.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
getDocSiteBase,
3-
OPEN_SOURCE_ADDRESS,
4-
OPEN_SOURCE_AUTHOR,
5-
} from '@142vip/utils'
1+
import { getDocSiteBase, GitGeneralBranch, OPEN_SOURCE_ADDRESS, OPEN_SOURCE_AUTHOR } from '@142vip/utils'
62
import {
73
getCopyRightText,
84
getFooterHtml,
@@ -71,7 +67,7 @@ export default defineUserConfig({
7167

7268
// 文档路径,开启编辑功能
7369
docsDir: 'docs',
74-
docsBranch: 'next',
70+
docsBranch: GitGeneralBranch.NEXT,
7571
// 主题布局选项
7672
docsRepo: OPEN_SOURCE_ADDRESS.GITHUB_REPO_JSC,
7773

0 commit comments

Comments
 (0)