@elurjs/universal 0.1.9 → 0.1.10
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/cli/create-app.mjs +13 -8
- package/cli/dev.mjs +45 -16
- package/cli/doctor.mjs +40 -14
- package/docs/INSTALACION-Y-DEV.md +10 -6
- package/package.json +1 -1
package/cli/create-app.mjs
CHANGED
|
@@ -105,9 +105,12 @@ Prerequisitos por plataforma:
|
|
|
105
105
|
compila aparte: \`cmake -B targets/linux/build && cmake --build
|
|
106
106
|
targets/linux/build\` (el scaffold no copia \`targets/linux\` — el
|
|
107
107
|
source está en \`node_modules/@elurjs/universal/targets/linux\`).
|
|
108
|
-
- windows —
|
|
109
|
-
|
|
110
|
-
/
|
|
108
|
+
- windows — nativo: VS Build Tools 2022 (VCTools + MSBuild + Windows
|
|
109
|
+
11 SDK); NuGet resuelve WindowsAppSDK/CppWinRT con \`msbuild
|
|
110
|
+
targets/windows/elur-windows.vcxproj /restore\`. El loop dev es
|
|
111
|
+
local — \`dev:windows\` relanza \`elur-windows.exe\`. Desde
|
|
112
|
+
Linux/macOS hacia un host remoto: \`ELUR_WIN_SSH=user@host[:port]\`
|
|
113
|
+
habilita scp + relanzado por \`schtasks\` (ADR-0220).
|
|
111
114
|
|
|
112
115
|
Qué hace cada script:
|
|
113
116
|
- \`bun run dev\` — web: \`targets/web/dist\` + servidor en
|
|
@@ -122,10 +125,11 @@ Qué hace cada script:
|
|
|
122
125
|
- \`bun run dev:linux\` — \`generated/elurApp.js\` + relanza
|
|
123
126
|
\`targets/linux/build/elur-linux\` si hay binario + display;
|
|
124
127
|
\`--full\` además corre \`cmake --build\` del host.
|
|
125
|
-
- \`bun run dev:windows\` —
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
128
|
+
- \`bun run dev:windows\` — en Windows relanza
|
|
129
|
+
\`elur-windows.exe\` compilado (loop local nativo); desde
|
|
130
|
+
Linux/macOS con \`ELUR_WIN_SSH\` hace scp a \`ELUR_WIN_DIR\` y
|
|
131
|
+
relanza remoto por \`schtasks\` (ADR-0220); sin host disponible
|
|
132
|
+
solo deja el bundle en \`generated/\`.
|
|
129
133
|
- \`bun run gen:routes\` — regenera \`src/routes.gen.ts\` cuando hay
|
|
130
134
|
\`app/\` con \`page.ts\` (\`elur dev\` lo corre solo al detectarlo).
|
|
131
135
|
- Builds — \`build:web\` → \`targets/web/dist\` (app.js IIFE +
|
|
@@ -444,7 +448,8 @@ ${agentsDev}
|
|
|
444
448
|
- Prerequisitos: \`bun run gateway\` corriendo + un cliente abierto
|
|
445
449
|
(\`bun run dev\`, \`dev:android\` con APK instalado, \`dev:linux\`
|
|
446
450
|
con el binario en \`targets/linux/build/elur-linux\`, o
|
|
447
|
-
\`dev:windows\` con
|
|
451
|
+
\`dev:windows\` con el host compilado en Windows o remoto por
|
|
452
|
+
\`ELUR_WIN_SSH\`).
|
|
448
453
|
- Guía detallada del flujo y anti-patrones:
|
|
449
454
|
\`docs/skills/elur-sdui-mcp/SKILL.md\`
|
|
450
455
|
- Arquitectura código+superficie y modelo responsive:
|
package/cli/dev.mjs
CHANGED
|
@@ -93,11 +93,23 @@ function restartLinuxHost() {
|
|
|
93
93
|
linuxProc.on("exit", () => { /* el próximo rebuild relanza */ });
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
|
-
// ADR-0220: el
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
96
|
+
// ADR-0220: en Windows nativo el loop es local (rebuild → relaunch de
|
|
97
|
+
// elur-windows.exe, igual que Linux). Desde Linux/macOS el host corre
|
|
98
|
+
// remoto (VM/otra máquina) alcanzado por SSH — ELUR_WIN_SSH=user@host
|
|
99
|
+
// [:port] habilita scp a ELUR_WIN_DIR + relanzado por la scheduled task
|
|
100
|
+
// ELUR_WIN_TASK (debe existir y ejecutar elur-windows.exe sin --shot).
|
|
101
|
+
let winProc = null;
|
|
102
|
+
function findWindowsHostBin() {
|
|
103
|
+
for (const p of [
|
|
104
|
+
join(process.cwd(), "targets/windows/x64/Release/elur-windows.exe"),
|
|
105
|
+
join(process.cwd(), "targets/windows/x64/Debug/elur-windows.exe"),
|
|
106
|
+
join(root, "targets/windows/x64/Release/elur-windows.exe"),
|
|
107
|
+
join(root, "targets/windows/x64/Debug/elur-windows.exe"),
|
|
108
|
+
]) {
|
|
109
|
+
if (existsSync(p)) return p;
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
101
113
|
function winSshTarget() {
|
|
102
114
|
const raw = process.env.ELUR_WIN_SSH;
|
|
103
115
|
if (!raw) return null;
|
|
@@ -108,14 +120,26 @@ function winSshTarget() {
|
|
|
108
120
|
return { dest: raw, port: "22" };
|
|
109
121
|
}
|
|
110
122
|
function restartWindowsHost() {
|
|
111
|
-
|
|
112
|
-
if (!sshT || noServe) return false;
|
|
113
|
-
const winDir = process.env.ELUR_WIN_DIR ?? "C:/elur/generated";
|
|
114
|
-
const task = process.env.ELUR_WIN_TASK ?? "elur-app-dev";
|
|
123
|
+
if (noServe) return false;
|
|
115
124
|
const genDir = join(process.cwd(), "generated");
|
|
116
125
|
const appName = !devFast && existsSync(join(genDir, "elurApp.es5.qjsc"))
|
|
117
126
|
? "elurApp.es5.qjsc"
|
|
118
127
|
: "elurApp.js";
|
|
128
|
+
if (process.platform === "win32") {
|
|
129
|
+
const bin = findWindowsHostBin();
|
|
130
|
+
if (!bin) return false;
|
|
131
|
+
try { winProc?.kill(); } catch { }
|
|
132
|
+
winProc = spawn(bin, ["--dir", genDir, "--app", appName], {
|
|
133
|
+
cwd: process.cwd(),
|
|
134
|
+
stdio: jsonLogs ? ["ignore", 2, 2] : "inherit",
|
|
135
|
+
});
|
|
136
|
+
winProc.on("exit", () => { /* el próximo rebuild relanza */ });
|
|
137
|
+
return "local";
|
|
138
|
+
}
|
|
139
|
+
const sshT = winSshTarget();
|
|
140
|
+
if (!sshT) return false;
|
|
141
|
+
const winDir = process.env.ELUR_WIN_DIR ?? "C:/elur/generated";
|
|
142
|
+
const task = process.env.ELUR_WIN_TASK ?? "elur-app-dev";
|
|
119
143
|
const scpArgs = ["-P", sshT.port];
|
|
120
144
|
try {
|
|
121
145
|
run("scp", ...scpArgs, join(genDir, "elurSignals.js"),
|
|
@@ -124,22 +148,23 @@ function restartWindowsHost() {
|
|
|
124
148
|
`${sshT.dest}:${winDir}/`);
|
|
125
149
|
run("ssh", "-p", sshT.port, sshT.dest,
|
|
126
150
|
`taskkill /f /im elur-windows.exe 2>nul & schtasks /run /tn ${task}`);
|
|
127
|
-
return
|
|
151
|
+
return "ssh";
|
|
128
152
|
} catch {
|
|
129
153
|
return false;
|
|
130
154
|
}
|
|
131
155
|
}
|
|
132
156
|
const killSsr = () => { try { ssrProc?.kill("SIGKILL"); } catch { } };
|
|
133
157
|
const killLinux = () => { try { linuxProc?.kill("SIGTERM"); } catch { } };
|
|
158
|
+
const killWin = () => { try { winProc?.kill(); } catch { } };
|
|
134
159
|
const stopWeb = () => {
|
|
135
160
|
for (const c of webClients) c.close();
|
|
136
161
|
webClients.clear();
|
|
137
162
|
try { webServer?.stop(true); } catch { }
|
|
138
163
|
webServer = null;
|
|
139
164
|
};
|
|
140
|
-
process.on("exit", () => { killSsr(); killLinux(); stopWeb(); });
|
|
141
|
-
process.on("SIGINT", () => { killSsr(); killLinux(); stopWeb(); process.exit(130); });
|
|
142
|
-
process.on("SIGTERM", () => { killSsr(); killLinux(); stopWeb(); process.exit(143); });
|
|
165
|
+
process.on("exit", () => { killSsr(); killLinux(); killWin(); stopWeb(); });
|
|
166
|
+
process.on("SIGINT", () => { killSsr(); killLinux(); killWin(); stopWeb(); process.exit(130); });
|
|
167
|
+
process.on("SIGTERM", () => { killSsr(); killLinux(); killWin(); stopWeb(); process.exit(143); });
|
|
143
168
|
|
|
144
169
|
const WEB_DIST = () => join(process.cwd(), "targets/web/dist");
|
|
145
170
|
const WEB_MIME = {
|
|
@@ -410,9 +435,13 @@ function rebuild() {
|
|
|
410
435
|
log("dev.build.end", {
|
|
411
436
|
ok: true, ms: Date.now() - t0,
|
|
412
437
|
launch: launched,
|
|
413
|
-
msg: launched
|
|
414
|
-
? "bundle Windows
|
|
415
|
-
:
|
|
438
|
+
msg: launched === "local"
|
|
439
|
+
? "bundle Windows + elur-windows.exe relanzado"
|
|
440
|
+
: launched === "ssh"
|
|
441
|
+
? "bundle Windows copiado + app relanzada (SSH)"
|
|
442
|
+
: process.platform === "win32"
|
|
443
|
+
? "bundle Windows en generated/ (host sin compilar: msbuild elur-windows.vcxproj /restore)"
|
|
444
|
+
: "bundle Windows en generated/ (ELUR_WIN_SSH no definido)",
|
|
416
445
|
});
|
|
417
446
|
return;
|
|
418
447
|
}
|
package/cli/doctor.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
9
9
|
import { join, relative } from "node:path";
|
|
10
|
-
import { execFileSync } from "node:child_process";
|
|
10
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
11
11
|
|
|
12
12
|
const args = process.argv.slice(2);
|
|
13
13
|
const target = args.includes("--target")
|
|
@@ -25,6 +25,18 @@ function cmdVersion(cmd, argv = ["--version"]) {
|
|
|
25
25
|
} catch { return null; }
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// Binarios cuya versión sale por stderr (ssh -V, scp -V) o cuyo éxito es
|
|
29
|
+
// simplemente resolver — devuelve la primera línea de cualquier stream.
|
|
30
|
+
function cmdProbe(cmd, argv) {
|
|
31
|
+
try {
|
|
32
|
+
const r = spawnSync(cmd, argv, { stdio: ["ignore", "pipe", "pipe"] });
|
|
33
|
+
if (r.error) return null;
|
|
34
|
+
const out = (r.stdout?.toString() || r.stderr?.toString() || "")
|
|
35
|
+
.split("\n")[0].trim();
|
|
36
|
+
return out || "presente";
|
|
37
|
+
} catch { return null; }
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
// T-6 — Google Play exige alineación 16KB en .so (nov 2025). Se leen
|
|
29
41
|
// los program headers ELF sin depender de readelf: PT_LOAD debe tener
|
|
30
42
|
// p_align ≥ 0x4000. Devuelve { align } o null si no es ELF válido.
|
|
@@ -200,19 +212,33 @@ if (target === "linux" || !target) {
|
|
|
200
212
|
|
|
201
213
|
if (target === "windows" || !target) {
|
|
202
214
|
console.log("[doctor] windows");
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
if (process.platform === "win32") {
|
|
216
|
+
// Desarrollo nativo (ADR-0220): VS Build Tools 2022 —
|
|
217
|
+
// VCTools + MSBuild + Windows 11 SDK; NuGet resuelve
|
|
218
|
+
// WindowsAppSDK/CppWinRT con msbuild /restore.
|
|
219
|
+
const msbuild = cmdVersion("msbuild", ["-version"])
|
|
220
|
+
?? cmdVersion("vswhere", ["-latest", "-property", "installationVersion"]);
|
|
221
|
+
msbuild ? ok(`msbuild/vswhere ${msbuild}`)
|
|
222
|
+
: fail("VS Build Tools 2022 ausente — msbuild no resoluble en PATH");
|
|
223
|
+
const cmakeW = cmdVersion("cmake");
|
|
224
|
+
cmakeW ? ok(`${cmakeW}`)
|
|
225
|
+
: warn("cmake ausente — solo se usa para quickjs.lib (prebuilt ya enlazado)");
|
|
226
|
+
const exe = existsSync("targets/windows/x64/Release/elur-windows.exe")
|
|
227
|
+
|| existsSync("targets/windows/x64/Debug/elur-windows.exe");
|
|
228
|
+
exe ? ok("elur-windows.exe compilado — dev:windows lo relanza")
|
|
229
|
+
: warn("host sin compilar: msbuild targets/windows/elur-windows.vcxproj /restore");
|
|
230
|
+
} else {
|
|
231
|
+
// Desarrollo hacia un host remoto (VM/otra máquina): el loop por
|
|
232
|
+
// SSH es opción, no requisito — en Windows el loop es local.
|
|
233
|
+
process.env.ELUR_WIN_SSH
|
|
234
|
+
? ok(`ELUR_WIN_SSH=${process.env.ELUR_WIN_SSH} — push+relaunch remoto`)
|
|
235
|
+
: warn("ELUR_WIN_SSH sin definir — dev:windows solo emite el bundle (loop remoto opcional)");
|
|
236
|
+
const ssh = cmdProbe("ssh", ["-V"]);
|
|
237
|
+
ssh ? ok(`ssh presente (${ssh})`)
|
|
238
|
+
: warn("ssh ausente — scp/relaunch remoto no disponible");
|
|
239
|
+
const scp = cmdProbe("scp", ["-V"]);
|
|
240
|
+
scp ? ok("scp presente") : warn("scp ausente — el bundle no viaja");
|
|
241
|
+
}
|
|
216
242
|
}
|
|
217
243
|
|
|
218
244
|
// ── Firma de release (T-6/3.4): qué fuente resuelve el signingConfig
|
|
@@ -111,12 +111,16 @@ Scripts del scaffold (`create-app.mjs`):
|
|
|
111
111
|
`generated/` sin lanzar. `--full` además corre `cmake --build
|
|
112
112
|
targets/linux/build -j4`. Sin dev-fast el host carga
|
|
113
113
|
`elurApp.es5.qjsc` (bytecode) si existe.
|
|
114
|
-
- `bun run dev:windows` → `elur dev --target windows` (ADR-0220):
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
- `bun run dev:windows` → `elur dev --target windows` (ADR-0220): en
|
|
115
|
+
Windows el loop es **nativo local** — relanza `elur-windows.exe`
|
|
116
|
+
(`targets/windows/x64/{Release,Debug}/` o el del paquete) igual que
|
|
117
|
+
el loop GTK en Linux. Toolchain: VS Build Tools 2022 (VCTools +
|
|
118
|
+
MSBuild + Windows 11 SDK); `msbuild elur-windows.vcxproj /restore`
|
|
119
|
+
resuelve los NuGet (WindowsAppSDK 1.6+, CppWinRT 2.0+). Desde
|
|
120
|
+
Linux/macOS el host corre remoto: `ELUR_WIN_SSH=user@host[:port]`
|
|
121
|
+
habilita `scp` de `elurSignals.js`+bundle a `ELUR_WIN_DIR` (default
|
|
122
|
+
`C:/elur/generated`) + `schtasks /run /tn ELUR_WIN_TASK` (default
|
|
123
|
+
`elur-app-dev`; la tarea debe existir y lanzar `elur-windows.exe`).
|
|
120
124
|
|
|
121
125
|
## 4. Build y distribución
|
|
122
126
|
|