rtgl 0.0.2 → 0.0.4
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 +110 -14
- package/package.json +5 -4
- package/LICENSE +0 -21
package/cli.js
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { build, scaffold, watch } from "rettangoli-fe/cli";
|
|
4
|
-
import { generate, report, accept } from "rettangoli
|
|
5
|
-
import { copyPagesToSite } from "rettangoli
|
|
3
|
+
import { build, scaffold, watch, examples } from "rettangoli-fe/cli";
|
|
4
|
+
import { generate, report, accept } from "@rettangoli/vt/cli";
|
|
5
|
+
import { copyPagesToSite } from "@rettangoli/sites/cli";
|
|
6
6
|
import { Command } from "commander";
|
|
7
|
+
import { readFileSync, existsSync } from "fs";
|
|
8
|
+
import { resolve } from "path";
|
|
9
|
+
import yaml from "js-yaml";
|
|
10
|
+
|
|
11
|
+
// Function to read config file
|
|
12
|
+
function readConfig() {
|
|
13
|
+
const configPath = resolve(process.cwd(), "rettangoli.config.yaml");
|
|
14
|
+
|
|
15
|
+
if (!existsSync(configPath)) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const configContent = readFileSync(configPath, "utf8");
|
|
21
|
+
return yaml.load(configContent);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error("Error reading config file:", error.message);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
7
28
|
|
|
8
29
|
const program = new Command();
|
|
9
30
|
|
|
@@ -20,7 +41,7 @@ program.addHelpText(
|
|
|
20
41
|
Examples:
|
|
21
42
|
$ rettangoli fe build
|
|
22
43
|
$ rettangoli fe scaffold -c components -n Button
|
|
23
|
-
$ rettangoli fe watch -
|
|
44
|
+
$ rettangoli fe watch -p 3001
|
|
24
45
|
`,
|
|
25
46
|
);
|
|
26
47
|
|
|
@@ -29,19 +50,43 @@ const feCommand = program.command("fe").description("Frontend framework");
|
|
|
29
50
|
feCommand
|
|
30
51
|
.command("build")
|
|
31
52
|
.description("Build UI components")
|
|
32
|
-
.option("-
|
|
33
|
-
.option("-o, --outfile <path>", "The output file", "./viz/static/main.js")
|
|
53
|
+
.option("-o, --outfile <path>", "The output file")
|
|
34
54
|
.addHelpText(
|
|
35
55
|
"after",
|
|
36
56
|
`
|
|
37
57
|
|
|
38
58
|
Examples:
|
|
39
59
|
$ rettangoli fe build
|
|
40
|
-
$ rettangoli fe build --
|
|
41
|
-
$ rettangoli fe build -
|
|
60
|
+
$ rettangoli fe build --outfile ./dist/bundle.js
|
|
61
|
+
$ rettangoli fe build -o ./public/js/main.js
|
|
42
62
|
`,
|
|
43
63
|
)
|
|
44
64
|
.action((options) => {
|
|
65
|
+
const config = readConfig();
|
|
66
|
+
|
|
67
|
+
if (!config) {
|
|
68
|
+
throw new Error("rettangoli.config.yaml not found");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!config.fe?.dirs?.length) {
|
|
72
|
+
throw new Error("fe.dirs not found or empty in config");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Validate that directories exist
|
|
76
|
+
const missingDirs = config.fe.dirs.filter(dir => !existsSync(resolve(process.cwd(), dir)));
|
|
77
|
+
if (missingDirs.length > 0) {
|
|
78
|
+
throw new Error(`Directories do not exist: ${missingDirs.join(", ")}`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Pass dirs, setup, and outfile from config
|
|
82
|
+
options.dirs = config.fe.dirs;
|
|
83
|
+
options.setup = config.fe.setup || 'setup.js';
|
|
84
|
+
|
|
85
|
+
// Use config outfile if not specified via CLI option
|
|
86
|
+
if (!options.outfile && config.fe.outfile) {
|
|
87
|
+
options.outfile = config.fe.outfile;
|
|
88
|
+
}
|
|
89
|
+
|
|
45
90
|
build(options);
|
|
46
91
|
});
|
|
47
92
|
|
|
@@ -73,7 +118,6 @@ Examples:
|
|
|
73
118
|
feCommand
|
|
74
119
|
.command("watch")
|
|
75
120
|
.description("Watch for changes")
|
|
76
|
-
.option("-d, --dirs <dirs...>", "The directories to watch", ["./example"])
|
|
77
121
|
.option("-p, --port <port>", "The port to use", parseInt, 3001)
|
|
78
122
|
.addHelpText(
|
|
79
123
|
"after",
|
|
@@ -82,14 +126,44 @@ feCommand
|
|
|
82
126
|
Examples:
|
|
83
127
|
$ rettangoli fe watch
|
|
84
128
|
$ rettangoli fe watch --port 8080
|
|
85
|
-
$ rettangoli fe watch
|
|
86
|
-
$ rettangoli fe watch -d ./src -d ./lib -p 4000
|
|
129
|
+
$ rettangoli fe watch -p 4000
|
|
87
130
|
`,
|
|
88
131
|
)
|
|
89
132
|
.action((options) => {
|
|
133
|
+
const config = readConfig();
|
|
134
|
+
|
|
135
|
+
if (!config) {
|
|
136
|
+
throw new Error("rettangoli.config.yaml not found");
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!config.fe?.dirs?.length) {
|
|
140
|
+
throw new Error("fe.dirs not found or empty in config");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Validate that directories exist
|
|
144
|
+
const missingDirs = config.fe.dirs.filter(dir => !existsSync(resolve(process.cwd(), dir)));
|
|
145
|
+
if (missingDirs.length > 0) {
|
|
146
|
+
throw new Error(`Directories do not exist: ${missingDirs.join(", ")}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Pass dirs and setup from config
|
|
150
|
+
options.dirs = config.fe.dirs;
|
|
151
|
+
options.setup = config.fe.setup || 'setup.js';
|
|
90
152
|
watch(options);
|
|
91
153
|
});
|
|
92
154
|
|
|
155
|
+
|
|
156
|
+
feCommand.command("examples")
|
|
157
|
+
.description("Generate examples")
|
|
158
|
+
.action((options) => {
|
|
159
|
+
const config = readConfig();
|
|
160
|
+
options.dirs = config.fe.dirs;
|
|
161
|
+
options.outputDir = config.fe?.examples?.outputDir || './vt/specs/examples';
|
|
162
|
+
examples(options);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
93
167
|
const vtCommand = program
|
|
94
168
|
.command("vt")
|
|
95
169
|
.description("Rettangoli Visual Testing");
|
|
@@ -99,8 +173,16 @@ vtCommand
|
|
|
99
173
|
.description("Generate visualizations")
|
|
100
174
|
.option("--skip-screenshots", "Skip screenshot generation")
|
|
101
175
|
.option("--screenshot-wait-time <time>", "Wait time between screenshots", "0")
|
|
102
|
-
.option("--viz-path <path>", "Path to the viz directory", "./viz")
|
|
103
176
|
.action((options) => {
|
|
177
|
+
const config = readConfig();
|
|
178
|
+
|
|
179
|
+
if (!config) {
|
|
180
|
+
throw new Error("rettangoli.config.yaml not found");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Use vt.path from config, default to 'vt'
|
|
184
|
+
options.vizPath = config.vt?.path || 'vt';
|
|
185
|
+
|
|
104
186
|
generate(options);
|
|
105
187
|
});
|
|
106
188
|
|
|
@@ -108,14 +190,28 @@ vtCommand
|
|
|
108
190
|
.command("report")
|
|
109
191
|
.description("Create reports")
|
|
110
192
|
.action(() => {
|
|
111
|
-
|
|
193
|
+
const config = readConfig();
|
|
194
|
+
|
|
195
|
+
if (!config) {
|
|
196
|
+
throw new Error("rettangoli.config.yaml not found");
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const vizPath = config.vt?.path || 'vt';
|
|
200
|
+
report({ vizPath });
|
|
112
201
|
});
|
|
113
202
|
|
|
114
203
|
vtCommand
|
|
115
204
|
.command("accept")
|
|
116
205
|
.description("Accept changes")
|
|
117
206
|
.action(() => {
|
|
118
|
-
|
|
207
|
+
const config = readConfig();
|
|
208
|
+
|
|
209
|
+
if (!config) {
|
|
210
|
+
throw new Error("rettangoli.config.yaml not found");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const vizPath = config.vt?.path || 'vt';
|
|
214
|
+
accept({ vizPath });
|
|
119
215
|
});
|
|
120
216
|
|
|
121
217
|
const sitesCommand = program.command("sites").description("Rettangoli Sites");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rtgl",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "CLI tool for Rettangoli - A frontend framework and development toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -46,8 +46,9 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"commander": "^14.0.0",
|
|
49
|
-
"
|
|
50
|
-
"rettangoli
|
|
51
|
-
"rettangoli
|
|
49
|
+
"js-yaml": "^4.1.0",
|
|
50
|
+
"@rettangoli/fe": "0.0.3-rc3",
|
|
51
|
+
"@rettangoli/sites": "0.1.0-rc2",
|
|
52
|
+
"@rettangoli/vt": "0.0.1"
|
|
52
53
|
}
|
|
53
54
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Yuusoft
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included
|
|
13
|
-
in all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
21
|
-
IN THE SOFTWARE.
|