rtgl 0.0.11-rc8 → 0.0.12
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 +94 -10
- package/package.json +5 -4
package/cli.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
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 {
|
|
5
|
+
import { buildSite, watchSite, screenshotCommand } from "@rettangoli/sites/cli";
|
|
6
|
+
import { buildSvg } from "@rettangoli/ui/cli";
|
|
6
7
|
import { Command } from "commander";
|
|
7
8
|
import { readFileSync, existsSync } from "fs";
|
|
8
9
|
import { resolve } from "path";
|
|
@@ -54,6 +55,8 @@ feCommand
|
|
|
54
55
|
.command("build")
|
|
55
56
|
.description("Build UI components")
|
|
56
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)")
|
|
57
60
|
.addHelpText(
|
|
58
61
|
"after",
|
|
59
62
|
`
|
|
@@ -62,6 +65,10 @@ Examples:
|
|
|
62
65
|
$ rettangoli fe build
|
|
63
66
|
$ rettangoli fe build --outfile ./dist/bundle.js
|
|
64
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
|
|
65
72
|
`,
|
|
66
73
|
)
|
|
67
74
|
.action((options) => {
|
|
@@ -85,7 +92,8 @@ Examples:
|
|
|
85
92
|
|
|
86
93
|
// Pass dirs, setup, and outfile from config
|
|
87
94
|
options.dirs = config.fe.dirs;
|
|
88
|
-
|
|
95
|
+
// Use setup-path if provided, otherwise use config setup
|
|
96
|
+
options.setup = options.setupPath || config.fe.setup || "setup.js";
|
|
89
97
|
|
|
90
98
|
// Use config outfile if not specified via CLI option
|
|
91
99
|
if (!options.outfile && config.fe.outfile) {
|
|
@@ -124,6 +132,7 @@ feCommand
|
|
|
124
132
|
.command("watch")
|
|
125
133
|
.description("Watch for changes")
|
|
126
134
|
.option("-p, --port <port>", "The port to use", parseInt, 3001)
|
|
135
|
+
.option("-s, --setup-path <path>", "Custom setup file path")
|
|
127
136
|
.addHelpText(
|
|
128
137
|
"after",
|
|
129
138
|
`
|
|
@@ -132,6 +141,8 @@ Examples:
|
|
|
132
141
|
$ rettangoli fe watch
|
|
133
142
|
$ rettangoli fe watch --port 8080
|
|
134
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
|
|
135
146
|
`,
|
|
136
147
|
)
|
|
137
148
|
.action((options) => {
|
|
@@ -155,7 +166,8 @@ Examples:
|
|
|
155
166
|
|
|
156
167
|
// Pass dirs, setup, and outfile from config
|
|
157
168
|
options.dirs = config.fe.dirs;
|
|
158
|
-
|
|
169
|
+
// Use setup-path if provided, otherwise use config setup
|
|
170
|
+
options.setup = options.setupPath || config.fe.setup || "setup.js";
|
|
159
171
|
|
|
160
172
|
// Use config outfile if not specified via CLI option
|
|
161
173
|
if (!options.outfile && config.fe.outfile) {
|
|
@@ -230,17 +242,89 @@ const sitesCommand = program.command("sites").description("Rettangoli Sites");
|
|
|
230
242
|
sitesCommand
|
|
231
243
|
.command("build")
|
|
232
244
|
.description("Build the site")
|
|
233
|
-
.option("-r, --
|
|
234
|
-
.option("-
|
|
235
|
-
.option("-
|
|
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)
|
|
236
248
|
.action(async (options) => {
|
|
237
249
|
console.log("Building site with options:", options);
|
|
238
|
-
await
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
outputPath: options.output,
|
|
250
|
+
await buildSite({
|
|
251
|
+
rootDir: options.rootDir,
|
|
252
|
+
outputPath: options.outputPath,
|
|
242
253
|
});
|
|
243
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
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
const uiCommand = program.command("ui").description("UI component tools");
|
|
294
|
+
|
|
295
|
+
uiCommand
|
|
296
|
+
.command("build-svg")
|
|
297
|
+
.description("Build SVG icons from directory")
|
|
298
|
+
.option("-d, --dir <dir>", "Directory containing SVG files")
|
|
299
|
+
.option("-o, --outfile <path>", "Output file path")
|
|
300
|
+
.addHelpText(
|
|
301
|
+
"after",
|
|
302
|
+
`
|
|
303
|
+
|
|
304
|
+
Examples:
|
|
305
|
+
$ rettangoli ui build-svg
|
|
306
|
+
$ rettangoli ui build-svg --dir ./icons --outfile ./dist/icons.js
|
|
307
|
+
$ rettangoli ui build-svg -d ./assets/svg -o ./public/js/icons.js
|
|
308
|
+
`,
|
|
309
|
+
)
|
|
310
|
+
.action((options) => {
|
|
311
|
+
const config = readConfig();
|
|
312
|
+
|
|
313
|
+
// Use config values if options not provided
|
|
314
|
+
if (!options.dir && config?.ui?.svg?.dir) {
|
|
315
|
+
options.dir = config.ui.svg.dir;
|
|
316
|
+
}
|
|
317
|
+
if (!options.outfile && config?.ui?.svg?.outfile) {
|
|
318
|
+
options.outfile = config.ui.svg.outfile;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Check if required options are available (either from CLI or config)
|
|
322
|
+
if (!options.dir || !options.outfile) {
|
|
323
|
+
console.error("Error: Both dir and outfile are required. Provide them via CLI options or in rettangoli.config.yaml under ui.svg");
|
|
324
|
+
process.exit(1);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
buildSvg(options);
|
|
244
328
|
});
|
|
245
329
|
|
|
246
330
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rtgl",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "CLI tool for Rettangoli - A frontend framework and development toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -47,8 +47,9 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"commander": "^14.0.0",
|
|
49
49
|
"js-yaml": "^4.1.0",
|
|
50
|
-
"@rettangoli/fe": "0.0.
|
|
51
|
-
"@rettangoli/sites": "0.
|
|
52
|
-
"@rettangoli/vt": "0.0.2-rc3"
|
|
50
|
+
"@rettangoli/fe": "0.0.8",
|
|
51
|
+
"@rettangoli/sites": "0.2.0-rc7",
|
|
52
|
+
"@rettangoli/vt": "0.0.2-rc3",
|
|
53
|
+
"@rettangoli/ui": "0.1.3"
|
|
53
54
|
}
|
|
54
55
|
}
|