@argos-ci/cli 0.4.3 → 0.4.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.mjs +49 -13
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -270,7 +270,20 @@ const service = {
|
|
|
270
270
|
}
|
|
271
271
|
};
|
|
272
272
|
|
|
273
|
-
const
|
|
273
|
+
const KEY = "@argos-ci/core";
|
|
274
|
+
const debug = createDebug(KEY);
|
|
275
|
+
const debugTime = (arg)=>{
|
|
276
|
+
const enabled = createDebug.enabled(KEY);
|
|
277
|
+
if (enabled) {
|
|
278
|
+
console.time(arg);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
const debugTimeEnd = (arg)=>{
|
|
282
|
+
const enabled = createDebug.enabled(KEY);
|
|
283
|
+
if (enabled) {
|
|
284
|
+
console.timeEnd(arg);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
274
287
|
|
|
275
288
|
const getCiEnvironmentFromEnvCi = (ctx)=>{
|
|
276
289
|
const ciContext = envCi(ctx);
|
|
@@ -444,6 +457,22 @@ const upload$1 = async (input)=>{
|
|
|
444
457
|
});
|
|
445
458
|
};
|
|
446
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Split an array into chunks of a given size.
|
|
462
|
+
*/ const chunk = (collection, size)=>{
|
|
463
|
+
const result = [];
|
|
464
|
+
// add each chunk to the result
|
|
465
|
+
for(let x = 0; x < Math.ceil(collection.length / size); x++){
|
|
466
|
+
let start = x * size;
|
|
467
|
+
let end = start + size;
|
|
468
|
+
result.push(collection.slice(start, end));
|
|
469
|
+
}
|
|
470
|
+
return result;
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Size of the chunks used to upload screenshots to Argos.
|
|
475
|
+
*/ const CHUNK_SIZE = 10;
|
|
447
476
|
const getConfigFromOptions = (options)=>{
|
|
448
477
|
const config = createConfig();
|
|
449
478
|
const ciEnv = getCiEnvironment();
|
|
@@ -512,18 +541,25 @@ const getConfigFromOptions = (options)=>{
|
|
|
512
541
|
prNumber: config.prNumber
|
|
513
542
|
});
|
|
514
543
|
debug("Got screenshots", result);
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
await
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
544
|
+
debug(`Split screenshots in chunks of ${CHUNK_SIZE}`);
|
|
545
|
+
const chunks = chunk(result.screenshots, CHUNK_SIZE);
|
|
546
|
+
debug(`Starting upload of ${chunks.length} chunks`);
|
|
547
|
+
for(let i = 0; i < chunks.length; i++){
|
|
548
|
+
debug(`Uploading chunk ${i + 1}/${chunks.length}`);
|
|
549
|
+
const timeLabel = `Chunk ${i + 1}/${chunks.length}`;
|
|
550
|
+
debugTime(timeLabel);
|
|
551
|
+
await Promise.all(chunks[i].map(async ({ key , putUrl })=>{
|
|
552
|
+
const screenshot = screenshots.find((s)=>s.hash === key);
|
|
553
|
+
if (!screenshot) {
|
|
554
|
+
throw new Error(`Invariant: screenshot with hash ${key} not found`);
|
|
555
|
+
}
|
|
556
|
+
await upload$1({
|
|
557
|
+
url: putUrl,
|
|
558
|
+
path: screenshot.optimizedPath
|
|
559
|
+
});
|
|
560
|
+
}));
|
|
561
|
+
debugTimeEnd(timeLabel);
|
|
562
|
+
}
|
|
527
563
|
// Update build
|
|
528
564
|
debug("Updating build");
|
|
529
565
|
await apiClient.updateBuild({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/cli",
|
|
3
3
|
"description": "Visual testing solution to avoid visual regression. Argos CLI is used to interact with and upload screenshots to argos-ci.com via command line.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.4",
|
|
5
5
|
"bin": {
|
|
6
6
|
"argos": "./bin/argos-cli.js"
|
|
7
7
|
},
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@argos-ci/core": "^0.
|
|
43
|
+
"@argos-ci/core": "^0.8.0",
|
|
44
44
|
"commander": "^9.4.1",
|
|
45
45
|
"ora": "^6.1.2",
|
|
46
46
|
"update-notifier": "^6.0.2"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"rollup": "^2.79.1",
|
|
50
50
|
"rollup-plugin-swc3": "^0.6.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "bad0f5b5bf1dc1672b05cf08a4fec5d011ac4b0a"
|
|
53
53
|
}
|