feat: migrate web preview to Next.js
Verify mini program and deploy preview / verify-deploy (push) Successful in 3m30s
Verify mini program and deploy preview / verify-deploy (push) Successful in 3m30s
This commit is contained in:
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { readFileSync, existsSync } from 'node:fs';
|
||||
const required = ['app.js','app.json','pages/index/index.xhsml','pages/discover/discover.xhsml','pages/test/test.js','pages/result/result.js','assets/test-covers/rice.jpg','vendor/poster-editor.cjs','web/index.html','web/app.js'];
|
||||
const required = ['app.js','app.json','pages/index/index.xhsml','pages/discover/discover.xhsml','pages/test/test.js','pages/result/result.js','assets/test-covers/rice.jpg','vendor/poster-editor.cjs','web/package.json','web/next.config.mjs','web/app/page.jsx','web/app/api/[...path]/route.js','web/components/TestArena.jsx','web/components/PosterEditor.jsx'];
|
||||
for (const file of required) if (!existsSync(file)) throw new Error(`Missing ${file}`);
|
||||
JSON.parse(readFileSync('app.json','utf8'));
|
||||
const web = readFileSync('web/index.html','utf8');
|
||||
if (!web.includes('./app.js') || !web.includes('./style.css')) throw new Error('Preview assets are not linked');
|
||||
const nextConfig = readFileSync('web/next.config.mjs','utf8');
|
||||
if (!nextConfig.includes("output: 'standalone'")) throw new Error('Next.js standalone output is required');
|
||||
console.log(`Static checks passed (${required.length} required files).`);
|
||||
|
||||
+9
-5
@@ -10,16 +10,20 @@ required = [
|
||||
"pages/result/result.js",
|
||||
"assets/test-covers/rice.jpg",
|
||||
"vendor/poster-editor.cjs",
|
||||
"web/index.html",
|
||||
"web/app.js",
|
||||
"web/package.json",
|
||||
"web/next.config.mjs",
|
||||
"web/app/page.jsx",
|
||||
"web/app/api/[...path]/route.js",
|
||||
"web/components/TestArena.jsx",
|
||||
"web/components/PosterEditor.jsx",
|
||||
]
|
||||
missing = [name for name in required if not Path(name).is_file()]
|
||||
if missing:
|
||||
raise SystemExit("Missing required files: " + ", ".join(missing))
|
||||
|
||||
json.loads(Path("app.json").read_text())
|
||||
web = Path("web/index.html").read_text()
|
||||
if "./app.js" not in web or "./style.css" not in web:
|
||||
raise SystemExit("Preview assets are not linked")
|
||||
next_config = Path("web/next.config.mjs").read_text()
|
||||
if "output: 'standalone'" not in next_config:
|
||||
raise SystemExit("Next.js standalone output is required")
|
||||
|
||||
print(f"Static checks passed ({len(required)} required files).")
|
||||
|
||||
Reference in New Issue
Block a user