Socket
Socket
Sign inDemoInstall

@percy/cli-build

Package Overview
Dependencies
Maintainers
6
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/cli-build - npm Package Compare versions

Comparing version 1.0.0-beta.52 to 1.0.0-beta.53

16

dist/commands/build/finalize.js

@@ -48,9 +48,15 @@ "use strict";

this.log.info('Finalizing parallel build...');
await client.createBuild();
let build = client.build;
await client.finalizeBuild({
this.log.info('Finalizing parallel build...'); // rely on the parallel nonce to cause the API to return the current running build for the nonce
let {
data: build
} = await client.createBuild();
let {
'build-number': number,
'web-url': url
} = build.attributes;
await client.finalizeBuild(build.id, {
all: true
});
this.log.info(`Finalized build #${build.number}: ${build.url}`);
this.log.info(`Finalized build #${number}: ${url}`);
}

@@ -57,0 +63,0 @@

@@ -8,4 +8,2 @@ "use strict";

var _readline = _interopRequireDefault(require("readline"));
var _cliCommand = _interopRequireWildcard(require("@percy/cli-command"));

@@ -17,2 +15,4 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -22,4 +22,2 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -36,65 +34,44 @@

if (!this.isPercyEnabled()) {
this.log.info('Percy is disabled');
return;
return this.log.info('Percy is disabled');
}
let client = new _client.default();
let result = await client.waitForBuild({
progress: this.progress,
...this.flags
await new _client.default().waitForBuild(this.flags, data => {
this.status(data);
});
return this.finish(result);
} // Log build progress
} // Log build status and maybe exit when failed
progress({
status({
attributes: {
state,
'web-url': url,
'build-number': number,
'failure-reason': failReason,
'failure-details': failDetails,
'total-snapshots': count,
'total-comparisons': total,
'total-comparisons-diff': diffs,
'total-comparisons-finished': finished
}
}) {
// update the same line each time
_readline.default.cursorTo(_logger.default.stdout, 0); // still recieving snapshots
switch (state) {
case 'pending':
return this.log.progress('Recieving snapshots...');
case 'processing':
return this.log.progress(`Processing ${count} snapshots - ` + (finished === total ? 'finishing up...' : `${finished} of ${total} comparisons finished...`));
if (state === 'pending') {
_logger.default.stdout.write(_logger.default.format('Recieving snapshots...', 'cli:build:wait')); // need to clear the line before finishing
case 'finished':
this.log.info(`Build #${number} finished! ${url}`);
this.log.info(`Found ${diffs} changes`);
return this.flags['fail-on-changes'] && diffs > 0 && this.exit(1);
} else if (finished === total || state === 'finished') {
_readline.default.clearLine(_logger.default.stdout);
} // processing snapshots
case 'failed':
this.log.error(`Build #${number} failed! ${url}`);
this.log.error(this.failure(failReason, failDetails));
return this.exit(1);
if (state === 'processing') {
_logger.default.stdout.write(_logger.default.format(`Processing ${count} snapshots - ` + (finished === total ? 'finishing up...' : `${finished} of ${total} comparisons finished...`), 'cli:build:wait'));
}
} // Log build status
finish({
attributes: {
state,
'web-url': url,
'build-number': number,
'total-comparisons-diff': diffs,
'failure-reason': failReason,
'failure-details': failDetails
}
}) {
if (state === 'finished') {
this.log.info(`Build #${number} finished! ${url}`);
this.log.info(`Found ${diffs} changes`);
if (this.flags['fail-on-changes'] && diffs > 0) {
default:
this.log.error(`Build #${number} is ${state}. ${url}`);
return this.exit(1);
}
} else if (state === 'failed') {
this.log.error(`Build #${number} failed! ${url}`);
this.log.error(this.failure(failReason, failDetails));
return this.exit(1);
} else {
this.log.error(`Build #${number} is ${state}. ${url}`);
return this.exit(1);
}

@@ -101,0 +78,0 @@ } // Create failure messages

@@ -1,1 +0,1 @@

{"version":"1.0.0-beta.52","commands":{"build:finalize":{"id":"build:finalize","description":"Finalize parallel Percy builds where PERCY_PARALLEL_TOTAL=-1","pluginName":"@percy/cli-build","pluginType":"core","aliases":[],"examples":["$ percy build:finalize"],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"log everything","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"log errors only","allowNo":false},"silent":{"name":"silent","type":"boolean","description":"log nothing","allowNo":false}},"args":[]},"build:wait":{"id":"build:wait","description":"Wait for a build to be finished. Requires a full access PERCY_TOKEN","pluginName":"@percy/cli-build","pluginType":"core","aliases":[],"examples":["$ percy build:wait --build 2222222","$ percy build:wait --project org/project --commit HEAD"],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"log everything","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"log errors only","allowNo":false},"silent":{"name":"silent","type":"boolean","description":"log nothing","allowNo":false},"build":{"name":"build","type":"option","char":"b","description":"build id"},"project":{"name":"project","type":"option","char":"p","description":"build's project slug, required with --commit"},"commit":{"name":"commit","type":"option","char":"c","description":"build's commit sha for a project"},"timeout":{"name":"timeout","type":"option","char":"t","description":"timeout, in milliseconds, to exit when there are no updates, defaults to 10 minutes"},"interval":{"name":"interval","type":"option","char":"i","description":"interval, in milliseconds, at which to poll for updates, defaults to 1000"},"fail-on-changes":{"name":"fail-on-changes","type":"boolean","char":"f","description":"exits with an error when diffs are found in snapshots","allowNo":false}},"args":[]}}}
{"version":"1.0.0-beta.53","commands":{"build:finalize":{"id":"build:finalize","description":"Finalize parallel Percy builds where PERCY_PARALLEL_TOTAL=-1","pluginName":"@percy/cli-build","pluginType":"core","aliases":[],"examples":["$ percy build:finalize"],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"log everything","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"log errors only","allowNo":false},"silent":{"name":"silent","type":"boolean","description":"log nothing","allowNo":false}},"args":[]},"build:wait":{"id":"build:wait","description":"Wait for a build to be finished. Requires a full access PERCY_TOKEN","pluginName":"@percy/cli-build","pluginType":"core","aliases":[],"examples":["$ percy build:wait --build 2222222","$ percy build:wait --project org/project --commit HEAD"],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"log everything","allowNo":false},"quiet":{"name":"quiet","type":"boolean","char":"q","description":"log errors only","allowNo":false},"silent":{"name":"silent","type":"boolean","description":"log nothing","allowNo":false},"build":{"name":"build","type":"option","char":"b","description":"build id"},"project":{"name":"project","type":"option","char":"p","description":"build's project slug, required with --commit"},"commit":{"name":"commit","type":"option","char":"c","description":"build's commit sha for a project"},"timeout":{"name":"timeout","type":"option","char":"t","description":"timeout, in milliseconds, to exit when there are no updates, defaults to 10 minutes"},"interval":{"name":"interval","type":"option","char":"i","description":"interval, in milliseconds, at which to poll for updates, defaults to 1000"},"fail-on-changes":{"name":"fail-on-changes","type":"boolean","char":"f","description":"exits with an error when diffs are found in snapshots","allowNo":false}},"args":[]}}}
{
"name": "@percy/cli-build",
"version": "1.0.0-beta.52",
"version": "1.0.0-beta.53",
"license": "MIT",

@@ -34,8 +34,8 @@ "main": "dist/index.js",

"dependencies": {
"@percy/cli-command": "^1.0.0-beta.52",
"@percy/client": "^1.0.0-beta.52",
"@percy/env": "^1.0.0-beta.52",
"@percy/logger": "^1.0.0-beta.52"
"@percy/cli-command": "^1.0.0-beta.53",
"@percy/client": "^1.0.0-beta.53",
"@percy/env": "^1.0.0-beta.53",
"@percy/logger": "^1.0.0-beta.53"
},
"gitHead": "ebc543f148bede5ce057458ffb830dd60823837e"
"gitHead": "42c93d11a663b5e45ab75944e20f0fb63a0dda09"
}

@@ -47,5 +47,5 @@ # @percy/cli-build

EXAMPLES
$ percy build:wait --build 123
$ percy build:wait --project test --commit HEAD
$ percy build:wait --build 2222222
$ percy build:wait --project org/project --commit HEAD
```
<!-- commandsstop -->
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc