delete gitignore_merge.*

This commit is contained in:
luk
2026-10-07 10:45:19 +08:00
parent 093663f62d
commit f743ce02ef
5 changed files with 42 additions and 85 deletions
+11 -21
View File
@@ -1,10 +1,10 @@
#!/usr/bin/env node
// 把「短名@系统版本」解析成本机真实存在的模拟器 UDID(供 emuBootIos.sh 调用)。
//
// node scripts/emuResolveIos.js [email protected] # 短名(见下面别名表)
// node scripts/emuResolveIos.js "iPhone [email protected]" # 写机型全名也行
// node scripts/emuResolveIos.js "iPhone 16" # 不给版本 → 取系统版本最高的那台
// node scripts/emuResolveIos.js FF429526-… # 本来就是 UDID → 原样返回
// node emuResolveIos.js [email protected] # 短名(见下面别名表)
// node emuResolveIos.js "iPhone [email protected]" # 写机型全名也行
// node emuResolveIos.js "iPhone 16" # 不给版本 → 取系统版本最高的那台
// node emuResolveIos.js FF429526-… # 本来就是 UDID → 原样返回
//
// 为什么不用 UDID:UDID 是每台 Mac 各自生成的,换台机器就失效。
// 机型名 + 系统版本是 Xcode 自带的,任何机器上都能查到,所以跨机器可移植。
@@ -19,7 +19,7 @@ const builtinAlias = {
ip16: 'iPhone 16',
ip16plus: 'iPhone 16 Plus',
ip16pro: 'iPhone 16 Pro',
ip16pm: 'iPhone 16 Pro Max'
ip16pm: 'iPhone 16 Pro Max',
}
const rootDir = path.resolve(__dirname, '..')
@@ -30,13 +30,9 @@ try {
pkgConfig = {}
}
const input =
(process.argv[2] || '').trim() ||
String(pkgConfig.defaultIosEmu || '[email protected]').trim()
const input = (process.argv[2] || '').trim() || String(pkgConfig.defaultIosEmu || '[email protected]').trim()
if (
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(input)
) {
if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(input)) {
console.log(input)
process.exit(0)
}
@@ -52,11 +48,9 @@ const version =
.replace(/^iOS\s*/i, '')
const deviceName = pkgConfig[left] || builtinAlias[left.toLowerCase()] || left
const json = JSON.parse(
execSync('xcrun simctl list devices available -j').toString()
)
const runtimeKeyFor = want => `iOS-${want.replace(/\./g, '-')}`
const versionOf = runtimeKey => {
const json = JSON.parse(execSync('xcrun simctl list devices available -j').toString())
const runtimeKeyFor = (want) => `iOS-${want.replace(/\./g, '-')}`
const versionOf = (runtimeKey) => {
const matched = runtimeKey.match(/iOS-(\d+)(?:-(\d+))?/)
return matched ? [Number(matched[1]), Number(matched[2] || 0)] : [0, 0]
}
@@ -77,11 +71,7 @@ for (const [runtimeKey, devices] of Object.entries(json.devices)) {
}
if (matched.length === 0) {
console.error(
`❌ 本机没有匹配的模拟器:${input}(机型「${deviceName}」${
version ? ` + iOS ${version}` : ''
})`
)
console.error(`❌ 本机没有匹配的模拟器:${input}(机型「${deviceName}」${version ? ` + iOS ${version}` : ''})`)
console.error(' 看有哪些:xcrun simctl list devices available')
process.exit(1)
}