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
|
node_modules
|
||||||
resources/files
|
resources/files
|
||||||
resources/sidecar
|
resources/sidecar
|
||||||
|
extra
|
||||||
dist
|
dist
|
||||||
out
|
out
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -8,16 +8,17 @@ files:
|
||||||
- '!aur/*'
|
- '!aur/*'
|
||||||
- '!images/*'
|
- '!images/*'
|
||||||
- '!scripts/*'
|
- '!scripts/*'
|
||||||
|
- '!extra/*'
|
||||||
- '!tailwind.config.js'
|
- '!tailwind.config.js'
|
||||||
- '!postcss.config.js'
|
- '!postcss.config.js'
|
||||||
- '!electron.vite.config.{js,ts,mjs,cjs}'
|
- '!electron.vite.config.{js,ts,mjs,cjs}'
|
||||||
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
|
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
|
||||||
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
||||||
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
|
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
|
||||||
asarUnpack:
|
# asarUnpack:
|
||||||
- resources/**
|
# - resources/**
|
||||||
extraResources:
|
extraResources:
|
||||||
- from: './resources/'
|
- from: './extra/'
|
||||||
to: ''
|
to: ''
|
||||||
protocols:
|
protocols:
|
||||||
name: 'Mihomo Party URI Scheme'
|
name: 'Mihomo Party URI Scheme'
|
||||||
|
|
|
@ -129,7 +129,7 @@ function mihomo() {
|
||||||
async function resolveSidecar(binInfo) {
|
async function resolveSidecar(binInfo) {
|
||||||
const { name, targetFile, zipFile, exeFile, downloadURL } = 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)
|
const sidecarPath = path.join(sidecarDir, targetFile)
|
||||||
|
|
||||||
fs.mkdirSync(sidecarDir, { recursive: true })
|
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) {
|
async function resolveResource(binInfo) {
|
||||||
const { file, downloadURL } = 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)
|
const targetPath = path.join(resDir, file)
|
||||||
|
|
||||||
if (fs.existsSync(targetPath)) {
|
if (fs.existsSync(targetPath)) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ export function exePath(): string {
|
||||||
|
|
||||||
export function resourcesDir(): string {
|
export function resourcesDir(): string {
|
||||||
if (is.dev) {
|
if (is.dev) {
|
||||||
return path.join(__dirname, '../../resources')
|
return path.join(__dirname, '../../extra')
|
||||||
} else {
|
} else {
|
||||||
if (app.getAppPath().endsWith('asar')) {
|
if (app.getAppPath().endsWith('asar')) {
|
||||||
return process.resourcesPath
|
return process.resourcesPath
|
||||||
|
|
Loading…
Reference in New Issue
Block a user