chore: solidify guide P1 snapshot

This commit is contained in:
lyf
2026-06-11 16:18:57 +08:00
parent a90f63cef0
commit 9790501c3b
32 changed files with 4613 additions and 865 deletions

View File

@@ -0,0 +1,44 @@
const fs = require('node:fs')
const path = require('node:path')
const projectRoot = path.resolve(__dirname, '..')
const sourceDir = path.join(projectRoot, 'static', 'nav-assets')
const h5Root = path.join(projectRoot, 'dist', 'build', 'h5')
const targetDir = path.join(h5Root, 'static', 'nav-assets')
const faviconSource = path.join(projectRoot, 'public', 'favicon.svg')
const faviconTarget = path.join(h5Root, 'favicon.svg')
if (!fs.existsSync(h5Root)) {
throw new Error(`H5 build output not found: ${h5Root}`)
}
if (!fs.existsSync(sourceDir)) {
throw new Error(`Navigation assets not found: ${sourceDir}`)
}
const copyDirectory = (source, target) => {
fs.mkdirSync(target, { recursive: true })
for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
const sourcePath = path.join(source, entry.name)
const targetPath = path.join(target, entry.name)
if (entry.isDirectory()) {
copyDirectory(sourcePath, targetPath)
continue
}
if (entry.isFile()) {
fs.copyFileSync(sourcePath, targetPath)
}
}
}
fs.rmSync(targetDir, { recursive: true, force: true })
copyDirectory(sourceDir, targetDir)
if (fs.existsSync(faviconSource)) {
fs.copyFileSync(faviconSource, faviconTarget)
}
console.log(`Copied navigation assets to ${path.relative(projectRoot, targetDir)}`)