Skip to content

Commit 9f17322

Browse files
authored
fix: 修复bundle命令构建异常 (#222)
1 parent ef0219f commit 9f17322

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"devDependencies": {
3030
"@142vip/eslint-config": "0.0.1-alpha.2",
3131
"@142vip/fairy-cli": "0.0.3-alpha.20",
32-
"@142vip/utils": "0.0.1-alpha.19",
32+
"@142vip/utils": "0.0.1-alpha.20",
3333
"@142vip/vuepress": "0.0.1-alpha.10",
3434
"@vuepress/bundler-vite": "2.0.0-rc.19",
3535
"only-allow": "1.2.1",

pnpm-lock.yaml

+15-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/bundle

+17-16
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,47 @@
77
* - ./scripts/bundle --proxy
88
*/
99

10-
import {createRequire} from 'node:module'
11-
import process from 'node:process'
1210
import {
1311
OPEN_SOURCE_ADDRESS,
14-
VipGit,
12+
OPEN_SOURCE_AUTHOR,
1513
VipDocker,
14+
VipGit,
15+
VipNodeJS,
16+
VipPackageJSON,
1617
} from '@142vip/utils'
1718

18-
1919
(async () => {
2020
try {
2121
// 获取package.json文件
22-
const pkg = createRequire(import.meta.url)('../package.json')
22+
const { name, version, description } = VipPackageJSON.getPackageJSON()
2323

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

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

3030
// 构建镜像
3131
await VipDocker.buildImage({
3232
imageName,
3333
buildArgs: [
3434
// 参数中是否包含 --proxy
35-
['NEED_PROXY', process.argv.includes('--proxy')],
36-
['APP_NAME', pkg.name],
37-
['APP_VERSION', pkg.version],
38-
['APP_DESCRIPTION', pkg.description],
39-
['AUTHOR', pkg.authorInfo.name],
40-
['EMAIL', pkg.authorInfo.email],
41-
['HOME_PAGE', pkg.authorInfo.homePage],
35+
['NEED_PROXY', VipNodeJS.getProcessArgv().includes('--proxy')],
36+
['APP_NAME', name],
37+
['APP_VERSION', version],
38+
['APP_DESCRIPTION', description],
39+
['AUTHOR', OPEN_SOURCE_AUTHOR.name],
40+
['EMAIL', OPEN_SOURCE_AUTHOR.email],
41+
['HOME_PAGE', OPEN_SOURCE_AUTHOR.homePage],
4242
['GIT_HASH', gitHash],
4343
],
44-
memory:20000,
44+
memory: 20000,
4545
push: true,
4646
delete: true,
4747
logger: true,
4848
})
49-
} catch (e) {
49+
}
50+
catch (e) {
5051
console.log('异常信息:', e)
5152
}
5253
})()

0 commit comments

Comments
 (0)