mirror of
https://github.com/mountain-loop/yaak.git
synced 2025-12-05 19:17:44 -06:00
Simpler Tauri resource paths (#112)
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
"name": "@yaakapp-internal/plugin-runtime",
|
||||
"scripts": {
|
||||
"build": "run-p build:*",
|
||||
"build:main": "esbuild src/index.ts --bundle --platform=node --outfile=build/index.cjs",
|
||||
"build:worker": "esbuild src/index.worker.ts --bundle --platform=node --outfile=build/index.worker.cjs",
|
||||
"build:main": "esbuild src/index.ts --bundle --platform=node --outfile=../src-tauri/vendored/plugin-runtime/index.cjs",
|
||||
"build:worker": "esbuild src/index.worker.ts --bundle --platform=node --outfile=../src-tauri/vendored/plugin-runtime/index.worker.cjs",
|
||||
"build:proto": "grpc_tools_node_protoc --ts_proto_out=src/gen --ts_proto_opt=outputServices=nice-grpc,outputServices=generic-definitions,useExactTypes=false --proto_path=../proto ../proto/plugins/*.proto"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
1
scripts/.gitignore
vendored
Normal file
1
scripts/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
tmp-*
|
||||
@@ -47,10 +47,11 @@ if (existsSync(binDest) && tryExecSync(`${binDest} --version`).trim() === NODE_V
|
||||
rmSync(destDir, { recursive: true, force: true });
|
||||
mkdirSync(destDir, { recursive: true });
|
||||
|
||||
(async function () {
|
||||
const url = URL_MAP[key];
|
||||
const tmpDir = path.join(__dirname, 'tmp', Date.now().toString());
|
||||
const url = URL_MAP[key];
|
||||
const tmpDir = path.join(__dirname, 'tmp-node');
|
||||
rmSync(tmpDir, { recursive: true, force: true });
|
||||
|
||||
(async function () {
|
||||
// Download GitHub release artifact
|
||||
const { filePath } = await new Downloader({ url, directory: tmpDir }).download();
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ const key = `${process.platform}_${process.env.YAAK_TARGET_ARCH ?? process.arch}
|
||||
console.log(`Vendoring protoc ${VERSION} for ${key}`);
|
||||
|
||||
const url = URL_MAP[key];
|
||||
const tmpDir = path.join(__dirname, 'tmp', Date.now().toString());
|
||||
const tmpDir = path.join(__dirname, 'tmp-protoc');
|
||||
const binSrc = path.join(tmpDir, SRC_BIN_MAP[key]);
|
||||
const binDst = path.join(dstDir, DST_BIN_MAP[key]);
|
||||
|
||||
@@ -47,6 +47,7 @@ if (existsSync(binDst) && tryExecSync(`${binDst} --version`).trim().includes(VER
|
||||
return;
|
||||
}
|
||||
|
||||
rmSync(tmpDir, { recursive: true, force: true });
|
||||
rmSync(dstDir, { recursive: true, force: true });
|
||||
mkdirSync(dstDir, { recursive: true });
|
||||
|
||||
@@ -64,7 +65,6 @@ mkdirSync(dstDir, { recursive: true });
|
||||
const includeSrc = path.join(tmpDir, 'include');
|
||||
const includeDst = path.join(dstDir, 'include');
|
||||
cpSync(includeSrc, includeDst, { recursive: true });
|
||||
|
||||
rmSync(tmpDir, { recursive: true, force: true });
|
||||
|
||||
console.log('Downloaded protoc to', binDst);
|
||||
|
||||
@@ -56,12 +56,12 @@
|
||||
"icons/release/icon.ico"
|
||||
],
|
||||
"longDescription": "A cross-platform desktop app for interacting with REST, GraphQL, and gRPC",
|
||||
"resources": {
|
||||
"migrations": "migrations",
|
||||
"vendored/protoc/include": "protoc-include",
|
||||
"vendored/plugins": "plugins",
|
||||
"../plugin-runtime/build": "plugin-runtime"
|
||||
},
|
||||
"resources": [
|
||||
"migrations",
|
||||
"vendored/protoc/include",
|
||||
"vendored/plugins",
|
||||
"vendored/plugin-runtime"
|
||||
],
|
||||
"shortDescription": "Play with APIs, intuitively",
|
||||
"targets": [
|
||||
"app",
|
||||
|
||||
@@ -34,7 +34,7 @@ pub async fn fill_pool_from_files(
|
||||
let desc_path = temp_dir().join(random_file_name);
|
||||
let global_import_dir = app_handle
|
||||
.path()
|
||||
.resolve("protoc-include", BaseDirectory::Resource)
|
||||
.resolve("vendored/protoc/protoc-include", BaseDirectory::Resource)
|
||||
.expect("failed to resolve protoc include directory");
|
||||
|
||||
// HACK: Remove UNC prefix for Windows paths
|
||||
|
||||
@@ -126,7 +126,7 @@ impl PluginManager {
|
||||
pub async fn list_plugin_dirs<R: Runtime>(&self, app_handle: &AppHandle<R>) -> Vec<String> {
|
||||
let plugins_dir = app_handle
|
||||
.path()
|
||||
.resolve("plugins", BaseDirectory::Resource)
|
||||
.resolve("vendored/plugins", BaseDirectory::Resource)
|
||||
.expect("failed to resolve plugin directory resource");
|
||||
|
||||
let bundled_plugin_dirs = read_plugins_dir(&plugins_dir)
|
||||
|
||||
@@ -22,7 +22,7 @@ pub async fn start_nodejs_plugin_runtime<R: Runtime>(
|
||||
) -> Result<()> {
|
||||
let plugin_runtime_main = app
|
||||
.path()
|
||||
.resolve("plugin-runtime", BaseDirectory::Resource)?
|
||||
.resolve("vendored/plugin-runtime", BaseDirectory::Resource)?
|
||||
.join("index.cjs");
|
||||
|
||||
// HACK: Remove UNC prefix for Windows paths to pass to sidecar
|
||||
|
||||
Reference in New Issue
Block a user