chore: land in-progress workspace changes before 1.16.2
The tree carried uncommitted work from several areas (web push, mobile screens, admin charts, test-hygiene cleanup, CI and map docs). It is landed as one commit so the release pipeline can start from a clean tree; the desktop transcript-correction behaviour shipped in the previous commit and is unchanged here.
This commit is contained in:
parent
9c2b6a9782
commit
7fe49c437e
144 changed files with 3760 additions and 4523 deletions
|
|
@ -13,16 +13,107 @@
|
|||
// 사용:
|
||||
// node scripts/ci/verify-native-abi.mjs # release/<version>/win-unpacked 자동 탐색
|
||||
// node scripts/ci/verify-native-abi.mjs --dir <packagedDir>
|
||||
// node scripts/ci/verify-native-abi.mjs --self-test # 필수 prebuild 누락 fixture 검증
|
||||
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import {
|
||||
existsSync,
|
||||
mkdtempSync,
|
||||
mkdirSync,
|
||||
readFileSync,
|
||||
readdirSync,
|
||||
rmSync,
|
||||
writeFileSync,
|
||||
} from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { basename, dirname, join, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
|
||||
|
||||
/** N-API 기반이라 Electron ABI 재빌드는 불필요하지만, 대상 플랫폼 prebuild는 필수다. */
|
||||
const REQUIRED_NAPI = [
|
||||
{ name: 'uiohook-napi', binaryName: 'uiohook-napi.node' },
|
||||
]
|
||||
|
||||
function inferPackagedTarget(directory) {
|
||||
const directoryName = basename(directory)
|
||||
if (directoryName === 'win-unpacked') return { platform: 'win32', arch: 'x64' }
|
||||
|
||||
const macDirectory = /^mac-(.+)$/.exec(directoryName)
|
||||
if (macDirectory) return { platform: 'darwin', arch: macDirectory[1] }
|
||||
if (directoryName === 'mac') return { platform: 'darwin', arch: process.arch }
|
||||
|
||||
return { platform: process.platform, arch: process.arch }
|
||||
}
|
||||
|
||||
function requiredNapiResults(unpackedRoot, target) {
|
||||
const failures = []
|
||||
const notes = []
|
||||
|
||||
for (const module of REQUIRED_NAPI) {
|
||||
const binaryPath = join(
|
||||
unpackedRoot,
|
||||
module.name,
|
||||
'prebuilds',
|
||||
`${target.platform}-${target.arch}`,
|
||||
module.binaryName,
|
||||
)
|
||||
if (!existsSync(binaryPath)) {
|
||||
failures.push(
|
||||
`${module.name}: ${target.platform}-${target.arch} 필수 N-API prebuild가 없습니다 → ${binaryPath}`,
|
||||
)
|
||||
} else {
|
||||
notes.push(
|
||||
`${module.name}: ${target.platform}-${target.arch} 필수 N-API prebuild 존재 확인`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return { failures, notes }
|
||||
}
|
||||
|
||||
function runSelfTest() {
|
||||
const fixtureRoot = mkdtempSync(join(tmpdir(), 'd3ro-native-abi-'))
|
||||
const target = { platform: 'win32', arch: 'x64' }
|
||||
const binaryPath = join(
|
||||
fixtureRoot,
|
||||
'uiohook-napi',
|
||||
'prebuilds',
|
||||
'win32-x64',
|
||||
'uiohook-napi.node',
|
||||
)
|
||||
|
||||
try {
|
||||
const missing = requiredNapiResults(fixtureRoot, target)
|
||||
if (missing.failures.length !== 1 || !missing.failures[0].includes(binaryPath)) {
|
||||
throw new Error('누락된 win32-x64 prebuild가 실패로 고정되지 않았습니다.')
|
||||
}
|
||||
|
||||
mkdirSync(dirname(binaryPath), { recursive: true })
|
||||
writeFileSync(binaryPath, 'fixture')
|
||||
|
||||
const present = requiredNapiResults(fixtureRoot, target)
|
||||
if (present.failures.length !== 0 || present.notes.length !== 1) {
|
||||
throw new Error('존재하는 win32-x64 prebuild fixture가 통과하지 못했습니다.')
|
||||
}
|
||||
|
||||
console.log('[native-abi] SELF-TEST GREEN — win32-x64 prebuild 누락/존재 계약 확인')
|
||||
} finally {
|
||||
rmSync(fixtureRoot, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv.includes('--self-test')) {
|
||||
runSelfTest()
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const dirFlagIndex = process.argv.indexOf('--dir')
|
||||
let packagedDir = dirFlagIndex >= 0 ? process.argv[dirFlagIndex + 1] : null
|
||||
let packagedDir =
|
||||
dirFlagIndex >= 0 && process.argv[dirFlagIndex + 1]
|
||||
? resolve(process.argv[dirFlagIndex + 1])
|
||||
: null
|
||||
|
||||
if (!packagedDir) {
|
||||
const version = JSON.parse(
|
||||
|
|
@ -56,11 +147,6 @@ const REQUIRED_ELECTRON_ABI = [
|
|||
},
|
||||
]
|
||||
|
||||
/** N-API 기반이라 타임 무관 — 존재만 확인 */
|
||||
const NAPI_MODULES = [
|
||||
{ name: 'uiohook-napi', binary: join('uiohook-napi', 'build', 'Release', 'uiohook_napi.node') },
|
||||
]
|
||||
|
||||
const failures = []
|
||||
const notes = []
|
||||
|
||||
|
|
@ -97,14 +183,10 @@ for (const module of REQUIRED_ELECTRON_ABI) {
|
|||
}
|
||||
}
|
||||
|
||||
for (const module of NAPI_MODULES) {
|
||||
const binaryPath = join(unpackedRoot, module.binary)
|
||||
if (!existsSync(binaryPath)) {
|
||||
notes.push(`${module.name}: 바이너리 없음(선택) — ${binaryPath}`)
|
||||
} else {
|
||||
notes.push(`${module.name}: 존재 확인 (N-API)`)
|
||||
}
|
||||
}
|
||||
const target = inferPackagedTarget(packagedDir)
|
||||
const napiResults = requiredNapiResults(unpackedRoot, target)
|
||||
failures.push(...napiResults.failures)
|
||||
notes.push(...napiResults.notes)
|
||||
|
||||
for (const note of notes) console.log(`[native-abi] ${note}`)
|
||||
|
||||
|
|
@ -114,4 +196,4 @@ if (failures.length > 0) {
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('[native-abi] GREEN — 패키징된 네이티브 모듈이 Electron에서 실행 가능한 ABI입니다.')
|
||||
console.log('[native-abi] GREEN — 패키징된 네이티브 모듈이 Electron에서 실행 가능한 ABI입니다.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue