reduce package size

This commit is contained in:
pompurin404 2024-08-17 12:04:05 +08:00
parent 893ccec8c3
commit 2a4cb05947
No known key found for this signature in database
4 changed files with 9 additions and 7 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
node_modules
resources/files
resources/sidecar
extra
dist
out
.DS_Store

View File

@ -8,16 +8,17 @@ files:
- '!aur/*'
- '!images/*'
- '!scripts/*'
- '!extra/*'
- '!tailwind.config.js'
- '!postcss.config.js'
- '!electron.vite.config.{js,ts,mjs,cjs}'
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
asarUnpack:
- resources/**
# asarUnpack:
# - resources/**
extraResources:
- from: './resources/'
- from: './extra/'
to: ''
protocols:
name: 'Mihomo Party URI Scheme'

View File

@ -129,7 +129,7 @@ function mihomo() {
async function resolveSidecar(binInfo) {
const { name, targetFile, zipFile, exeFile, downloadURL } = binInfo
const sidecarDir = path.join(cwd, 'resources', 'sidecar')
const sidecarDir = path.join(cwd, 'extra', 'sidecar')
const sidecarPath = path.join(sidecarDir, targetFile)
fs.mkdirSync(sidecarDir, { recursive: true })
@ -204,12 +204,12 @@ async function resolveSidecar(binInfo) {
}
/**
* download the file to the resources dir
* download the file to the extra dir
*/
async function resolveResource(binInfo) {
const { file, downloadURL } = binInfo
const resDir = path.join(cwd, 'resources', 'files')
const resDir = path.join(cwd, 'extra', 'files')
const targetPath = path.join(resDir, file)
if (fs.existsSync(targetPath)) {

View File

@ -38,7 +38,7 @@ export function exePath(): string {
export function resourcesDir(): string {
if (is.dev) {
return path.join(__dirname, '../../resources')
return path.join(__dirname, '../../extra')
} else {
if (app.getAppPath().endsWith('asar')) {
return process.resourcesPath