qualty 0.1.0 → 0.1.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.
- package/bin/qualty.js +11 -4
- package/package.json +1 -1
package/bin/qualty.js
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
|
|
6
|
+
/** When unset, CLI talks to Qualty cloud. Override for self-hosted or local dev, e.g. QUALTY_API_URL=http://localhost:8000 */
|
|
7
|
+
const DEFAULT_QUALTY_API_URL = "https://qualty-api-production.up.railway.app";
|
|
8
|
+
|
|
9
|
+
function resolveApiUrl(args) {
|
|
10
|
+
return String(args.api || process.env.QUALTY_API_URL || DEFAULT_QUALTY_API_URL).replace(/\/$/, "");
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
function parseArgs(argv) {
|
|
7
14
|
const args = { _: [] };
|
|
8
15
|
for (let i = 2; i < argv.length; i += 1) {
|
|
@@ -36,7 +43,7 @@ function usage() {
|
|
|
36
43
|
" qualty resolve --project <project-id> [--suite-id <suite-id>] [--ids <id1,id2>] [--json] [--api https://your-api] [--token <bearer-token>]",
|
|
37
44
|
"",
|
|
38
45
|
"Env vars:",
|
|
39
|
-
|
|
46
|
+
` QUALTY_API_URL Backend API URL (default: ${DEFAULT_QUALTY_API_URL}; set for local/self-hosted)`,
|
|
40
47
|
" QUALTY_API_TOKEN Bearer token used for auth",
|
|
41
48
|
].join("\n")
|
|
42
49
|
);
|
|
@@ -82,7 +89,7 @@ function startCloudflared(token, port) {
|
|
|
82
89
|
async function runConnect(args) {
|
|
83
90
|
const projectId = args.project;
|
|
84
91
|
const port = Number(args.port || 3000);
|
|
85
|
-
const apiUrl = (args
|
|
92
|
+
const apiUrl = resolveApiUrl(args);
|
|
86
93
|
const token = args.token || process.env.QUALTY_API_TOKEN;
|
|
87
94
|
|
|
88
95
|
if (!projectId || !token) {
|
|
@@ -165,7 +172,7 @@ function sleep(ms) {
|
|
|
165
172
|
}
|
|
166
173
|
|
|
167
174
|
async function runCi(args) {
|
|
168
|
-
const apiUrl = (args
|
|
175
|
+
const apiUrl = resolveApiUrl(args);
|
|
169
176
|
const token = args.token || process.env.QUALTY_API_TOKEN;
|
|
170
177
|
const projectId = args.project;
|
|
171
178
|
const suiteId = args["suite-id"];
|
|
@@ -295,7 +302,7 @@ async function resolveSavedJobs({ apiUrl, token, projectId, suiteId, explicitIds
|
|
|
295
302
|
}
|
|
296
303
|
|
|
297
304
|
async function runResolve(args) {
|
|
298
|
-
const apiUrl = (args
|
|
305
|
+
const apiUrl = resolveApiUrl(args);
|
|
299
306
|
const token = args.token || process.env.QUALTY_API_TOKEN;
|
|
300
307
|
const projectId = args.project;
|
|
301
308
|
const suiteId = args["suite-id"];
|