rtgl 1.0.0 → 1.0.2
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.js +53 -25
- package/package.json +7 -7
package/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { build, check, scaffold, watch, examples } from "@rettangoli/fe/cli";
|
|
4
4
|
import { check as checkContracts } from "@rettangoli/check/cli";
|
|
5
|
-
import { build as buildBe, check as checkBe, watch as watchBe } from "@rettangoli/be/cli";
|
|
5
|
+
import { build as buildBe, check as checkBe, start as startBe, watch as watchBe } from "@rettangoli/be/cli";
|
|
6
6
|
import { generate, screenshot, report, accept } from "@rettangoli/vt/cli";
|
|
7
7
|
import { buildSite, watchSite, initSite } from "@rettangoli/sites/cli";
|
|
8
8
|
import { buildSvg } from "@rettangoli/ui/cli";
|
|
@@ -56,6 +56,19 @@ function parsePortOption(value) {
|
|
|
56
56
|
return parsed;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
function resolveBeRuntimePaths(config) {
|
|
60
|
+
const be = config?.be || {};
|
|
61
|
+
const dirs = Array.isArray(be.dirs) && be.dirs.length > 0 ? be.dirs : ["./src/modules"];
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
dirs,
|
|
65
|
+
middlewareDir: be.middlewareDir || "./src/middleware",
|
|
66
|
+
setup: be.setup || "./src/setup.js",
|
|
67
|
+
outdir: be.outdir || "./.rtgl-be/generated",
|
|
68
|
+
domainErrors: be.domainErrors || {},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
59
72
|
const program = new Command();
|
|
60
73
|
|
|
61
74
|
program
|
|
@@ -296,22 +309,20 @@ beCommand
|
|
|
296
309
|
throw new Error("rettangoli.config.yaml not found");
|
|
297
310
|
}
|
|
298
311
|
|
|
299
|
-
|
|
300
|
-
throw new Error("be.dirs not found or empty in config");
|
|
301
|
-
}
|
|
312
|
+
const bePaths = resolveBeRuntimePaths(config);
|
|
302
313
|
|
|
303
|
-
const missingDirs =
|
|
314
|
+
const missingDirs = bePaths.dirs.filter(
|
|
304
315
|
(dir) => !existsSync(resolve(process.cwd(), dir)),
|
|
305
316
|
);
|
|
306
317
|
if (missingDirs.length > 0) {
|
|
307
318
|
throw new Error(`Directories do not exist: ${missingDirs.join(", ")}`);
|
|
308
319
|
}
|
|
309
320
|
|
|
310
|
-
options.dirs =
|
|
311
|
-
options.middlewareDir = options.middlewareDir ||
|
|
312
|
-
options.setup = options.setupPath ||
|
|
313
|
-
options.outdir = options.outdir ||
|
|
314
|
-
options.domainErrors =
|
|
321
|
+
options.dirs = bePaths.dirs;
|
|
322
|
+
options.middlewareDir = options.middlewareDir || bePaths.middlewareDir;
|
|
323
|
+
options.setup = options.setupPath || bePaths.setup;
|
|
324
|
+
options.outdir = options.outdir || bePaths.outdir;
|
|
325
|
+
options.domainErrors = bePaths.domainErrors;
|
|
315
326
|
|
|
316
327
|
buildBe(options);
|
|
317
328
|
});
|
|
@@ -328,23 +339,42 @@ beCommand
|
|
|
328
339
|
throw new Error("rettangoli.config.yaml not found");
|
|
329
340
|
}
|
|
330
341
|
|
|
331
|
-
|
|
332
|
-
throw new Error("be.dirs not found or empty in config");
|
|
333
|
-
}
|
|
342
|
+
const bePaths = resolveBeRuntimePaths(config);
|
|
334
343
|
|
|
335
|
-
const missingDirs =
|
|
344
|
+
const missingDirs = bePaths.dirs.filter(
|
|
336
345
|
(dir) => !existsSync(resolve(process.cwd(), dir)),
|
|
337
346
|
);
|
|
338
347
|
if (missingDirs.length > 0) {
|
|
339
348
|
throw new Error(`Directories do not exist: ${missingDirs.join(", ")}`);
|
|
340
349
|
}
|
|
341
350
|
|
|
342
|
-
options.dirs =
|
|
343
|
-
options.middlewareDir = options.middlewareDir ||
|
|
351
|
+
options.dirs = bePaths.dirs;
|
|
352
|
+
options.middlewareDir = options.middlewareDir || bePaths.middlewareDir;
|
|
344
353
|
|
|
345
354
|
checkBe(options);
|
|
346
355
|
});
|
|
347
356
|
|
|
357
|
+
beCommand
|
|
358
|
+
.command("start")
|
|
359
|
+
.description("Start backend HTTP server")
|
|
360
|
+
.option("--host <host>", "Override host from config")
|
|
361
|
+
.option("--port <port>", "Override port from config", parsePortOption)
|
|
362
|
+
.action(async (options) => {
|
|
363
|
+
const startOptions = {
|
|
364
|
+
cwd: process.cwd(),
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
if (options.host) {
|
|
368
|
+
startOptions.host = options.host;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (options.port !== undefined) {
|
|
372
|
+
startOptions.port = options.port;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
await startBe(startOptions);
|
|
376
|
+
});
|
|
377
|
+
|
|
348
378
|
beCommand
|
|
349
379
|
.command("watch")
|
|
350
380
|
.description("Watch backend files and rebuild generated registry")
|
|
@@ -358,22 +388,20 @@ beCommand
|
|
|
358
388
|
throw new Error("rettangoli.config.yaml not found");
|
|
359
389
|
}
|
|
360
390
|
|
|
361
|
-
|
|
362
|
-
throw new Error("be.dirs not found or empty in config");
|
|
363
|
-
}
|
|
391
|
+
const bePaths = resolveBeRuntimePaths(config);
|
|
364
392
|
|
|
365
|
-
const missingDirs =
|
|
393
|
+
const missingDirs = bePaths.dirs.filter(
|
|
366
394
|
(dir) => !existsSync(resolve(process.cwd(), dir)),
|
|
367
395
|
);
|
|
368
396
|
if (missingDirs.length > 0) {
|
|
369
397
|
throw new Error(`Directories do not exist: ${missingDirs.join(", ")}`);
|
|
370
398
|
}
|
|
371
399
|
|
|
372
|
-
options.dirs =
|
|
373
|
-
options.middlewareDir = options.middlewareDir ||
|
|
374
|
-
options.setup = options.setupPath ||
|
|
375
|
-
options.outdir = options.outdir ||
|
|
376
|
-
options.domainErrors =
|
|
400
|
+
options.dirs = bePaths.dirs;
|
|
401
|
+
options.middlewareDir = options.middlewareDir || bePaths.middlewareDir;
|
|
402
|
+
options.setup = options.setupPath || bePaths.setup;
|
|
403
|
+
options.outdir = options.outdir || bePaths.outdir;
|
|
404
|
+
options.domainErrors = bePaths.domainErrors;
|
|
377
405
|
|
|
378
406
|
watchBe(options);
|
|
379
407
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rtgl",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "CLI tool for Rettangoli - A frontend framework and development toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"commander": "^14.0.0",
|
|
49
49
|
"js-yaml": "^4.1.0",
|
|
50
|
-
"@rettangoli/check": "
|
|
51
|
-
"@rettangoli/be": "
|
|
52
|
-
"@rettangoli/fe": "
|
|
53
|
-
"@rettangoli/sites": "
|
|
54
|
-
"@rettangoli/vt": "
|
|
55
|
-
"@rettangoli/ui": "
|
|
50
|
+
"@rettangoli/check": "0.1.2",
|
|
51
|
+
"@rettangoli/be": "1.0.2",
|
|
52
|
+
"@rettangoli/fe": "1.0.1",
|
|
53
|
+
"@rettangoli/sites": "1.0.0-rc13",
|
|
54
|
+
"@rettangoli/vt": "1.0.1",
|
|
55
|
+
"@rettangoli/ui": "1.0.1"
|
|
56
56
|
}
|
|
57
57
|
}
|