rtgl 0.0.11-rc9 → 0.0.13

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 +56 -10
  2. package/package.json +4 -4
package/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { build, scaffold, watch, examples } from "@rettangoli/fe/cli";
4
4
  import { generate, report, accept } from "@rettangoli/vt/cli";
5
- import { copyPagesToSite } from "@rettangoli/sites/cli";
5
+ import { buildSite, watchSite, screenshotCommand } from "@rettangoli/sites/cli";
6
6
  import { buildSvg } from "@rettangoli/ui/cli";
7
7
  import { Command } from "commander";
8
8
  import { readFileSync, existsSync } from "fs";
@@ -55,6 +55,8 @@ feCommand
55
55
  .command("build")
56
56
  .description("Build UI components")
57
57
  .option("-o, --outfile <path>", "The output file")
58
+ .option("-s, --setup-path <path>", "Custom setup file path")
59
+ .option("-d, --development", "Development mode (no minification, no source maps)")
58
60
  .addHelpText(
59
61
  "after",
60
62
  `
@@ -63,6 +65,10 @@ Examples:
63
65
  $ rettangoli fe build
64
66
  $ rettangoli fe build --outfile ./dist/bundle.js
65
67
  $ rettangoli fe build -o ./public/js/main.js
68
+ $ rettangoli fe build --development
69
+ $ rettangoli fe build -d -o ./dist/dev.js
70
+ $ rettangoli fe build -s src/setup.tauri.js
71
+ $ rettangoli fe build --setup-path src/setup.web.js
66
72
  `,
67
73
  )
68
74
  .action((options) => {
@@ -86,7 +92,8 @@ Examples:
86
92
 
87
93
  // Pass dirs, setup, and outfile from config
88
94
  options.dirs = config.fe.dirs;
89
- options.setup = config.fe.setup || "setup.js";
95
+ // Use setup-path if provided, otherwise use config setup
96
+ options.setup = options.setupPath || config.fe.setup || "setup.js";
90
97
 
91
98
  // Use config outfile if not specified via CLI option
92
99
  if (!options.outfile && config.fe.outfile) {
@@ -125,6 +132,7 @@ feCommand
125
132
  .command("watch")
126
133
  .description("Watch for changes")
127
134
  .option("-p, --port <port>", "The port to use", parseInt, 3001)
135
+ .option("-s, --setup-path <path>", "Custom setup file path")
128
136
  .addHelpText(
129
137
  "after",
130
138
  `
@@ -133,6 +141,8 @@ Examples:
133
141
  $ rettangoli fe watch
134
142
  $ rettangoli fe watch --port 8080
135
143
  $ rettangoli fe watch -p 4000
144
+ $ rettangoli fe watch -s src/setup.tauri.js
145
+ $ rettangoli fe watch --setup-path src/setup.web.js
136
146
  `,
137
147
  )
138
148
  .action((options) => {
@@ -156,7 +166,8 @@ Examples:
156
166
 
157
167
  // Pass dirs, setup, and outfile from config
158
168
  options.dirs = config.fe.dirs;
159
- options.setup = config.fe.setup || "setup.js";
169
+ // Use setup-path if provided, otherwise use config setup
170
+ options.setup = options.setupPath || config.fe.setup || "setup.js";
160
171
 
161
172
  // Use config outfile if not specified via CLI option
162
173
  if (!options.outfile && config.fe.outfile) {
@@ -231,17 +242,52 @@ const sitesCommand = program.command("sites").description("Rettangoli Sites");
231
242
  sitesCommand
232
243
  .command("build")
233
244
  .description("Build the site")
234
- .option("-r, --resources <path>", "Path to resources directory", "./sitic")
235
- .option("-p, --pages <path>", "Path to pages directory", "./pages")
236
- .option("-o, --output <path>", "Path to destination directory", "./_site")
245
+ .option("-r, --rootDir <path>", "Path to root directory", "./")
246
+ .option("-o, --outputPath <path>", "Path to destination directory", "./_site")
247
+ .option("-s, --screenshots", "Capture screenshots after build", false)
237
248
  .action(async (options) => {
238
249
  console.log("Building site with options:", options);
239
- await copyPagesToSite({
240
- resourcesPath: options.resources,
241
- pagesPath: options.pages,
242
- outputPath: options.output,
250
+ await buildSite({
251
+ rootDir: options.rootDir,
252
+ outputPath: options.outputPath,
243
253
  });
244
254
  console.log("Build completed successfully!");
255
+
256
+ // If screenshots option is enabled, run screenshot command
257
+ if (options.screenshots) {
258
+ console.log("Capturing screenshots...");
259
+ await screenshotCommand({
260
+ rootDir: options.rootDir,
261
+ });
262
+ }
263
+ });
264
+
265
+ sitesCommand
266
+ .command("watch")
267
+ .description("Watch and rebuild site on changes")
268
+ .option("-p, --port <port>", "The port to use", parseInt, 3001)
269
+ .option("-r, --rootDir <path>", "Path to root directory", ".")
270
+ .option("-s, --screenshots", "Enable automatic screenshot capture on page changes", false)
271
+ .action(async (options) => {
272
+ console.log("Starting watch mode with options:", options);
273
+ watchSite({
274
+ port: options.port,
275
+ rootDir: options.rootDir,
276
+ screenshots: options.screenshots,
277
+ });
278
+ });
279
+
280
+ sitesCommand
281
+ .command("screenshot")
282
+ .description("Capture screenshots of all pages")
283
+ .option("-p, --port <port>", "The port to use for temp server", parseInt, 3001)
284
+ .option("-r, --rootDir <path>", "Path to root directory", ".")
285
+ .action(async (options) => {
286
+ console.log("Capturing screenshots with options:", options);
287
+ await screenshotCommand({
288
+ port: options.port,
289
+ rootDir: options.rootDir,
290
+ });
245
291
  });
246
292
 
247
293
  const uiCommand = program.command("ui").description("UI component tools");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rtgl",
3
- "version": "0.0.11-rc9",
3
+ "version": "0.0.13",
4
4
  "description": "CLI tool for Rettangoli - A frontend framework and development toolkit",
5
5
  "type": "module",
6
6
  "bin": {
@@ -47,9 +47,9 @@
47
47
  "dependencies": {
48
48
  "commander": "^14.0.0",
49
49
  "js-yaml": "^4.1.0",
50
- "@rettangoli/fe": "0.0.7-rc6",
51
- "@rettangoli/sites": "0.1.1",
50
+ "@rettangoli/fe": "0.0.9",
51
+ "@rettangoli/sites": "0.2.0-rc7",
52
52
  "@rettangoli/vt": "0.0.2-rc3",
53
- "@rettangoli/ui": "0.1.2-rc9"
53
+ "@rettangoli/ui": "0.1.4"
54
54
  }
55
55
  }