@vizzly-testing/cli 0.15.0 → 0.15.1
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/cli.js +3 -1
- package/docs/plugins.md +11 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,9 @@ try {
|
|
|
50
50
|
let registerPromise = plugin.register(program, {
|
|
51
51
|
config,
|
|
52
52
|
services,
|
|
53
|
-
output
|
|
53
|
+
output,
|
|
54
|
+
// Backwards compatibility alias for plugins using old API
|
|
55
|
+
logger: output
|
|
54
56
|
});
|
|
55
57
|
let timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('Plugin registration timeout (5s)')), 5000));
|
|
56
58
|
await Promise.race([registerPromise, timeoutPromise]);
|
package/docs/plugins.md
CHANGED
|
@@ -356,7 +356,7 @@ register(program, { output }) {
|
|
|
356
356
|
export default {
|
|
357
357
|
name: 'hello',
|
|
358
358
|
version: '1.0.0',
|
|
359
|
-
register(program, {
|
|
359
|
+
register(program, { output }) {
|
|
360
360
|
program
|
|
361
361
|
.command('hello <name>')
|
|
362
362
|
.description('Say hello')
|
|
@@ -366,7 +366,7 @@ export default {
|
|
|
366
366
|
if (options.loud) {
|
|
367
367
|
greeting = greeting.toUpperCase();
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
output.info(greeting);
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
};
|
|
@@ -378,13 +378,13 @@ export default {
|
|
|
378
378
|
export default {
|
|
379
379
|
name: 'storybook',
|
|
380
380
|
version: '1.0.0',
|
|
381
|
-
register(program, { config,
|
|
381
|
+
register(program, { config, output, services }) {
|
|
382
382
|
program
|
|
383
383
|
.command('storybook <path>')
|
|
384
384
|
.description('Capture screenshots from Storybook build')
|
|
385
385
|
.option('--viewports <list>', 'Comma-separated viewports', '1280x720')
|
|
386
386
|
.action(async (path, options) => {
|
|
387
|
-
|
|
387
|
+
output.info(`Crawling Storybook at ${path}`);
|
|
388
388
|
|
|
389
389
|
// Import dependencies lazily
|
|
390
390
|
let { crawlStorybook } = await import('./crawler.js');
|
|
@@ -392,16 +392,15 @@ export default {
|
|
|
392
392
|
// Capture screenshots
|
|
393
393
|
let screenshots = await crawlStorybook(path, {
|
|
394
394
|
viewports: options.viewports.split(','),
|
|
395
|
-
logger,
|
|
396
395
|
});
|
|
397
396
|
|
|
398
|
-
|
|
397
|
+
output.info(`Captured ${screenshots.length} screenshots`);
|
|
399
398
|
|
|
400
399
|
// Upload using Vizzly's uploader service
|
|
401
400
|
let uploader = await services.get('uploader');
|
|
402
401
|
await uploader.uploadScreenshots(screenshots);
|
|
403
402
|
|
|
404
|
-
|
|
403
|
+
output.success('Upload complete!');
|
|
405
404
|
});
|
|
406
405
|
}
|
|
407
406
|
};
|
|
@@ -413,7 +412,7 @@ export default {
|
|
|
413
412
|
export default {
|
|
414
413
|
name: 'reports',
|
|
415
414
|
version: '1.0.0',
|
|
416
|
-
register(program, {
|
|
415
|
+
register(program, { output }) {
|
|
417
416
|
let reports = program
|
|
418
417
|
.command('reports')
|
|
419
418
|
.description('Report generation commands');
|
|
@@ -422,14 +421,14 @@ export default {
|
|
|
422
421
|
.command('generate')
|
|
423
422
|
.description('Generate a new report')
|
|
424
423
|
.action(() => {
|
|
425
|
-
|
|
424
|
+
output.info('Generating report...');
|
|
426
425
|
});
|
|
427
426
|
|
|
428
427
|
reports
|
|
429
428
|
.command('list')
|
|
430
429
|
.description('List all reports')
|
|
431
430
|
.action(() => {
|
|
432
|
-
|
|
431
|
+
output.info('Listing reports...');
|
|
433
432
|
});
|
|
434
433
|
}
|
|
435
434
|
};
|
|
@@ -474,10 +473,10 @@ If you're using TypeScript or want better IDE support, you can add JSDoc types:
|
|
|
474
473
|
* @param {import('commander').Command} program
|
|
475
474
|
* @param {Object} context
|
|
476
475
|
* @param {Object} context.config
|
|
477
|
-
* @param {Object} context.
|
|
476
|
+
* @param {Object} context.output
|
|
478
477
|
* @param {Object} context.services
|
|
479
478
|
*/
|
|
480
|
-
function register(program, { config,
|
|
479
|
+
function register(program, { config, output, services }) {
|
|
481
480
|
// Your plugin code with full autocomplete!
|
|
482
481
|
}
|
|
483
482
|
|