This commit is contained in:
2026-09-30 14:27:39 +08:00
parent 707711b3bd
commit 7ba6a24505
8 changed files with 45 additions and 19 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url'
import { createHash } from 'node:crypto'
const project = resolve(dirname(fileURLToPath(import.meta.url)), '..')
const output = resolve(project, 'unpackage/dist/build/web')
const base = '/pda-domestic/'
const base = '/'
function walk(dir) { return readdirSync(dir).flatMap(name => { const path = resolve(dir, name); return statSync(path).isDirectory() ? walk(path) : [path] }) }
assert.ok(existsSync(resolve(output, 'index.html')), 'Build H5 before verifying')
const files = walk(output).sort()
@@ -17,7 +17,7 @@ for (const ref of refs) {
assert.ok(existsSync(resolve(output, ref.slice(base.length))), `Missing asset: ${ref}`)
}
const js = files.filter(path => path.endsWith('.js')).map(path => readFileSync(path, 'utf8')).join('\n')
assert.ok(js.includes(base), 'Runtime router and assets must know the deployment base')
assert.doesNotMatch(html + js, /\/pda-(?:domestic|overseas)\//, 'Build must not reference the retired subdirectory deployment')
assert.doesNotMatch(js, /VITE_ROOT_DIR|VITE_AUTH_API_BASE_URL|VITE_OVERSEAS_API_BASE_URL|overseas-api|overseasAccessToken/, 'Build contains broad local env or old overseas config')
assert.doesNotMatch(js, /https?:\/\/(?:localhost|127\.0\.0\.1):\d+/, 'Build must not depend on a local dev server')
assert.doesNotMatch(js, /https?:\/\/[^"'\s]+\/api["']/, 'API must be same-origin for this H5 deployment')