feat: publish HoloLake model-native living system source
This commit is contained in:
parent
6ad10edde1
commit
c395dd3a99
2467 changed files with 615073 additions and 0 deletions
54
product-source/hololake-platform/scripts/verify-internal-package-content.mjs
Executable file
54
product-source/hololake-platform/scripts/verify-internal-package-content.mjs
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import { readFile, stat } from 'node:fs/promises'
|
||||
import { basename } from 'node:path'
|
||||
|
||||
const FORBIDDEN = [
|
||||
'guanghubingshuo.com',
|
||||
]
|
||||
|
||||
const REQUIRED = [
|
||||
'guanghulab.com/fifth-domain/bingshuo/hololake-platform',
|
||||
'GLS-SYS-ARCH-001',
|
||||
]
|
||||
|
||||
const targets = process.argv.slice(2)
|
||||
if (targets.length === 0) {
|
||||
console.error('Usage: pnpm verify:internal-package <unpacked-app-file-or-directory> [...]')
|
||||
process.exit(2)
|
||||
}
|
||||
|
||||
async function collectFiles(target) {
|
||||
const info = await stat(target)
|
||||
if (info.isFile()) return [target]
|
||||
const { readdir } = await import('node:fs/promises')
|
||||
const entries = await readdir(target, { withFileTypes: true })
|
||||
return (await Promise.all(entries.map((entry) =>
|
||||
collectFiles(`${target}/${entry.name}`),
|
||||
))).flat()
|
||||
}
|
||||
|
||||
const matches = new Map(REQUIRED.map((needle) => [needle, false]))
|
||||
for (const target of targets) {
|
||||
for (const file of await collectFiles(target)) {
|
||||
const contents = await readFile(file)
|
||||
const text = contents.toString('latin1')
|
||||
for (const forbidden of FORBIDDEN) {
|
||||
if (text.includes(forbidden)) {
|
||||
console.error(`Forbidden private route found in ${file}: ${forbidden}`)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
for (const required of REQUIRED) {
|
||||
if (text.includes(required)) matches.set(required, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const missing = [...matches].filter(([, found]) => !found).map(([needle]) => needle)
|
||||
if (missing.length > 0) {
|
||||
console.error(`Required public architecture markers missing from ${targets.map((target) => basename(target)).join(', ')}: ${missing.join(', ')}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(`Internal package content verified: ${targets.map((target) => basename(target)).join(', ')}`)
|
||||
Loading…
Reference in a new issue