Skip to content

fix: 修复bundle命令构建异常 #222

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 1 commit into from
Feb 14, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"devDependencies": {
"@142vip/eslint-config": "0.0.1-alpha.2",
"@142vip/fairy-cli": "0.0.3-alpha.20",
"@142vip/utils": "0.0.1-alpha.19",
"@142vip/utils": "0.0.1-alpha.20",
"@142vip/vuepress": "0.0.1-alpha.10",
"@vuepress/bundler-vite": "2.0.0-rc.19",
"only-allow": "1.2.1",
Expand Down
20 changes: 15 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 17 additions & 16 deletions scripts/bundle
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,47 @@
* - ./scripts/bundle --proxy
*/

import {createRequire} from 'node:module'
import process from 'node:process'
import {
OPEN_SOURCE_ADDRESS,
VipGit,
OPEN_SOURCE_AUTHOR,
VipDocker,
VipGit,
VipNodeJS,
VipPackageJSON,
} from '@142vip/utils'


(async () => {
try {
// 获取package.json文件
const pkg = createRequire(import.meta.url)('../package.json')
const { name, version, description } = VipPackageJSON.getPackageJSON()

// 镜像地址
const imageName = `${OPEN_SOURCE_ADDRESS.DOCKER_ALIYUNCS_VIP}/docs:${pkg.name}-${pkg.version}`
const imageName = `${OPEN_SOURCE_ADDRESS.DOCKER_ALIYUNCS_VIP}/docs:${name}-${version}`

// 最近一次提交信息
const {hash: gitHash} = await VipGit.getRecentGitCommit()
const gitHash = VipGit.getFirstCommitHash()

// 构建镜像
await VipDocker.buildImage({
imageName,
buildArgs: [
// 参数中是否包含 --proxy
['NEED_PROXY', process.argv.includes('--proxy')],
['APP_NAME', pkg.name],
['APP_VERSION', pkg.version],
['APP_DESCRIPTION', pkg.description],
['AUTHOR', pkg.authorInfo.name],
['EMAIL', pkg.authorInfo.email],
['HOME_PAGE', pkg.authorInfo.homePage],
['NEED_PROXY', VipNodeJS.getProcessArgv().includes('--proxy')],
['APP_NAME', name],
['APP_VERSION', version],
['APP_DESCRIPTION', description],
['AUTHOR', OPEN_SOURCE_AUTHOR.name],
['EMAIL', OPEN_SOURCE_AUTHOR.email],
['HOME_PAGE', OPEN_SOURCE_AUTHOR.homePage],
['GIT_HASH', gitHash],
],
memory:20000,
memory: 20000,
push: true,
delete: true,
logger: true,
})
} catch (e) {
}
catch (e) {
console.log('异常信息:', e)
}
})()
Loading