@percy/cli-build
Advanced tools
Comparing version 1.12.0 to 1.13.0
@@ -11,6 +11,8 @@ import command from '@percy/cli-command'; | ||
}) => { | ||
if (!percy) exit(0, 'Percy is disabled'); // automatically set parallel total to -1 | ||
if (!percy) exit(0, 'Percy is disabled'); | ||
env.PERCY_PARALLEL_TOTAL || (env.PERCY_PARALLEL_TOTAL = '-1'); // ensure that this command is not used for other parallel totals | ||
// automatically set parallel total to -1 | ||
env.PERCY_PARALLEL_TOTAL || (env.PERCY_PARALLEL_TOTAL = '-1'); | ||
// ensure that this command is not used for other parallel totals | ||
if (env.PERCY_PARALLEL_TOTAL !== '-1') { | ||
@@ -21,5 +23,5 @@ log.error('This command should only be used with PERCY_PARALLEL_TOTAL=-1'); | ||
} | ||
log.info('Finalizing parallel build...'); | ||
log.info('Finalizing parallel build...'); // rely on the parallel nonce to cause the API to return the current running build for the nonce | ||
// rely on the parallel nonce to cause the API to return the current running build for the nonce | ||
let { | ||
@@ -26,0 +28,0 @@ data: build |
@@ -14,3 +14,2 @@ import command from '@percy/cli-command'; | ||
var _build; | ||
if (!percy) exit(0, 'Percy is disabled'); | ||
@@ -22,3 +21,2 @@ let { | ||
let build = null; | ||
try { | ||
@@ -36,3 +34,2 @@ ({ | ||
} | ||
if ((_build = build) !== null && _build !== void 0 && _build.id) { | ||
@@ -39,0 +36,0 @@ log.stdout.write(build.id.toString()); |
@@ -46,21 +46,22 @@ import command from '@percy/cli-command'; | ||
}) { | ||
if (!percy) exit(0, 'Percy is disabled'); // do not wait directly on the promise as to not block the event loop | ||
if (!percy) exit(0, 'Percy is disabled'); | ||
// do not wait directly on the promise as to not block the event loop | ||
let waiting = percy.client.waitForBuild(flags, build => { | ||
logProgress(build, log); | ||
if (isFailing(build, flags)) exit(1); | ||
}); // wait between event loops to allow process termination | ||
}); | ||
// wait between event loops to allow process termination | ||
let handleDone = () => waiting.done = true; | ||
waiting.then(handleDone, handleDone); | ||
while (!waiting.done) { | ||
yield new Promise(r => setImmediate(r)); | ||
} // bubble errors | ||
} | ||
// bubble errors | ||
yield waiting; | ||
}); // Log build progress | ||
}); | ||
// Log build progress | ||
function logProgress({ | ||
@@ -82,23 +83,18 @@ attributes: { | ||
return log.progress('Waiting for build...'); | ||
case 'pending': | ||
return log.progress('Recieving snapshots...'); | ||
case 'processing': | ||
return log.progress(`Processing ${count} snapshots - ` + (finished === total ? 'finishing up...' : `${finished} of ${total} comparisons finished...`)); | ||
case 'finished': | ||
log.info(`Build #${number} finished! ${url}`); | ||
return log.info(`Found ${diffs} changes`); | ||
case 'failed': | ||
log.error(`Build #${number} failed! ${url}`); | ||
return log.error(failureMessage(failReason, failDetails)); | ||
default: | ||
return log.error(`Build #${number} is ${state}. ${url}`); | ||
} | ||
} // Create failure messages | ||
} | ||
// Create failure messages | ||
function failureMessage(type, { | ||
@@ -112,18 +108,14 @@ missing_parallel_builds: missingParallel, | ||
return 'Some snapshots in this build took too long ' + 'to render even after multiple retries.'; | ||
case 'no_snapshots': | ||
return 'No snapshots were uploaded to this build.'; | ||
case 'missing_finalize': | ||
return 'Failed to correctly finalize.'; | ||
case 'missing_resources': | ||
return missingParallel ? `Only ${parallelCount} of ${parallelTotal} parallel builds were received.` : 'Some build or snapshot resources failed to correctly upload.'; | ||
default: | ||
return `Error: ${type}`; | ||
} | ||
} // Return true or false if a build is considered failing or not | ||
} | ||
// Return true or false if a build is considered failing or not | ||
function isFailing({ | ||
@@ -138,6 +130,6 @@ attributes: { | ||
// not pending and not processing | ||
return state != null && state !== 'pending' && state !== 'processing' && ( // not finished or finished with diffs | ||
return state != null && state !== 'pending' && state !== 'processing' && ( | ||
// not finished or finished with diffs | ||
state !== 'finished' || failOnChanges && !!diffs); | ||
} | ||
export default wait; |
{ | ||
"name": "@percy/cli-build", | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"license": "MIT", | ||
@@ -35,5 +35,5 @@ "repository": { | ||
"dependencies": { | ||
"@percy/cli-command": "1.12.0" | ||
"@percy/cli-command": "1.13.0" | ||
}, | ||
"gitHead": "4303b74df91f60e36065141289d2ef2277d1d6fc" | ||
"gitHead": "d2e812d14aa446fa580ffa75144a6280627b5a27" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206
9851
+ Added@percy/cli-command@1.13.0(transitive)
+ Added@percy/client@1.13.0(transitive)
+ Added@percy/config@1.13.0(transitive)
+ Added@percy/core@1.13.0(transitive)
+ Added@percy/dom@1.13.0(transitive)
+ Added@percy/env@1.13.0(transitive)
+ Added@percy/logger@1.13.0(transitive)
- Removed@percy/cli-command@1.12.0(transitive)
- Removed@percy/client@1.12.0(transitive)
- Removed@percy/config@1.12.0(transitive)
- Removed@percy/core@1.12.0(transitive)
- Removed@percy/dom@1.12.0(transitive)
- Removed@percy/env@1.12.0(transitive)
- Removed@percy/logger@1.12.0(transitive)
Updated@percy/cli-command@1.13.0