git-shots-cli 0.5.0 → 0.5.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/dist/index.js +10 -6
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
+
import "dotenv/config";
|
|
4
5
|
import { Command } from "commander";
|
|
5
6
|
|
|
6
7
|
// src/config.ts
|
|
@@ -311,19 +312,22 @@ async function review(config, options) {
|
|
|
311
312
|
console.error(chalk6.red(`Request failed: ${err}`));
|
|
312
313
|
process.exit(1);
|
|
313
314
|
}
|
|
314
|
-
|
|
315
|
-
if (allZero) {
|
|
315
|
+
if (reviewData.diffs.length === 0) {
|
|
316
316
|
console.log(chalk6.green("No visual changes detected."));
|
|
317
317
|
process.exit(0);
|
|
318
318
|
}
|
|
319
319
|
const sessionUrl = `${config.server}/reviews/${reviewData.review.id}`;
|
|
320
320
|
console.log();
|
|
321
|
-
console.log(chalk6.bold("
|
|
321
|
+
console.log(chalk6.bold(`${reviewData.diffs.length} screen${reviewData.diffs.length === 1 ? "" : "s"} changed:`));
|
|
322
322
|
console.log();
|
|
323
323
|
for (const d of reviewData.diffs) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
if (d.mismatchPercentage > 0) {
|
|
325
|
+
const pct = d.mismatchPercentage.toFixed(2) + "%";
|
|
326
|
+
const color = d.mismatchPercentage > 10 ? chalk6.red : d.mismatchPercentage > 1 ? chalk6.yellow : chalk6.green;
|
|
327
|
+
console.log(` ${d.screen.padEnd(30)} ${color(pct)}`);
|
|
328
|
+
} else {
|
|
329
|
+
console.log(` ${d.screen.padEnd(30)} ${chalk6.cyan("changed")}`);
|
|
330
|
+
}
|
|
327
331
|
}
|
|
328
332
|
console.log();
|
|
329
333
|
console.log(`Review: ${chalk6.cyan(sessionUrl)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-shots-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "CLI for git-shots visual regression platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"commander": "^12.0.0",
|
|
18
18
|
"chalk": "^5.3.0",
|
|
19
|
+
"dotenv": "^16.4.0",
|
|
19
20
|
"glob": "^11.0.0"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|