From f25fb09230ed47d2c3ce25270dbade8d1a4e3e4b Mon Sep 17 00:00:00 2001 From: Toby <2287769986@qq.com> Date: Fri, 13 Sep 2024 14:45:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20windows=E7=8E=AF=E5=A2=83=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=BF=90=E8=A1=8C=20(#1535)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: TomyJan Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1535 Co-authored-by: Toby <2287769986@qq.com> Co-committed-by: Toby <2287769986@qq.com> --- packages/core/cli/package.json | 3 ++- packages/core/cli/src/util.ts | 9 +++++++-- pnpm-lock.yaml | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/core/cli/package.json b/packages/core/cli/package.json index b7073859b..dadd30395 100644 --- a/packages/core/cli/package.json +++ b/packages/core/cli/package.json @@ -19,7 +19,7 @@ "scripts": { "build": "rimraf dist && rollup -c", "dev": "rollup -c --watch --watch.include 'src/**' -m inline", - "prepare": "rimraf dist && BUILD_NO_DTS=1 rollup -c --silent", + "prepare": "rimraf dist && cross-env BUILD_NO_DTS=1 rollup -c --silent", "typecheck": "tsc --noEmit" }, "dependencies": { @@ -52,6 +52,7 @@ "@types/lodash": "^4.17.5", "@types/node": "20.14.2", "@types/semver": "^7.5.8", + "cross-env": "^7.0.3", "rimraf": "^5.0.5", "rollup": "^4.14.1", "rollup-plugin-dts": "^6.1.0", diff --git a/packages/core/cli/src/util.ts b/packages/core/cli/src/util.ts index 82a52f17a..155da8147 100644 --- a/packages/core/cli/src/util.ts +++ b/packages/core/cli/src/util.ts @@ -15,7 +15,7 @@ import { import { readFile, writeFile } from 'fs/promises'; import { createRequire } from 'module'; import { Socket } from 'net'; -import { dirname, join, resolve, sep } from 'path'; +import { dirname, join, resolve, sep, win32 } from 'path'; import chalk from 'chalk'; import { config } from 'dotenv'; @@ -208,7 +208,12 @@ export function generateAppDir() { } process.env.APP_PACKAGE_ROOT = appDevDir; } else { - process.env.APP_PACKAGE_ROOT = appPkgPath; + if (win32.isAbsolute(appPkgPath)) { + // windows /c:/xxx + process.env.APP_PACKAGE_ROOT = appPkgPath.substring(1); + } else { + process.env.APP_PACKAGE_ROOT = appPkgPath; + } } buildIndexHtml(); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5004e3da9..2b92e4bc5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -440,6 +440,9 @@ importers: '@types/semver': specifier: ^7.5.8 version: 7.5.8 + cross-env: + specifier: ^7.0.3 + version: 7.0.3 rimraf: specifier: ^5.0.5 version: 5.0.5