git-shots-cli 0.2.1 → 0.3.0
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 +12 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39,10 +39,11 @@ async function upload(config, options) {
|
|
|
39
39
|
}
|
|
40
40
|
const branch = options.branch ?? execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8" }).trim();
|
|
41
41
|
const sha = options.sha ?? execSync("git rev-parse HEAD", { encoding: "utf-8" }).trim();
|
|
42
|
-
console.log(chalk.dim(`Project:
|
|
43
|
-
console.log(chalk.dim(`
|
|
44
|
-
console.log(chalk.dim(`
|
|
45
|
-
console.log(chalk.dim(`
|
|
42
|
+
console.log(chalk.dim(`Project: ${config.project}`));
|
|
43
|
+
if (config.platform) console.log(chalk.dim(`Platform: ${config.platform}`));
|
|
44
|
+
console.log(chalk.dim(`Branch: ${branch}`));
|
|
45
|
+
console.log(chalk.dim(`SHA: ${sha.slice(0, 7)}`));
|
|
46
|
+
console.log(chalk.dim(`Dir: ${dir}`));
|
|
46
47
|
console.log();
|
|
47
48
|
const files = await glob("**/*.png", { cwd: dir });
|
|
48
49
|
if (files.length === 0) {
|
|
@@ -54,6 +55,7 @@ async function upload(config, options) {
|
|
|
54
55
|
formData.append("project", config.project);
|
|
55
56
|
formData.append("branch", branch);
|
|
56
57
|
formData.append("gitSha", sha);
|
|
58
|
+
if (config.platform) formData.append("platform", config.platform);
|
|
57
59
|
for (const file of files) {
|
|
58
60
|
const fullPath = resolve2(dir, file);
|
|
59
61
|
const buffer = readFileSync2(fullPath);
|
|
@@ -446,21 +448,23 @@ async function hookUninstall(cwd = process.cwd()) {
|
|
|
446
448
|
// src/index.ts
|
|
447
449
|
var program = new Command();
|
|
448
450
|
program.name("git-shots").description("CLI for git-shots visual regression platform").version("0.1.0");
|
|
449
|
-
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)").action(async (options) => {
|
|
451
|
+
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) => {
|
|
450
452
|
const config = loadConfig();
|
|
451
453
|
if (options.project) config.project = options.project;
|
|
452
454
|
if (options.server) config.server = options.server;
|
|
453
455
|
if (options.directory) config.directory = options.directory;
|
|
456
|
+
if (options.platform) config.platform = options.platform;
|
|
454
457
|
if (!config.project) {
|
|
455
458
|
console.error("Error: project slug required. Use --project or .git-shots.json");
|
|
456
459
|
process.exit(1);
|
|
457
460
|
}
|
|
458
461
|
await upload(config, { branch: options.branch, sha: options.sha });
|
|
459
462
|
});
|
|
460
|
-
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("-t, --threshold <number>", "Mismatch threshold 0-1", parseFloat).action(async (options) => {
|
|
463
|
+
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("-t, --threshold <number>", "Mismatch threshold 0-1", parseFloat).option("--platform <name>", "Platform tag (e.g., android, web)").action(async (options) => {
|
|
461
464
|
const config = loadConfig();
|
|
462
465
|
if (options.project) config.project = options.project;
|
|
463
466
|
if (options.server) config.server = options.server;
|
|
467
|
+
if (options.platform) config.platform = options.platform;
|
|
464
468
|
if (!config.project) {
|
|
465
469
|
console.error("Error: project slug required. Use --project or .git-shots.json");
|
|
466
470
|
process.exit(1);
|
|
@@ -487,11 +491,12 @@ program.command("pull-baselines").description("Download baseline screenshots fro
|
|
|
487
491
|
}
|
|
488
492
|
await pullBaselines(config, { branch: options.branch, output: options.output });
|
|
489
493
|
});
|
|
490
|
-
program.command("review").description("Upload screenshots, create review session, and poll for verdict").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("--open", "Open review URL in browser", true).option("--no-open", "Do not open review URL in browser").option("--poll", "Poll for verdict and exit with code", true).option("--no-poll", "Do not poll for verdict").option("--timeout <seconds>", "Polling timeout in seconds", parseInt, 300).action(async (options) => {
|
|
494
|
+
program.command("review").description("Upload screenshots, create review session, and poll for verdict").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)").option("--open", "Open review URL in browser", true).option("--no-open", "Do not open review URL in browser").option("--poll", "Poll for verdict and exit with code", true).option("--no-poll", "Do not poll for verdict").option("--timeout <seconds>", "Polling timeout in seconds", parseInt, 300).action(async (options) => {
|
|
491
495
|
const config = loadConfig();
|
|
492
496
|
if (options.project) config.project = options.project;
|
|
493
497
|
if (options.server) config.server = options.server;
|
|
494
498
|
if (options.directory) config.directory = options.directory;
|
|
499
|
+
if (options.platform) config.platform = options.platform;
|
|
495
500
|
if (!config.project) {
|
|
496
501
|
console.error("Error: project slug required. Use --project or .git-shots.json");
|
|
497
502
|
process.exit(1);
|