feat(runner): pass sceneInfoJson to Rust CLI for enhanced template rendering
This commit is contained in:
@@ -2,7 +2,7 @@ const { spawn } = require("child_process");
|
||||
const path = require("path");
|
||||
|
||||
function runGenerator(params, sseWriter, projectRoot) {
|
||||
const { sourceDir, sceneId, sceneName, sceneKind, targetUrl, outputRoot, lessons } = params;
|
||||
const { sourceDir, sceneId, sceneName, sceneKind, targetUrl, outputRoot, lessons, sceneInfoJson } = params;
|
||||
|
||||
const normalize = (p) => p.replace(/\\/g, "/");
|
||||
|
||||
@@ -35,6 +35,11 @@ function runGenerator(params, sseWriter, projectRoot) {
|
||||
args.push("--lessons", normalize(lessons));
|
||||
}
|
||||
|
||||
// Pass scene info JSON if available
|
||||
if (sceneInfoJson) {
|
||||
args.push("--scene-info-json", sceneInfoJson);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
sseWriter.write(
|
||||
`event: status\ndata: ${JSON.stringify({
|
||||
|
||||
@@ -176,7 +176,7 @@ async function handleGenerate(req, res) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { sourceDir, sceneId, sceneName, sceneKind, targetUrl, outputRoot, lessons } = body;
|
||||
const { sourceDir, sceneId, sceneName, sceneKind, targetUrl, outputRoot, lessons, sceneInfoJson } = body;
|
||||
if (!sourceDir || !sceneId || !sceneName || !outputRoot) {
|
||||
res.writeHead(400, { "Content-Type": "application/json" });
|
||||
res.end(
|
||||
@@ -192,7 +192,7 @@ async function handleGenerate(req, res) {
|
||||
|
||||
try {
|
||||
await runGenerator(
|
||||
{ sourceDir, sceneId, sceneName, sceneKind, targetUrl, outputRoot, lessons },
|
||||
{ sourceDir, sceneId, sceneName, sceneKind, targetUrl, outputRoot, lessons, sceneInfoJson },
|
||||
sseWriter,
|
||||
config.projectRoot
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user