@ezetgalaxy/titan 25.13.5 → 25.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +36 -21
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -181,52 +181,67 @@ async function devServer() {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
/* PRODUCTION BUILD */
|
|
184
|
+
// BUILD RELEASE — PRODUCTION READY
|
|
184
185
|
function buildProd() {
|
|
185
|
-
const root = process.cwd();
|
|
186
|
-
const appJs = path.join(root, "app", "app.js");
|
|
187
|
-
|
|
188
186
|
console.log(cyan("Titan: Building production output..."));
|
|
189
187
|
|
|
188
|
+
const root = process.cwd();
|
|
189
|
+
const appJs = path.join(root, "app", "app.js");
|
|
190
|
+
const bundler = path.join(root, "titan", "bundle.js");
|
|
191
|
+
const serverDir = path.join(root, "server");
|
|
192
|
+
const builtActionsDir = path.join(root, "server", "actions");
|
|
193
|
+
const actionsOut = path.join(serverDir, "actions");
|
|
194
|
+
// Ensure app/app.js exists
|
|
190
195
|
if (!fs.existsSync(appJs)) {
|
|
191
|
-
console.log(red("ERROR: app/app.js
|
|
196
|
+
console.log(red("ERROR: app/app.js not found."));
|
|
192
197
|
process.exit(1);
|
|
193
198
|
}
|
|
194
199
|
|
|
195
|
-
|
|
196
|
-
|
|
200
|
+
// Ensure bundler exists
|
|
201
|
+
if (!fs.existsSync(bundler)) {
|
|
202
|
+
console.log(red("ERROR: titan/bundle.js not found."));
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
197
205
|
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
// 1) Generate routes.json and action_map.json
|
|
207
|
+
console.log(cyan("→ Generating Titan metadata..."));
|
|
208
|
+
execSync("node app/app.js --build", { stdio: "inherit" });
|
|
200
209
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
210
|
+
// 2) Bundle JS actions
|
|
211
|
+
console.log(cyan("→ Bundling Titan actions..."));
|
|
212
|
+
execSync("node titan/bundle.js", { stdio: "inherit" });
|
|
204
213
|
|
|
205
|
-
|
|
214
|
+
// 3) Ensure server/actions exists
|
|
215
|
+
fs.mkdirSync(actionsOut, { recursive: true }); // FIX: mandatory
|
|
206
216
|
|
|
207
|
-
|
|
208
|
-
|
|
217
|
+
// 4) Copy bundled actions to server/actions
|
|
218
|
+
if (fs.existsSync(builtActionsDir)) {
|
|
219
|
+
for (const file of fs.readdirSync(builtActionsDir)) {
|
|
209
220
|
if (file.endsWith(".jsbundle")) {
|
|
221
|
+
console.log(cyan(`→ Copying ${file}`));
|
|
210
222
|
fs.copyFileSync(
|
|
211
|
-
path.join(
|
|
223
|
+
path.join(builtActionsDir, file),
|
|
212
224
|
path.join(actionsOut, file)
|
|
213
225
|
);
|
|
214
226
|
}
|
|
215
227
|
}
|
|
228
|
+
} else {
|
|
229
|
+
console.log(yellow("Warning: No actions bundled."));
|
|
216
230
|
}
|
|
217
231
|
|
|
218
|
-
|
|
219
232
|
console.log(green("✔ Actions copied to server/actions"));
|
|
220
233
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
234
|
+
// 5) Build Rust binary
|
|
235
|
+
console.log(cyan("→ Building Rust release binary..."));
|
|
236
|
+
execSync("cargo build --release", {
|
|
237
|
+
cwd: serverDir,
|
|
238
|
+
stdio: "inherit"
|
|
225
239
|
});
|
|
226
240
|
|
|
227
|
-
console.log(green("✔
|
|
241
|
+
console.log(green("✔ Titan production build complete!"));
|
|
228
242
|
}
|
|
229
243
|
|
|
244
|
+
|
|
230
245
|
/* START PRODUCTION BINARY */
|
|
231
246
|
function startProd() {
|
|
232
247
|
const isWin = process.platform === "win32";
|