git-shots-cli 0.5.2 → 0.5.3
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/dist/index.js +8 -12
- package/package.json +27 -27
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import "dotenv/config";
|
|
5
5
|
import { Command } from "commander";
|
|
6
|
+
import { createRequire } from "module";
|
|
6
7
|
|
|
7
8
|
// src/config.ts
|
|
8
9
|
import { readFileSync, existsSync } from "fs";
|
|
@@ -108,8 +109,7 @@ async function compare(config, options) {
|
|
|
108
109
|
const body = {
|
|
109
110
|
project: config.project,
|
|
110
111
|
base: options.base ?? "main",
|
|
111
|
-
head: options.head
|
|
112
|
-
threshold: options.threshold ?? 0.1
|
|
112
|
+
head: options.head
|
|
113
113
|
};
|
|
114
114
|
if (options.screens) {
|
|
115
115
|
body.screens = options.screens;
|
|
@@ -137,14 +137,8 @@ async function compare(config, options) {
|
|
|
137
137
|
console.log(chalk3.green("No visual differences found!"));
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
console.log(chalk3.dim("Screen".padEnd(30) + "Mismatch".padEnd(15) + "Pixels"));
|
|
141
|
-
console.log(chalk3.dim("-".repeat(55)));
|
|
142
140
|
for (const d of data.diffs) {
|
|
143
|
-
|
|
144
|
-
const color = d.mismatchPercentage > 10 ? chalk3.red : d.mismatchPercentage > 1 ? chalk3.yellow : chalk3.green;
|
|
145
|
-
console.log(
|
|
146
|
-
d.screen.padEnd(30) + color(pct.padEnd(15)) + chalk3.dim(d.mismatchPixels.toLocaleString())
|
|
147
|
-
);
|
|
141
|
+
console.log(chalk3.yellow(` changed: ${d.screen}`));
|
|
148
142
|
}
|
|
149
143
|
} catch (err) {
|
|
150
144
|
console.error(chalk3.red(`Request failed: ${err}`));
|
|
@@ -561,8 +555,10 @@ async function syncFlows(config) {
|
|
|
561
555
|
}
|
|
562
556
|
|
|
563
557
|
// src/index.ts
|
|
558
|
+
var require2 = createRequire(import.meta.url);
|
|
559
|
+
var { version } = require2("../package.json");
|
|
564
560
|
var program = new Command();
|
|
565
|
-
program.name("git-shots").description("CLI for git-shots visual regression platform").version(
|
|
561
|
+
program.name("git-shots").description("CLI for git-shots visual regression platform").version(version);
|
|
566
562
|
program.command("upload").description("Upload screenshots to git-shots").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").option("-d, --directory <path>", "Screenshots directory").option("-b, --branch <name>", "Git branch (auto-detected)").option("--sha <hash>", "Git SHA (auto-detected)").option("--platform <name>", "Platform tag (e.g., android, web)").action(async (options) => {
|
|
567
563
|
const config = loadConfig();
|
|
568
564
|
if (options.project) config.project = options.project;
|
|
@@ -578,7 +574,7 @@ program.command("upload").description("Upload screenshots to git-shots").option(
|
|
|
578
574
|
await syncFlows(config);
|
|
579
575
|
}
|
|
580
576
|
});
|
|
581
|
-
program.command("compare").description("Compare screenshots between branches").requiredOption("--head <branch>", "Head branch to compare").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").option("--base <branch>", "Base branch (default: main)").option("
|
|
577
|
+
program.command("compare").description("Compare screenshots between branches").requiredOption("--head <branch>", "Head branch to compare").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").option("--base <branch>", "Base branch (default: main)").option("--platform <name>", "Platform tag (e.g., android, web)").option("--screens <patterns>", "Screen slug patterns to compare (comma-separated, supports *)").action(async (options) => {
|
|
582
578
|
const config = loadConfig();
|
|
583
579
|
if (options.project) config.project = options.project;
|
|
584
580
|
if (options.server) config.server = options.server;
|
|
@@ -588,7 +584,7 @@ program.command("compare").description("Compare screenshots between branches").r
|
|
|
588
584
|
process.exit(1);
|
|
589
585
|
}
|
|
590
586
|
const screens = options.screens ? options.screens.split(",").map((s) => s.trim()) : void 0;
|
|
591
|
-
await compare(config, { base: options.base, head: options.head,
|
|
587
|
+
await compare(config, { base: options.base, head: options.head, screens });
|
|
592
588
|
});
|
|
593
589
|
program.command("status").description("Show current diff status").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").action(async (options) => {
|
|
594
590
|
const config = loadConfig();
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "git-shots-cli",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "CLI for git-shots visual regression platform",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"git-shots": "./dist/index.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "tsup src/index.ts --format esm --dts",
|
|
14
|
-
"dev": "tsup src/index.ts --format esm --watch"
|
|
15
|
-
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"commander": "^12.0.0",
|
|
18
|
-
"chalk": "^5.3.0",
|
|
19
|
-
"dotenv": "^16.4.0",
|
|
20
|
-
"glob": "^11.0.0"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"tsup": "^8.0.0",
|
|
24
|
-
"typescript": "^5.0.0",
|
|
25
|
-
"@types/node": "^22.0.0"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "git-shots-cli",
|
|
3
|
+
"version": "0.5.3",
|
|
4
|
+
"description": "CLI for git-shots visual regression platform",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"git-shots": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
14
|
+
"dev": "tsup src/index.ts --format esm --watch"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"commander": "^12.0.0",
|
|
18
|
+
"chalk": "^5.3.0",
|
|
19
|
+
"dotenv": "^16.4.0",
|
|
20
|
+
"glob": "^11.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"tsup": "^8.0.0",
|
|
24
|
+
"typescript": "^5.0.0",
|
|
25
|
+
"@types/node": "^22.0.0"
|
|
26
|
+
}
|
|
27
|
+
}
|