mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-25 02:08:28 +02:00
Simpler Tauri resource paths (#112)
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
"name": "@yaakapp-internal/plugin-runtime",
|
"name": "@yaakapp-internal/plugin-runtime",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "run-p build:*",
|
"build": "run-p build:*",
|
||||||
"build:main": "esbuild src/index.ts --bundle --platform=node --outfile=build/index.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=build/index.worker.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"
|
"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": {
|
"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 });
|
rmSync(destDir, { recursive: true, force: true });
|
||||||
mkdirSync(destDir, { recursive: true });
|
mkdirSync(destDir, { recursive: true });
|
||||||
|
|
||||||
(async function () {
|
const url = URL_MAP[key];
|
||||||
const url = URL_MAP[key];
|
const tmpDir = path.join(__dirname, 'tmp-node');
|
||||||
const tmpDir = path.join(__dirname, 'tmp', Date.now().toString());
|
rmSync(tmpDir, { recursive: true, force: true });
|
||||||
|
|
||||||
|
(async function () {
|
||||||
// Download GitHub release artifact
|
// Download GitHub release artifact
|
||||||
const { filePath } = await new Downloader({ url, directory: tmpDir }).download();
|
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}`);
|
console.log(`Vendoring protoc ${VERSION} for ${key}`);
|
||||||
|
|
||||||
const url = URL_MAP[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 binSrc = path.join(tmpDir, SRC_BIN_MAP[key]);
|
||||||
const binDst = path.join(dstDir, DST_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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rmSync(tmpDir, { recursive: true, force: true });
|
||||||
rmSync(dstDir, { recursive: true, force: true });
|
rmSync(dstDir, { recursive: true, force: true });
|
||||||
mkdirSync(dstDir, { recursive: true });
|
mkdirSync(dstDir, { recursive: true });
|
||||||
|
|
||||||
@@ -64,7 +65,6 @@ mkdirSync(dstDir, { recursive: true });
|
|||||||
const includeSrc = path.join(tmpDir, 'include');
|
const includeSrc = path.join(tmpDir, 'include');
|
||||||
const includeDst = path.join(dstDir, 'include');
|
const includeDst = path.join(dstDir, 'include');
|
||||||
cpSync(includeSrc, includeDst, { recursive: true });
|
cpSync(includeSrc, includeDst, { recursive: true });
|
||||||
|
|
||||||
rmSync(tmpDir, { recursive: true, force: true });
|
rmSync(tmpDir, { recursive: true, force: true });
|
||||||
|
|
||||||
console.log('Downloaded protoc to', binDst);
|
console.log('Downloaded protoc to', binDst);
|
||||||
|
|||||||
@@ -56,12 +56,12 @@
|
|||||||
"icons/release/icon.ico"
|
"icons/release/icon.ico"
|
||||||
],
|
],
|
||||||
"longDescription": "A cross-platform desktop app for interacting with REST, GraphQL, and gRPC",
|
"longDescription": "A cross-platform desktop app for interacting with REST, GraphQL, and gRPC",
|
||||||
"resources": {
|
"resources": [
|
||||||
"migrations": "migrations",
|
"migrations",
|
||||||
"vendored/protoc/include": "protoc-include",
|
"vendored/protoc/include",
|
||||||
"vendored/plugins": "plugins",
|
"vendored/plugins",
|
||||||
"../plugin-runtime/build": "plugin-runtime"
|
"vendored/plugin-runtime"
|
||||||
},
|
],
|
||||||
"shortDescription": "Play with APIs, intuitively",
|
"shortDescription": "Play with APIs, intuitively",
|
||||||
"targets": [
|
"targets": [
|
||||||
"app",
|
"app",
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ pub async fn fill_pool_from_files(
|
|||||||
let desc_path = temp_dir().join(random_file_name);
|
let desc_path = temp_dir().join(random_file_name);
|
||||||
let global_import_dir = app_handle
|
let global_import_dir = app_handle
|
||||||
.path()
|
.path()
|
||||||
.resolve("protoc-include", BaseDirectory::Resource)
|
.resolve("vendored/protoc/protoc-include", BaseDirectory::Resource)
|
||||||
.expect("failed to resolve protoc include directory");
|
.expect("failed to resolve protoc include directory");
|
||||||
|
|
||||||
// HACK: Remove UNC prefix for Windows paths
|
// 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> {
|
pub async fn list_plugin_dirs<R: Runtime>(&self, app_handle: &AppHandle<R>) -> Vec<String> {
|
||||||
let plugins_dir = app_handle
|
let plugins_dir = app_handle
|
||||||
.path()
|
.path()
|
||||||
.resolve("plugins", BaseDirectory::Resource)
|
.resolve("vendored/plugins", BaseDirectory::Resource)
|
||||||
.expect("failed to resolve plugin directory resource");
|
.expect("failed to resolve plugin directory resource");
|
||||||
|
|
||||||
let bundled_plugin_dirs = read_plugins_dir(&plugins_dir)
|
let bundled_plugin_dirs = read_plugins_dir(&plugins_dir)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ pub async fn start_nodejs_plugin_runtime<R: Runtime>(
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let plugin_runtime_main = app
|
let plugin_runtime_main = app
|
||||||
.path()
|
.path()
|
||||||
.resolve("plugin-runtime", BaseDirectory::Resource)?
|
.resolve("vendored/plugin-runtime", BaseDirectory::Resource)?
|
||||||
.join("index.cjs");
|
.join("index.cjs");
|
||||||
|
|
||||||
// HACK: Remove UNC prefix for Windows paths to pass to sidecar
|
// HACK: Remove UNC prefix for Windows paths to pass to sidecar
|
||||||
|
|||||||
Reference in New Issue
Block a user