Skip to content

feat: 依赖升级,工程化定期改造 #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,29 @@
"preinstall": "npx only-allow pnpm && chmod +x ./scripts/*",
"postinstall": "rm -rf .git/hooks && npx simple-git-hooks",
"clean": "npx fa clean --dist --deps --vite --all --ignore-tips",
"clean:hooks": "rm -rf .git/hooks",
"clean:hooks": "npx fa clean --git-hooks --all --ignore-tips",
"lint": "npx fa lint",
"lint:fix": "npx fa lint --fix",
"dev": "npx vuepress dev docs",
"build": "npx vuepress build docs --clean-temp --clean-cache",
"build:proxy": "NEED_PROXY=true npx vuepress build docs --clean-temp --clean-cache",
"release": "npx fa release --vip"
"release": "npx fa release --vip --check-branch next --check-branch main",
"check:commit": "npx node --loader ts-node/esm --no-warnings scripts/core/verify-commit.ts"
},
"devDependencies": {
"@142vip/eslint-config": "0.0.1-alpha.3",
"@142vip/fairy-cli": "0.0.3-alpha.21",
"@142vip/utils": "0.0.1-alpha.31",
"@142vip/vuepress": "0.0.1-alpha.11",
"@142vip/commit-linter": "0.0.1-alpha.1",
"@142vip/eslint-config": "0.0.1-alpha.4",
"@142vip/fairy-cli": "0.0.3-alpha.24",
"@142vip/utils": "0.0.1-alpha.36",
"@142vip/vuepress": "0.0.1-alpha.12",
"@vuepress/bundler-vite": "2.0.0-rc.20",
"only-allow": "1.2.1",
"simple-git-hooks": "2.11.1",
"ts-node": "^10.9.2",
"vuepress": "2.0.0-rc.20"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint",
"prepare-commit-msg": "pnpm build"
"pre-commit": "pnpm lint:fix",
"commit-msg": "pnpm check:commit"
}
}
2,920 changes: 1,639 additions & 1,281 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions scripts/build-image
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

npx node --loader ts-node/esm --no-warnings scripts/core/build-image.ts
15 changes: 8 additions & 7 deletions scripts/ci
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#!/bin/bash
##
## 依赖安装脚本
## 使用:
## ./scripts/ci
##

#
# 依赖安装脚本
# 使用:
# ./scripts/ci
#

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

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

# 导出corepack环境变量,安装pnpm版本
export COREPACK_NPM_REGISTRY=$NPM_REGISTRY COREPACK_INTEGRITY_KEYS=0 && corepack enable pnpm
export COREPACK_NPM_REGISTRY=$NPM_REGISTRY COREPACK_INTEGRITY_KEYS=0 && corepack enable pnpm

# 安装项目依赖 -w -F @142vip/fairy-cli
# 安装项目依赖
pnpm i --registry $NPM_REGISTRY --frozen-lockfile "$@"
24 changes: 6 additions & 18 deletions scripts/bundle → scripts/core/build-image.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
#!/usr/bin/env node

import { OPEN_SOURCE_ADDRESS, OPEN_SOURCE_AUTHOR, VipDocker, VipGit, VipNodeJS, VipPackageJSON } from '@142vip/utils'
/**
* 功能:构建Docker镜像
* 使用:
* - ./scripts/bundle
* - ./scripts/bundle --proxy
*/

import {
OPEN_SOURCE_ADDRESS,
OPEN_SOURCE_AUTHOR,
VipDocker,
VipGit,
VipNodeJS,
VipPackageJSON,
} from '@142vip/utils'

(async () => {
async function buildImageMain(): Promise<void> {
try {
// 获取package.json文件
const { name, version, description } = VipPackageJSON.getPackageJSON()
const { name, version, description } = VipPackageJSON.getPackageJSON<{ description: string }>()

// 镜像地址
const imageName = `${OPEN_SOURCE_ADDRESS.DOCKER_ALIYUNCS_VIP}/docs:${name}-${version}`
Expand Down Expand Up @@ -50,4 +36,6 @@ import {
catch (e) {
console.log('异常信息:', e)
}
})()
}

void buildImageMain()
15 changes: 15 additions & 0 deletions scripts/core/verify-commit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { commitLiner } from '@142vip/commit-linter'
import { VipColor, VipConsole, vipLogger } from '@142vip/utils'

/**
* 验证Git Commit信息
*/
async function verifyCommitMain() {
const { type, scope, subject, commit } = commitLiner()

// 提交符合规范,打印相关信息
VipConsole.log(`type: ${type}, scope: ${scope}, subject: ${subject}`)
vipLogger.logByBlank(`${VipColor.greenBright('Git Commit: ')} ${VipColor.green(commit)}`)
}

void verifyCommitMain()
35 changes: 0 additions & 35 deletions scripts/sync

This file was deleted.

8 changes: 2 additions & 6 deletions vuepress.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
getDocSiteBase,
OPEN_SOURCE_ADDRESS,
OPEN_SOURCE_AUTHOR,
} from '@142vip/utils'
import { getDocSiteBase, GitGeneralBranch, OPEN_SOURCE_ADDRESS, OPEN_SOURCE_AUTHOR } from '@142vip/utils'
import {
getCopyRightText,
getFooterHtml,
Expand Down Expand Up @@ -71,7 +67,7 @@ export default defineUserConfig({

// 文档路径,开启编辑功能
docsDir: 'docs',
docsBranch: 'next',
docsBranch: GitGeneralBranch.NEXT,
// 主题布局选项
docsRepo: OPEN_SOURCE_ADDRESS.GITHUB_REPO_JSC,

Expand Down
Loading