diff --git a/package.json b/package.json index 10bec413e..c425a5b4d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ec664e2c6..471e6e58d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: 0.0.3-alpha.20 version: 0.0.3-alpha.20 '@142vip/utils': - specifier: 0.0.1-alpha.19 - version: 0.0.1-alpha.19 + specifier: 0.0.1-alpha.20 + version: 0.0.1-alpha.20 '@142vip/vuepress': specifier: 0.0.1-alpha.10 version: 0.0.1-alpha.10(54xyizqayh47jrcbyci2lyxhsy) @@ -133,8 +133,8 @@ packages: '@142vip/utils@0.0.1-alpha.18': resolution: {integrity: sha512-Z5ysjUb9pKE2RsN+Lwgo3qPsljhd2Vfxs0VjnF/2VzpQrC9xwyME+E58kYPO4Y+Z3ljFv16E1Sdl+4Kd+bsuzA==} - '@142vip/utils@0.0.1-alpha.19': - resolution: {integrity: sha512-wyFyGwYG55l+ZNiHqsv3suhZZj5ap7AmZ5g1/vniDxSxJkWIhEDmS/vN+lmYsghVCaDFQ1fp9FG7W6mQ2ZKeRA==} + '@142vip/utils@0.0.1-alpha.20': + resolution: {integrity: sha512-cQ4h+6N/jz7pGTVNWAPenIsySjAvBvWSCoJ6kx70c4X7nuxN1b7HGpCat6Laq4dZNGrySu2R2qp1Lbo8nt0dNQ==} '@142vip/vuepress@0.0.1-alpha.10': resolution: {integrity: sha512-wg2OVn2rIgo3DfzuA/+aGvZl3Xe0AO1SlFR0c+pi4GuqCogA35XGkU3ujvcJljut79NwrD4TmC/6QKMwthYWMQ==} @@ -905,51 +905,61 @@ packages: resolution: {integrity: sha512-UBXdQ4+ATARuFgsFrQ+tAsKvBi/Hly99aSVdeCUiHV9dRTTpMU7OrM3WXGys1l40wKVNiOl0QYY6cZQJ2xhKlQ==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.34.1': resolution: {integrity: sha512-m/yfZ25HGdcCSwmopEJm00GP7xAUyVcBPjttGLRAqZ60X/bB4Qn6gP7XTwCIU6bITeKmIhhwZ4AMh2XLro+4+w==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.34.1': resolution: {integrity: sha512-Wy+cUmFuvziNL9qWRRzboNprqSQ/n38orbjRvd6byYWridp5TJ3CD+0+HUsbcWVSNz9bxkDUkyASGP0zS7GAvg==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.34.1': resolution: {integrity: sha512-CQ3MAGgiFmQW5XJX5W3wnxOBxKwFlUAgSXFA2SwgVRjrIiVt5LHfcQLeNSHKq5OEZwv+VCBwlD1+YKCjDG8cpg==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loongarch64-gnu@4.34.1': resolution: {integrity: sha512-rSzb1TsY4lSwH811cYC3OC2O2mzNMhM13vcnA7/0T6Mtreqr3/qs6WMDriMRs8yvHDI54qxHgOk8EV5YRAHFbw==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-powerpc64le-gnu@4.34.1': resolution: {integrity: sha512-fwr0n6NS0pG3QxxlqVYpfiY64Fd1Dqd8Cecje4ILAV01ROMp4aEdCj5ssHjRY3UwU7RJmeWd5fi89DBqMaTawg==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.34.1': resolution: {integrity: sha512-4uJb9qz7+Z/yUp5RPxDGGGUcoh0PnKF33QyWgEZ3X/GocpWb6Mb+skDh59FEt5d8+Skxqs9mng6Swa6B2AmQZg==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.34.1': resolution: {integrity: sha512-QlIo8ndocWBEnfmkYqj8vVtIUpIqJjfqKggjy7IdUncnt8BGixte1wDON7NJEvLg3Kzvqxtbo8tk+U1acYEBlw==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.34.1': resolution: {integrity: sha512-hzpleiKtq14GWjz3ahWvJXgU1DQC9DteiwcsY4HgqUJUGxZThlL66MotdUEK9zEo0PK/2ADeZGM9LIondE302A==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.34.1': resolution: {integrity: sha512-jqtKrO715hDlvUcEsPn55tZt2TEiBvBtCMkUuU0R6fO/WPT7lO9AONjPbd8II7/asSiNVQHCMn4OLGigSuxVQA==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.34.1': resolution: {integrity: sha512-RnHy7yFf2Wz8Jj1+h8klB93N0NHNHXFhNwAmiy9zJdpY7DE01VbEVtPdrK1kkILeIbHGRJjvfBDBhnxBr8kD4g==} @@ -4774,7 +4784,7 @@ snapshots: qs: 6.13.1 semver: 7.7.1 - '@142vip/utils@0.0.1-alpha.19': + '@142vip/utils@0.0.1-alpha.20': dependencies: ansi-colors: 4.1.3 commander: 12.1.0 diff --git a/scripts/bundle b/scripts/bundle index b62d0b643..a697712aa 100755 --- a/scripts/bundle +++ b/scripts/bundle @@ -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) } })()