Skip to content

Commit 4084fb0

Browse files
committed
chore: small changes
1 parent 2e411a6 commit 4084fb0

File tree

11 files changed

+22
-19
lines changed

11 files changed

+22
-19
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
node_modules/
22
dist/
33
release/
4-
/adb
4+
resources/
55
package-lock.json
66

77
.gradle/
88
.idea/
99
server/**/build/
1010
local.properties
11-
aya.dex
12-
scrcpy.jar

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@
8787
"vite": "^5.4.9",
8888
"webm-muxer": "^5.1.2",
8989
"xml2js": "^0.6.2",
90-
"zx": "^8.1.9"
90+
"zx": "^8.8.0"
9191
}
9292
}

script/adb.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import isMac from 'licia/isMac.js'
33
import normalizePath from 'licia/normalizePath.js'
44
import path from 'path'
55

6-
const adbDir = resolve(__dirname, '../adb')
6+
const adbDir = resolve(__dirname, '../resources/adb')
77

88
await fs.ensureDir(adbDir)
99

script/build.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ await $`npm run build:preload`
1515
await $`npm run build:renderer`
1616

1717
await fs.copy('build', 'dist/build')
18-
await fs.copy('adb', 'dist/adb')
19-
await fs.copy('server/aya.dex', 'dist/server/aya.dex')
20-
await fs.copy('server/scrcpy.jar', 'dist/server/scrcpy.jar')
18+
await fs.copy('resources', 'dist/resources')
2119
cd('dist')
2220

2321
await fs.writeJson('package.json', pkg, {

script/pack.mjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ const config = {
1515
directories: {
1616
output: `../release/${pkg.version}`,
1717
},
18-
files: ['main', 'preload', 'renderer', 'adb', 'server'],
19-
asarUnpack: ['adb/**/*', 'server/**/*'],
18+
files: ['main', 'preload', 'renderer'],
2019
artifactName: '${productName}-${version}-${os}-${arch}.${ext}',
20+
extraResources: {
21+
from: 'resources',
22+
to: './',
23+
filter: ['**/*'],
24+
},
2125
nsis: {
2226
allowToChangeInstallationDirectory: true,
2327
oneClick: false,

script/scrcpy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import normalizePath from 'licia/normalizePath.js'
44
const version = '3.1'
55
const url = `https://github.com/Genymobile/scrcpy/releases/download/v${version}/scrcpy-server-v${version}`
66

7-
const scrcpyDir = normalizePath(path.resolve(__dirname, '../server'))
7+
const scrcpyDir = normalizePath(path.resolve(__dirname, '../resources'))
88
await $`curl -Lk ${url} > ${scrcpyDir}/scrcpy.jar`

script/server.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
$.verbose = true
22
cd('server')
33
await $`./gradlew :server:assembleRelease`
4+
await fs.move('aya.dex', '../resources/aya.dex')

src/main/lib/adb.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { app } from 'electron'
22
import Adb, { Client, Device } from '@devicefarmer/adbkit'
33
import androidDeviceList from 'android-device-list'
4-
import { resolveUnpack, handleEvent } from 'share/main/lib/util'
4+
import { resolveResources, handleEvent } from 'share/main/lib/util'
55
import map from 'licia/map'
66
import types from 'licia/types'
77
import filter from 'licia/filter'
@@ -307,7 +307,7 @@ async function inputKey(deviceId: string, keyCode: number) {
307307
}
308308

309309
async function openAdbCli() {
310-
let cwd = resolveUnpack('adb')
310+
let cwd = resolveResources('adb')
311311
const adbPath = settingsStore.get('adbPath')
312312
if (!isStrBlank(adbPath) && fs.existsSync(adbPath)) {
313313
cwd = path.dirname(adbPath)

src/main/lib/adb/base.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import toNum from 'licia/toNum'
1010
import types from 'licia/types'
1111
import isStr from 'licia/isStr'
1212
import log from 'share/common/log'
13-
import { handleEvent, resolveUnpack } from 'share/main/lib/util'
13+
import { handleEvent, resolveResources } from 'share/main/lib/util'
1414
import isWindows from 'licia/isWindows'
1515
import isStrBlank from 'licia/isStrBlank'
1616
import fs from 'fs-extra'
@@ -178,7 +178,9 @@ export function setDeviceStore(deviceId: string, key: string, value: any) {
178178
}
179179

180180
export function getAdbPath() {
181-
let bin = isWindows ? resolveUnpack('adb/adb.exe') : resolveUnpack('adb/adb')
181+
let bin = isWindows
182+
? resolveResources('adb/adb.exe')
183+
: resolveResources('adb/adb')
182184
const adbPath = settingsStore.get('adbPath')
183185
if (adbPath === 'adb' || (!isStrBlank(adbPath) && fs.existsSync(adbPath))) {
184186
bin = adbPath

src/main/lib/adb/scrcpy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Client } from '@devicefarmer/adbkit'
2-
import { handleEvent, resolveUnpack } from 'share/main/lib/util'
2+
import { handleEvent, resolveResources } from 'share/main/lib/util'
33
import { getDeviceStore, setDeviceStore } from './base'
44
import log from 'share/common/log'
55

@@ -35,7 +35,7 @@ class ScrcpyClient {
3535

3636
const device = client.getDevice(this.deviceId)
3737
await device.push(
38-
resolveUnpack('server/scrcpy.jar'),
38+
resolveResources('scrcpy.jar'),
3939
'/data/local/tmp/aya/scrcpy.jar'
4040
)
4141
}

0 commit comments

Comments
 (0)