rtgl 2.0.0 → 2.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.
Files changed (2) hide show
  1. package/cli.js +86 -34
  2. package/package.json +3 -3
package/cli.js CHANGED
@@ -1,10 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { build, check, scaffold, watch, examples } from "@rettangoli/fe/cli";
4
- import { check as checkContracts } from "@rettangoli/check/cli";
5
- import { generate, screenshot, report, accept } from "@rettangoli/vt/cli";
6
- import { buildSite, watchSite, initSite } from "@rettangoli/sites/cli";
7
- import { buildSvg } from "@rettangoli/ui/cli";
8
3
  import { Command, InvalidArgumentError } from "commander";
9
4
  import { readFileSync, existsSync } from "fs";
10
5
  import { resolve } from "path";
@@ -14,31 +9,80 @@ const packageJson = JSON.parse(
14
9
  readFileSync(new URL("./package.json", import.meta.url)),
15
10
  );
16
11
 
17
- const localBeCliUrl = new URL("../rettangoli-be/src/cli/index.js", import.meta.url);
18
- const beCli = existsSync(localBeCliUrl)
19
- ? await import(localBeCliUrl)
20
- : await import("@rettangoli/be/cli");
21
-
22
- const {
23
- app: appBe,
24
- build: buildBe,
25
- check: checkBe,
26
- compat: compatBe,
27
- db: dbBe,
28
- init: initBe,
29
- manifest: manifestBe,
30
- resume: resumeBe,
31
- scaffold: scaffoldBe,
32
- start: startBe,
33
- test: testBe,
34
- verify: verifyBe,
35
- watch: watchBe,
36
- } = beCli;
37
- const localBeRuntimeConfigUrl = new URL("../rettangoli-be/src/runtime/loadBeProjectConfig.js", import.meta.url);
38
- const beRuntimeConfig = existsSync(localBeRuntimeConfigUrl)
39
- ? await import(localBeRuntimeConfigUrl)
40
- : await import("@rettangoli/be/runtime/loadBeProjectConfig");
41
- const { loadBeProjectConfig: loadBeRuntimeConfig } = beRuntimeConfig;
12
+ const requestedCommand = process.argv[2];
13
+
14
+ let build;
15
+ let check;
16
+ let scaffold;
17
+ let watch;
18
+ let examples;
19
+ let checkContracts;
20
+ let generate;
21
+ let screenshot;
22
+ let report;
23
+ let accept;
24
+ let buildSite;
25
+ let watchSite;
26
+ let initSite;
27
+ let buildSvg;
28
+ let appBe;
29
+ let buildBe;
30
+ let checkBe;
31
+ let compatBe;
32
+ let dbBe;
33
+ let initBe;
34
+ let manifestBe;
35
+ let resumeBe;
36
+ let scaffoldBe;
37
+ let startBe;
38
+ let testBe;
39
+ let verifyBe;
40
+ let watchBe;
41
+ let loadBeRuntimeConfig;
42
+
43
+ if (requestedCommand === "fe") {
44
+ ({ build, check, scaffold, watch, examples } = await import(
45
+ "@rettangoli/fe/cli",
46
+ ));
47
+ } else if (requestedCommand === "check") {
48
+ ({ check: checkContracts } = await import("@rettangoli/check/cli"));
49
+ } else if (requestedCommand === "vt") {
50
+ ({ generate, screenshot, report, accept } = await import("@rettangoli/vt/cli"));
51
+ } else if (requestedCommand === "sites") {
52
+ ({ buildSite, watchSite, initSite } = await import("@rettangoli/sites/cli"));
53
+ } else if (requestedCommand === "ui") {
54
+ ({ buildSvg } = await import("@rettangoli/ui/cli"));
55
+ } else if (requestedCommand === "be") {
56
+ const localBeCliUrl = new URL("../rettangoli-be/src/cli/index.js", import.meta.url);
57
+ const beCli = existsSync(localBeCliUrl)
58
+ ? await import(localBeCliUrl)
59
+ : await import("@rettangoli/be/cli");
60
+
61
+ ({
62
+ app: appBe,
63
+ build: buildBe,
64
+ check: checkBe,
65
+ compat: compatBe,
66
+ db: dbBe,
67
+ init: initBe,
68
+ manifest: manifestBe,
69
+ resume: resumeBe,
70
+ scaffold: scaffoldBe,
71
+ start: startBe,
72
+ test: testBe,
73
+ verify: verifyBe,
74
+ watch: watchBe,
75
+ } = beCli);
76
+
77
+ const localBeRuntimeConfigUrl = new URL(
78
+ "../rettangoli-be/src/runtime/loadBeProjectConfig.js",
79
+ import.meta.url,
80
+ );
81
+ const beRuntimeConfig = existsSync(localBeRuntimeConfigUrl)
82
+ ? await import(localBeRuntimeConfigUrl)
83
+ : await import("@rettangoli/be/runtime/loadBeProjectConfig");
84
+ ({ loadBeProjectConfig: loadBeRuntimeConfig } = beRuntimeConfig);
85
+ }
42
86
 
43
87
  function requireBeCommand(handler, name) {
44
88
  if (typeof handler !== "function") {
@@ -274,7 +318,7 @@ Examples:
274
318
  $ rettangoli fe build --setup-path src/setup.web.js
275
319
  `,
276
320
  )
277
- .action((options) => {
321
+ .action(async (options) => {
278
322
  const config = readConfig();
279
323
 
280
324
  if (!config) {
@@ -304,7 +348,7 @@ Examples:
304
348
  options.outfile = config.fe.outfile;
305
349
  }
306
350
 
307
- build(options);
351
+ await build(options);
308
352
  });
309
353
 
310
354
  feCommand
@@ -373,6 +417,10 @@ feCommand
373
417
  .description("Watch for changes")
374
418
  .option("-p, --port <port>", "The port to use", parsePortOption, 3001)
375
419
  .option("-s, --setup-path <path>", "Custom setup file path")
420
+ .option(
421
+ "--public-dir <path>",
422
+ "Directory to serve as untransformed static assets",
423
+ )
376
424
  .addHelpText(
377
425
  "after",
378
426
  `
@@ -383,9 +431,10 @@ Examples:
383
431
  $ rettangoli fe watch -p 4000
384
432
  $ rettangoli fe watch -s src/setup.tauri.js
385
433
  $ rettangoli fe watch --setup-path src/setup.web.js
434
+ $ rettangoli fe watch --public-dir static
386
435
  `,
387
436
  )
388
- .action((options) => {
437
+ .action(async (options) => {
389
438
  const config = readConfig();
390
439
 
391
440
  if (!config) {
@@ -414,8 +463,11 @@ Examples:
414
463
  if (!options.outfile && config.fe.outfile) {
415
464
  options.outfile = config.fe.outfile;
416
465
  }
466
+ if (options.publicDir === undefined && config.fe.publicDir !== undefined) {
467
+ options.publicDir = config.fe.publicDir;
468
+ }
417
469
 
418
- watch(options);
470
+ await watch(options);
419
471
  });
420
472
 
421
473
  feCommand
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rtgl",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "CLI tool for Rettangoli - A frontend framework and development toolkit",
5
5
  "type": "module",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://rettangoli.dev/",
40
40
  "engines": {
41
- "node": ">=18.0.0"
41
+ "node": "^20.19.0 || >=22.12.0"
42
42
  },
43
43
  "publishConfig": {
44
44
  "access": "public",
@@ -49,7 +49,7 @@
49
49
  "js-yaml": "^4.1.0",
50
50
  "@rettangoli/check": "0.1.2",
51
51
  "@rettangoli/be": "2.0.0",
52
- "@rettangoli/fe": "1.2.0",
52
+ "@rettangoli/fe": "1.2.2",
53
53
  "@rettangoli/sites": "1.2.0",
54
54
  "@rettangoli/vt": "1.0.5",
55
55
  "@rettangoli/ui": "1.4.2"