Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/devtools/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools/src/models/app.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class AppModel extends StateModel<{

async openWithPicker(): Promise<AppResult> {
const { modal } = this.state;
const path = await modal.showNative<string>(() =>
const path = await modal.showNative<string | null>(() =>
Niva.api.dialog.pickDir()
);

Expand Down Expand Up @@ -154,7 +154,7 @@ export class AppModel extends StateModel<{

async create(): Promise<AppResult> {
const { modal } = this.state;
const path = await modal.showNative<string>(() =>
const path = await modal.showNative<string | null>(() =>
Niva.api.dialog.saveFile()
);

Expand Down
7 changes: 5 additions & 2 deletions packages/devtools/src/models/project.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class ProjectModel extends StateModel<ProjectModelState> {
const _p = {
project: this,
progress,
file: null
file: null as string | null
}
try {
if (osType.toLowerCase().replace(/\s/g, "") === "macos") {
Expand All @@ -184,7 +184,10 @@ export class ProjectModel extends StateModel<ProjectModelState> {

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))
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/types/Niva_zh.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ interface NivaOs {
locale(): Promise<string>;
}

interface ExecOptions {
export interface ExecOptions {
env?: Record<string, string>;
current_dir?: string;
detached?: boolean;
Expand Down