mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
reduce package size
This commit is contained in:
parent
893ccec8c3
commit
2a4cb05947
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
node_modules
|
||||
resources/files
|
||||
resources/sidecar
|
||||
extra
|
||||
dist
|
||||
out
|
||||
.DS_Store
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user