From 3f72918dacf236a39239671105d19396f4048e74 Mon Sep 17 00:00:00 2001 From: mosuzi Date: Wed, 14 Jun 2023 18:14:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=9E=84=E5=BB=BAniva=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_Windows.cmd | 2 +- packages/devtools/src/common/utils.ts | 3 ++- packages/devtools/src/models/app.model.ts | 4 ++-- packages/devtools/src/models/project.model.ts | 7 +++++-- packages/types/Niva_zh.d.ts | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/build_Windows.cmd b/build_Windows.cmd index 14dc397..d8e975d 100644 --- a/build_Windows.cmd +++ b/build_Windows.cmd @@ -22,4 +22,4 @@ target\release\niva.exe ^ --project=packages\devtools ^ --build=dist\NivaDevtools.exe -powershell Compress-Archive -Path dist\NivaDevtools.exe -DestinationPath dist\NivaDevtools_%VERSION%_Windows.zip \ No newline at end of file +@REM powershell Compress-Archive -Path dist\NivaDevtools.exe -DestinationPath dist\NivaDevtools_%VERSION%_Windows.zip \ No newline at end of file diff --git a/packages/devtools/src/common/utils.ts b/packages/devtools/src/common/utils.ts index f2da036..786e029 100644 --- a/packages/devtools/src/common/utils.ts +++ b/packages/devtools/src/common/utils.ts @@ -3,6 +3,7 @@ import { AppModel } from "../models/app.model"; import { LocaleModel } from "../models/locale.model"; import { ModalModel } from "../models/modal.model"; import { AppResult } from "./result"; +import { ExecOptions } from '../../../types/Niva_zh' let baseFileSystemUrl: string | null = null; let sep: string | null = null; @@ -190,7 +191,7 @@ export const checkVersion = (modal: ModalModel, locale: LocaleModel) => { }) } -export async function runCmd(cmd: string, args: string[], options?: unknown) { +export async function runCmd(cmd: string, args: string[], options?: ExecOptions) { const { process } = Niva.api; const res = await process.exec( cmd, diff --git a/packages/devtools/src/models/app.model.ts b/packages/devtools/src/models/app.model.ts index 40cd002..e77f1ac 100644 --- a/packages/devtools/src/models/app.model.ts +++ b/packages/devtools/src/models/app.model.ts @@ -43,7 +43,7 @@ export class AppModel extends StateModel<{ async openWithPicker(): Promise { const { modal } = this.state; - const path = await modal.showNative(() => + const path = await modal.showNative(() => Niva.api.dialog.pickDir() ); @@ -154,7 +154,7 @@ export class AppModel extends StateModel<{ async create(): Promise { const { modal } = this.state; - const path = await modal.showNative(() => + const path = await modal.showNative(() => Niva.api.dialog.saveFile() ); diff --git a/packages/devtools/src/models/project.model.ts b/packages/devtools/src/models/project.model.ts index 91edbb7..bc0778c 100644 --- a/packages/devtools/src/models/project.model.ts +++ b/packages/devtools/src/models/project.model.ts @@ -160,7 +160,7 @@ export class ProjectModel extends StateModel { const _p = { project: this, progress, - file: null + file: null as string | null } try { if (osType.toLowerCase().replace(/\s/g, "") === "macos") { @@ -184,7 +184,10 @@ export class ProjectModel extends StateModel { modal .confirm(locale.t("BUILD_SUCCESS"), locale.t("BUILD_SUCCESS_MESSAGE")) - .then((ok) => ok && process.open(dirname(appPath))); + .then((ok) => { + if (!ok) return + return process.open(dirname(appPath)) + }); }); } diff --git a/packages/types/Niva_zh.d.ts b/packages/types/Niva_zh.d.ts index bec85dc..0dee351 100644 --- a/packages/types/Niva_zh.d.ts +++ b/packages/types/Niva_zh.d.ts @@ -705,7 +705,7 @@ interface NivaOs { locale(): Promise; } -interface ExecOptions { +export interface ExecOptions { env?: Record; current_dir?: string; detached?: boolean; From 119ee4e8a55854eee7c96d52cf49ccc9d7076121 Mon Sep 17 00:00:00 2001 From: mosuzi Date: Wed, 14 Jun 2023 18:16:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=8E=E7=9A=84=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_Windows.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_Windows.cmd b/build_Windows.cmd index d8e975d..14dc397 100644 --- a/build_Windows.cmd +++ b/build_Windows.cmd @@ -22,4 +22,4 @@ target\release\niva.exe ^ --project=packages\devtools ^ --build=dist\NivaDevtools.exe -@REM powershell Compress-Archive -Path dist\NivaDevtools.exe -DestinationPath dist\NivaDevtools_%VERSION%_Windows.zip \ No newline at end of file +powershell Compress-Archive -Path dist\NivaDevtools.exe -DestinationPath dist\NivaDevtools_%VERSION%_Windows.zip \ No newline at end of file