From dbdfdaae931d78f65f7ffff3910517b5a4ce644a Mon Sep 17 00:00:00 2001 From: SpiderMan <445001382@qq.com> Date: Thu, 26 Sep 2024 17:28:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8pnpm?= =?UTF-8?q?=20build=E6=89=93=E5=8C=85=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/build/script/buildConf.ts | 8 ++++---- web/build/script/postBuild.ts | 4 ++-- web/package.json | 3 +++ web/pnpm-lock.yaml | 24 ++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/web/build/script/buildConf.ts b/web/build/script/buildConf.ts index 0567a0d..c3071a8 100644 --- a/web/build/script/buildConf.ts +++ b/web/build/script/buildConf.ts @@ -10,7 +10,7 @@ import { getConfigFileName } from '../getConfigFileName'; import pkg from '../../package.json'; -function createConfig( +async function createConfig( { configName, config, @@ -27,7 +27,7 @@ function createConfig( writable: false, }); `.replace(/\s/g, ''); - fs.mkdirp(getRootPath(OUTPUT_DIR)); + await fs.mkdirp(getRootPath(OUTPUT_DIR)); fs.writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr); console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`); @@ -37,8 +37,8 @@ function createConfig( } } -export function runBuildConfig() { +export async function runBuildConfig() { const config = getEnvConfig(); const configFileName = getConfigFileName(config); - createConfig({ config, configName: configFileName }); + await createConfig({ config, configName: configFileName }); } diff --git a/web/build/script/postBuild.ts b/web/build/script/postBuild.ts index 79c5e8f..441a09a 100644 --- a/web/build/script/postBuild.ts +++ b/web/build/script/postBuild.ts @@ -2,7 +2,7 @@ import { runBuildConfig } from './buildConf'; import chalk from 'chalk'; - +import process from 'node:process' import pkg from '../../package.json'; export const runBuild = async () => { @@ -20,4 +20,4 @@ export const runBuild = async () => { process.exit(1); } }; -runBuild(); +runBuild().then(); diff --git a/web/package.json b/web/package.json index b3e2208..1794042 100644 --- a/web/package.json +++ b/web/package.json @@ -66,6 +66,7 @@ "devDependencies": { "@commitlint/cli": "^19.4.1", "@commitlint/config-conventional": "^19.4.1", + "@types/fs-extra": "^11.0.4", "@types/lodash": "^4.17.7", "@types/node": "^22.5.2", "@typescript-eslint/eslint-plugin": "^8.4.0", @@ -75,6 +76,7 @@ "@vue/compiler-sfc": "^3.4.38", "@vue/eslint-config-typescript": "^13.0.0", "autoprefixer": "^10.4.20", + "chalk": "^5.3.0", "commitizen": "^4.3.0", "core-js": "^3.38.1", "cross-env": "^7.0.3", @@ -87,6 +89,7 @@ "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-vue": "^9.28.0", "esno": "^4.7.0", + "fs-extra": "^11.2.0", "gh-pages": "^6.1.1", "husky": "^9.1.5", "jest": "^29.7.0", diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index cdb374f..0555b2d 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -114,6 +114,9 @@ importers: '@commitlint/config-conventional': specifier: ^19.4.1 version: 19.4.1 + '@types/fs-extra': + specifier: ^11.0.4 + version: 11.0.4 '@types/lodash': specifier: ^4.17.7 version: 4.17.7 @@ -141,6 +144,9 @@ importers: autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.44) + chalk: + specifier: ^5.3.0 + version: 5.3.0 commitizen: specifier: ^4.3.0 version: 4.3.0(@types/node@22.5.2)(typescript@5.5.4) @@ -177,6 +183,9 @@ importers: esno: specifier: ^4.7.0 version: 4.7.0 + fs-extra: + specifier: ^11.2.0 + version: 11.2.0 gh-pages: specifier: ^6.1.1 version: 6.1.1 @@ -1264,6 +1273,9 @@ packages: '@types/estree@1.0.5': resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + '@types/fs-extra@11.0.4': + resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} + '@types/graceful-fs@4.1.9': resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} @@ -1279,6 +1291,9 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/jsonfile@6.1.4': + resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} + '@types/katex@0.16.7': resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==} @@ -5643,6 +5658,11 @@ snapshots: '@types/estree@1.0.5': {} + '@types/fs-extra@11.0.4': + dependencies: + '@types/jsonfile': 6.1.4 + '@types/node': 22.5.2 + '@types/graceful-fs@4.1.9': dependencies: '@types/node': 22.5.2 @@ -5660,6 +5680,10 @@ snapshots: '@types/json-schema@7.0.15': optional: true + '@types/jsonfile@6.1.4': + dependencies: + '@types/node': 22.5.2 + '@types/katex@0.16.7': {} '@types/lodash-es@4.17.12':