rtgl 0.0.10-rc1 → 0.0.11-rc1
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 +47 -36
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -8,14 +8,18 @@ import { readFileSync, existsSync } from "fs";
|
|
|
8
8
|
import { resolve } from "path";
|
|
9
9
|
import yaml from "js-yaml";
|
|
10
10
|
|
|
11
|
+
const packageJson = JSON.parse(
|
|
12
|
+
readFileSync(new URL("./package.json", import.meta.url)),
|
|
13
|
+
);
|
|
14
|
+
|
|
11
15
|
// Function to read config file
|
|
12
16
|
function readConfig() {
|
|
13
17
|
const configPath = resolve(process.cwd(), "rettangoli.config.yaml");
|
|
14
|
-
|
|
18
|
+
|
|
15
19
|
if (!existsSync(configPath)) {
|
|
16
20
|
return null;
|
|
17
21
|
}
|
|
18
|
-
|
|
22
|
+
|
|
19
23
|
try {
|
|
20
24
|
const configContent = readFileSync(configPath, "utf8");
|
|
21
25
|
return yaml.load(configContent);
|
|
@@ -25,13 +29,12 @@ function readConfig() {
|
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
|
|
29
32
|
const program = new Command();
|
|
30
33
|
|
|
31
34
|
program
|
|
32
35
|
.name("rtgl")
|
|
33
36
|
.description("CLI tool for Rettangoli development")
|
|
34
|
-
.version(
|
|
37
|
+
.version(packageJson.version);
|
|
35
38
|
|
|
36
39
|
// Add examples to main program
|
|
37
40
|
program.addHelpText(
|
|
@@ -63,30 +66,32 @@ Examples:
|
|
|
63
66
|
)
|
|
64
67
|
.action((options) => {
|
|
65
68
|
const config = readConfig();
|
|
66
|
-
|
|
69
|
+
|
|
67
70
|
if (!config) {
|
|
68
71
|
throw new Error("rettangoli.config.yaml not found");
|
|
69
72
|
}
|
|
70
|
-
|
|
73
|
+
|
|
71
74
|
if (!config.fe?.dirs?.length) {
|
|
72
75
|
throw new Error("fe.dirs not found or empty in config");
|
|
73
76
|
}
|
|
74
|
-
|
|
77
|
+
|
|
75
78
|
// Validate that directories exist
|
|
76
|
-
const missingDirs = config.fe.dirs.filter(
|
|
79
|
+
const missingDirs = config.fe.dirs.filter(
|
|
80
|
+
(dir) => !existsSync(resolve(process.cwd(), dir)),
|
|
81
|
+
);
|
|
77
82
|
if (missingDirs.length > 0) {
|
|
78
83
|
throw new Error(`Directories do not exist: ${missingDirs.join(", ")}`);
|
|
79
84
|
}
|
|
80
|
-
|
|
85
|
+
|
|
81
86
|
// Pass dirs, setup, and outfile from config
|
|
82
87
|
options.dirs = config.fe.dirs;
|
|
83
|
-
options.setup = config.fe.setup ||
|
|
84
|
-
|
|
88
|
+
options.setup = config.fe.setup || "setup.js";
|
|
89
|
+
|
|
85
90
|
// Use config outfile if not specified via CLI option
|
|
86
91
|
if (!options.outfile && config.fe.outfile) {
|
|
87
92
|
options.outfile = config.fe.outfile;
|
|
88
93
|
}
|
|
89
|
-
|
|
94
|
+
|
|
90
95
|
build(options);
|
|
91
96
|
});
|
|
92
97
|
|
|
@@ -131,39 +136,45 @@ Examples:
|
|
|
131
136
|
)
|
|
132
137
|
.action((options) => {
|
|
133
138
|
const config = readConfig();
|
|
134
|
-
|
|
139
|
+
|
|
135
140
|
if (!config) {
|
|
136
141
|
throw new Error("rettangoli.config.yaml not found");
|
|
137
142
|
}
|
|
138
|
-
|
|
143
|
+
|
|
139
144
|
if (!config.fe?.dirs?.length) {
|
|
140
145
|
throw new Error("fe.dirs not found or empty in config");
|
|
141
146
|
}
|
|
142
|
-
|
|
147
|
+
|
|
143
148
|
// Validate that directories exist
|
|
144
|
-
const missingDirs = config.fe.dirs.filter(
|
|
149
|
+
const missingDirs = config.fe.dirs.filter(
|
|
150
|
+
(dir) => !existsSync(resolve(process.cwd(), dir)),
|
|
151
|
+
);
|
|
145
152
|
if (missingDirs.length > 0) {
|
|
146
153
|
throw new Error(`Directories do not exist: ${missingDirs.join(", ")}`);
|
|
147
154
|
}
|
|
148
|
-
|
|
149
|
-
// Pass dirs and
|
|
155
|
+
|
|
156
|
+
// Pass dirs, setup, and outfile from config
|
|
150
157
|
options.dirs = config.fe.dirs;
|
|
151
|
-
options.setup = config.fe.setup ||
|
|
158
|
+
options.setup = config.fe.setup || "setup.js";
|
|
159
|
+
|
|
160
|
+
// Use config outfile if not specified via CLI option
|
|
161
|
+
if (!options.outfile && config.fe.outfile) {
|
|
162
|
+
options.outfile = config.fe.outfile;
|
|
163
|
+
}
|
|
164
|
+
|
|
152
165
|
watch(options);
|
|
153
166
|
});
|
|
154
167
|
|
|
155
|
-
|
|
156
|
-
|
|
168
|
+
feCommand
|
|
169
|
+
.command("examples")
|
|
157
170
|
.description("Generate examples")
|
|
158
171
|
.action((options) => {
|
|
159
172
|
const config = readConfig();
|
|
160
173
|
options.dirs = config.fe.dirs;
|
|
161
|
-
options.outputDir = config.fe?.examples?.outputDir ||
|
|
174
|
+
options.outputDir = config.fe?.examples?.outputDir || "./vt/specs/examples";
|
|
162
175
|
examples(options);
|
|
163
176
|
});
|
|
164
177
|
|
|
165
|
-
|
|
166
|
-
|
|
167
178
|
const vtCommand = program
|
|
168
179
|
.command("vt")
|
|
169
180
|
.description("Rettangoli Visual Testing");
|
|
@@ -175,14 +186,14 @@ vtCommand
|
|
|
175
186
|
.option("--screenshot-wait-time <time>", "Wait time between screenshots", "0")
|
|
176
187
|
.action((options) => {
|
|
177
188
|
const config = readConfig();
|
|
178
|
-
|
|
189
|
+
|
|
179
190
|
if (!config) {
|
|
180
191
|
throw new Error("rettangoli.config.yaml not found");
|
|
181
192
|
}
|
|
182
|
-
|
|
193
|
+
|
|
183
194
|
// Use vt.path from config, default to 'vt'
|
|
184
|
-
options.
|
|
185
|
-
|
|
195
|
+
options.vtPath = config.vt?.path || "vt";
|
|
196
|
+
|
|
186
197
|
generate(options);
|
|
187
198
|
});
|
|
188
199
|
|
|
@@ -191,13 +202,13 @@ vtCommand
|
|
|
191
202
|
.description("Create reports")
|
|
192
203
|
.action(() => {
|
|
193
204
|
const config = readConfig();
|
|
194
|
-
|
|
205
|
+
|
|
195
206
|
if (!config) {
|
|
196
207
|
throw new Error("rettangoli.config.yaml not found");
|
|
197
208
|
}
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
report({
|
|
209
|
+
|
|
210
|
+
const vtPath = config.vt?.path || "vt";
|
|
211
|
+
report({ vtPath });
|
|
201
212
|
});
|
|
202
213
|
|
|
203
214
|
vtCommand
|
|
@@ -205,13 +216,13 @@ vtCommand
|
|
|
205
216
|
.description("Accept changes")
|
|
206
217
|
.action(() => {
|
|
207
218
|
const config = readConfig();
|
|
208
|
-
|
|
219
|
+
|
|
209
220
|
if (!config) {
|
|
210
221
|
throw new Error("rettangoli.config.yaml not found");
|
|
211
222
|
}
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
accept({
|
|
223
|
+
|
|
224
|
+
const vtPath = config.vt?.path || "vt";
|
|
225
|
+
accept({ vtPath });
|
|
215
226
|
});
|
|
216
227
|
|
|
217
228
|
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.11-rc1",
|
|
4
4
|
"description": "CLI tool for Rettangoli - A frontend framework and development toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"commander": "^14.0.0",
|
|
49
49
|
"js-yaml": "^4.1.0",
|
|
50
|
-
"@rettangoli/fe": "0.0.
|
|
50
|
+
"@rettangoli/fe": "0.0.7-rc1",
|
|
51
51
|
"@rettangoli/sites": "0.1.0",
|
|
52
52
|
"@rettangoli/vt": "0.0.2-rc1"
|
|
53
53
|
}
|