From a1c7e8c25c844055b93c5a4f720ab61e591cb529 Mon Sep 17 00:00:00 2001 From: Subhamoy Biswas Date: Sun, 2 Mar 2025 22:15:53 +0530 Subject: [PATCH] (refactor): replaced windows copyFiles.js build script with new tauri resource mapping --- copyFiles.js | 18 ------------------ src-tauri/tauri.windows.conf.json | 12 ++++++------ 2 files changed, 6 insertions(+), 24 deletions(-) delete mode 100644 copyFiles.js diff --git a/copyFiles.js b/copyFiles.js deleted file mode 100644 index 4b12e2a..0000000 --- a/copyFiles.js +++ /dev/null @@ -1,18 +0,0 @@ -import fs from 'fs'; -import path from 'path'; -import { fileURLToPath } from 'url'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -const msghostSrc = path.join(__dirname, 'src-tauri', 'target', 'release', 'pytubepp-helper-msghost.exe'); -const msghostDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost.exe'); -const msghostManifestWinChromeSrc = path.join(__dirname, 'src-tauri', 'msghost-manifest', 'windows', 'chrome', 'com.neosubhamoy.pytubepp.helper.json'); -const msghostManifestWinChromeDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost.json'); -const msghostManifestWinFirefoxSrc = path.join(__dirname, 'src-tauri', 'msghost-manifest', 'windows', 'firefox', 'com.neosubhamoy.pytubepp.helper.json'); -const msghostManifestWinFirefoxDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost-moz.json'); - -fs.copyFileSync(msghostSrc, msghostDest); -fs.copyFileSync(msghostManifestWinChromeSrc, msghostManifestWinChromeDest); -fs.copyFileSync(msghostManifestWinFirefoxSrc, msghostManifestWinFirefoxDest); -console.log('Files copied successfully'); \ No newline at end of file diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index df1e9e8..39b3c4a 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -1,7 +1,7 @@ { "build": { "beforeDevCommand": "cargo build --manifest-path=./src-tauri/msghost/Cargo.toml && npm run dev", - "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && node copyFiles.js && npm run build", + "beforeBuildCommand": "cargo build --release --manifest-path=./src-tauri/msghost/Cargo.toml && npm run build", "devUrl": "http://localhost:1422", "frontendDist": "../dist" }, @@ -62,11 +62,11 @@ "installerHooks": "installer/windows/nsis-hooks.nsi" } }, - "resources": [ - "pytubepp-helper-msghost.json", - "pytubepp-helper-msghost-moz.json", - "pytubepp-helper-msghost.exe" - ], + "resources": { + "msghost-manifest/windows/chrome/com.neosubhamoy.pytubepp.helper.json": "pytubepp-helper-msghost.json", + "msghost-manifest/windows/firefox/com.neosubhamoy.pytubepp.helper.json": "pytubepp-helper-msghost-moz.json", + "target/release/pytubepp-helper-msghost.exe": "pytubepp-helper-msghost.exe" + }, "externalBin": [ "binaries/7zip" ]