git-shots-cli 0.5.2 → 0.5.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/dist/index.js +15 -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,15 @@ 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
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
const type = d.changeType ?? "changed";
|
|
142
|
+
if (type === "new") {
|
|
143
|
+
console.log(chalk3.green(` + new: ${d.screen}`));
|
|
144
|
+
} else if (type === "removed") {
|
|
145
|
+
console.log(chalk3.red(` - removed: ${d.screen}`));
|
|
146
|
+
} else {
|
|
147
|
+
console.log(chalk3.yellow(` ~ changed: ${d.screen}`));
|
|
148
|
+
}
|
|
148
149
|
}
|
|
149
150
|
} catch (err) {
|
|
150
151
|
console.error(chalk3.red(`Request failed: ${err}`));
|
|
@@ -561,8 +562,10 @@ async function syncFlows(config) {
|
|
|
561
562
|
}
|
|
562
563
|
|
|
563
564
|
// src/index.ts
|
|
565
|
+
var require2 = createRequire(import.meta.url);
|
|
566
|
+
var { version } = require2("../package.json");
|
|
564
567
|
var program = new Command();
|
|
565
|
-
program.name("git-shots").description("CLI for git-shots visual regression platform").version(
|
|
568
|
+
program.name("git-shots").description("CLI for git-shots visual regression platform").version(version);
|
|
566
569
|
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
570
|
const config = loadConfig();
|
|
568
571
|
if (options.project) config.project = options.project;
|
|
@@ -578,7 +581,7 @@ program.command("upload").description("Upload screenshots to git-shots").option(
|
|
|
578
581
|
await syncFlows(config);
|
|
579
582
|
}
|
|
580
583
|
});
|
|
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("
|
|
584
|
+
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
585
|
const config = loadConfig();
|
|
583
586
|
if (options.project) config.project = options.project;
|
|
584
587
|
if (options.server) config.server = options.server;
|
|
@@ -588,7 +591,7 @@ program.command("compare").description("Compare screenshots between branches").r
|
|
|
588
591
|
process.exit(1);
|
|
589
592
|
}
|
|
590
593
|
const screens = options.screens ? options.screens.split(",").map((s) => s.trim()) : void 0;
|
|
591
|
-
await compare(config, { base: options.base, head: options.head,
|
|
594
|
+
await compare(config, { base: options.base, head: options.head, screens });
|
|
592
595
|
});
|
|
593
596
|
program.command("status").description("Show current diff status").option("-p, --project <slug>", "Project slug").option("-s, --server <url>", "Server URL").action(async (options) => {
|
|
594
597
|
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.4",
|
|
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
|
+
}
|