mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
get tea prefix from libtea instead of invoking the cli (#667)
This commit is contained in:
parent
6b9d4ec1d7
commit
d7bc1d3aa9
3 changed files with 10 additions and 15 deletions
|
@ -6,25 +6,20 @@ import type { InstalledPackage } from "../../src/libs/types";
|
||||||
import { mkdirp } from "mkdirp";
|
import { mkdirp } from "mkdirp";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import { SemVer, semver } from "@teaxyz/lib";
|
import { SemVer, semver } from "@teaxyz/lib";
|
||||||
import { execSync } from "child_process";
|
|
||||||
import chokidar from "chokidar";
|
import chokidar from "chokidar";
|
||||||
import { MainWindowNotifier } from "./types";
|
import { MainWindowNotifier } from "./types";
|
||||||
|
import { hooks } from "@teaxyz/lib";
|
||||||
|
|
||||||
type ParsedVersion = { full_name: string; semVer: SemVer };
|
type ParsedVersion = { full_name: string; semVer: SemVer };
|
||||||
|
|
||||||
export const getTeaPath = () => {
|
export const getTeaPath = (): string => {
|
||||||
const homePath = app.getPath("home");
|
|
||||||
let teaPath;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
teaPath = execSync("tea --prefix", { encoding: "utf8" }).trim();
|
return hooks.useConfig().prefix.toString();
|
||||||
log.info(teaPath);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const homePath = app.getPath("home");
|
||||||
log.info("Could not run tea --prefix. Using default path.");
|
log.info("Could not run tea --prefix. Using default path.");
|
||||||
teaPath = path.join(homePath, "./.tea");
|
return path.join(homePath, "./.tea");
|
||||||
}
|
}
|
||||||
|
|
||||||
return teaPath;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const guiFolder = path.join(getTeaPath(), "tea.xyz/gui");
|
const guiFolder = path.join(getTeaPath(), "tea.xyz/gui");
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
"@sentry/electron": "^4.4.0",
|
"@sentry/electron": "^4.4.0",
|
||||||
"@sentry/svelte": "^7.47.0",
|
"@sentry/svelte": "^7.47.0",
|
||||||
"@sentry/vite-plugin": "^0.7.2",
|
"@sentry/vite-plugin": "^0.7.2",
|
||||||
"@teaxyz/lib": "0.4.1",
|
"@teaxyz/lib": "0.6.0",
|
||||||
"@types/electron": "^1.6.10",
|
"@types/electron": "^1.6.10",
|
||||||
"@types/mousetrap": "^1.6.11",
|
"@types/mousetrap": "^1.6.11",
|
||||||
"@vitest/coverage-c8": "^0.27.1",
|
"@vitest/coverage-c8": "^0.27.1",
|
||||||
|
|
|
@ -27,7 +27,7 @@ importers:
|
||||||
'@sveltejs/adapter-static': ^1.0.0-next.48
|
'@sveltejs/adapter-static': ^1.0.0-next.48
|
||||||
'@sveltejs/kit': ^1.15.9
|
'@sveltejs/kit': ^1.15.9
|
||||||
'@tea/ui': workspace:*
|
'@tea/ui': workspace:*
|
||||||
'@teaxyz/lib': 0.4.1
|
'@teaxyz/lib': 0.6.0
|
||||||
'@testing-library/jest-dom': ^5.16.5
|
'@testing-library/jest-dom': ^5.16.5
|
||||||
'@testing-library/svelte': ^3.2.2
|
'@testing-library/svelte': ^3.2.2
|
||||||
'@testing-library/webdriverio': ^3.2.1
|
'@testing-library/webdriverio': ^3.2.1
|
||||||
|
@ -108,7 +108,7 @@ importers:
|
||||||
'@sentry/electron': 4.5.0
|
'@sentry/electron': 4.5.0
|
||||||
'@sentry/svelte': 7.51.2_svelte@3.59.1
|
'@sentry/svelte': 7.51.2_svelte@3.59.1
|
||||||
'@sentry/vite-plugin': 0.7.2
|
'@sentry/vite-plugin': 0.7.2
|
||||||
'@teaxyz/lib': 0.4.1
|
'@teaxyz/lib': 0.6.0
|
||||||
'@types/electron': 1.6.10
|
'@types/electron': 1.6.10
|
||||||
'@types/mousetrap': 1.6.11
|
'@types/mousetrap': 1.6.11
|
||||||
'@vitest/coverage-c8': 0.27.3_jsdom@21.1.2
|
'@vitest/coverage-c8': 0.27.3_jsdom@21.1.2
|
||||||
|
@ -3628,8 +3628,8 @@ packages:
|
||||||
tailwindcss: 3.3.2
|
tailwindcss: 3.3.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@teaxyz/lib/0.4.1:
|
/@teaxyz/lib/0.6.0:
|
||||||
resolution: {integrity: sha512-DVXOFyhbS1fM5acBU4jdR6WybK6Rt15NaO7qqpkRx7TuNz5mX3AHFszHgoNAhnnyyxvXc8cYSeL7OxYzT04hxQ==}
|
resolution: {integrity: sha512-O9lYU/J1h+sbJApGcBUq4RlYymhfwB85k57hyaBhHq87DgXcR1xjhrKk0pfvn52sZT9jUoXH9UhPd1enWadXRQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@deno/shim-crypto': 0.3.1
|
'@deno/shim-crypto': 0.3.1
|
||||||
'@deno/shim-deno': 0.16.1
|
'@deno/shim-deno': 0.16.1
|
||||||
|
|
Loading…
Reference in a new issue