@percy/cli-build 1.12.0 → 1.14.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/finalize.js +6 -4
- package/dist/id.js +0 -3
- package/dist/wait.js +14 -22
- package/package.json +3 -3
package/dist/finalize.js
CHANGED
|
@@ -8,18 +8,20 @@ export const finalize = command('finalize', {
|
|
|
8
8
|
log,
|
|
9
9
|
exit
|
|
10
10
|
}) => {
|
|
11
|
-
if (!percy) exit(0, 'Percy is disabled');
|
|
11
|
+
if (!percy) exit(0, 'Percy is disabled');
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// automatically set parallel total to -1
|
|
14
|
+
env.PERCY_PARALLEL_TOTAL || (env.PERCY_PARALLEL_TOTAL = '-1');
|
|
14
15
|
|
|
16
|
+
// ensure that this command is not used for other parallel totals
|
|
15
17
|
if (env.PERCY_PARALLEL_TOTAL !== '-1') {
|
|
16
18
|
log.error('This command should only be used with PERCY_PARALLEL_TOTAL=-1');
|
|
17
19
|
log.error(`Current value is "${env.PERCY_PARALLEL_TOTAL}"`);
|
|
18
20
|
exit(1);
|
|
19
21
|
}
|
|
22
|
+
log.info('Finalizing parallel build...');
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
// rely on the parallel nonce to cause the API to return the current running build for the nonce
|
|
23
25
|
let {
|
|
24
26
|
data: build
|
|
25
27
|
} = await percy.client.createBuild();
|
package/dist/id.js
CHANGED
|
@@ -11,14 +11,12 @@ export const id = command('id', {
|
|
|
11
11
|
exit
|
|
12
12
|
}) {
|
|
13
13
|
var _build;
|
|
14
|
-
|
|
15
14
|
if (!percy) exit(0, 'Percy is disabled');
|
|
16
15
|
let {
|
|
17
16
|
request
|
|
18
17
|
} = await import('@percy/cli-command/utils');
|
|
19
18
|
let ping = `http://localhost:${flags.port}/percy/healthcheck`;
|
|
20
19
|
let build = null;
|
|
21
|
-
|
|
22
20
|
try {
|
|
23
21
|
({
|
|
24
22
|
build
|
|
@@ -31,7 +29,6 @@ export const id = command('id', {
|
|
|
31
29
|
log.debug(err);
|
|
32
30
|
exit(1);
|
|
33
31
|
}
|
|
34
|
-
|
|
35
32
|
if ((_build = build) !== null && _build !== void 0 && _build.id) {
|
|
36
33
|
log.stdout.write(build.id.toString());
|
|
37
34
|
} else {
|
package/dist/wait.js
CHANGED
|
@@ -43,25 +43,26 @@ export const wait = command('wait', {
|
|
|
43
43
|
log,
|
|
44
44
|
exit
|
|
45
45
|
}) {
|
|
46
|
-
if (!percy) exit(0, 'Percy is disabled');
|
|
46
|
+
if (!percy) exit(0, 'Percy is disabled');
|
|
47
47
|
|
|
48
|
+
// do not wait directly on the promise as to not block the event loop
|
|
48
49
|
let waiting = percy.client.waitForBuild(flags, build => {
|
|
49
50
|
logProgress(build, log);
|
|
50
51
|
if (isFailing(build, flags)) exit(1);
|
|
51
|
-
});
|
|
52
|
+
});
|
|
52
53
|
|
|
54
|
+
// wait between event loops to allow process termination
|
|
53
55
|
let handleDone = () => waiting.done = true;
|
|
54
|
-
|
|
55
56
|
waiting.then(handleDone, handleDone);
|
|
56
|
-
|
|
57
57
|
while (!waiting.done) {
|
|
58
58
|
yield new Promise(r => setImmediate(r));
|
|
59
|
-
}
|
|
60
|
-
|
|
59
|
+
}
|
|
61
60
|
|
|
61
|
+
// bubble errors
|
|
62
62
|
yield waiting;
|
|
63
|
-
});
|
|
63
|
+
});
|
|
64
64
|
|
|
65
|
+
// Log build progress
|
|
65
66
|
function logProgress({
|
|
66
67
|
attributes: {
|
|
67
68
|
state,
|
|
@@ -78,27 +79,22 @@ function logProgress({
|
|
|
78
79
|
switch (state) {
|
|
79
80
|
case undefined:
|
|
80
81
|
return log.progress('Waiting for build...');
|
|
81
|
-
|
|
82
82
|
case 'pending':
|
|
83
83
|
return log.progress('Recieving snapshots...');
|
|
84
|
-
|
|
85
84
|
case 'processing':
|
|
86
85
|
return log.progress(`Processing ${count} snapshots - ` + (finished === total ? 'finishing up...' : `${finished} of ${total} comparisons finished...`));
|
|
87
|
-
|
|
88
86
|
case 'finished':
|
|
89
87
|
log.info(`Build #${number} finished! ${url}`);
|
|
90
88
|
return log.info(`Found ${diffs} changes`);
|
|
91
|
-
|
|
92
89
|
case 'failed':
|
|
93
90
|
log.error(`Build #${number} failed! ${url}`);
|
|
94
91
|
return log.error(failureMessage(failReason, failDetails));
|
|
95
|
-
|
|
96
92
|
default:
|
|
97
93
|
return log.error(`Build #${number} is ${state}. ${url}`);
|
|
98
94
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
95
|
+
}
|
|
101
96
|
|
|
97
|
+
// Create failure messages
|
|
102
98
|
function failureMessage(type, {
|
|
103
99
|
missing_parallel_builds: missingParallel,
|
|
104
100
|
parallel_builds_received: parallelCount,
|
|
@@ -107,22 +103,18 @@ function failureMessage(type, {
|
|
|
107
103
|
switch (type) {
|
|
108
104
|
case 'render_timeout':
|
|
109
105
|
return 'Some snapshots in this build took too long ' + 'to render even after multiple retries.';
|
|
110
|
-
|
|
111
106
|
case 'no_snapshots':
|
|
112
107
|
return 'No snapshots were uploaded to this build.';
|
|
113
|
-
|
|
114
108
|
case 'missing_finalize':
|
|
115
109
|
return 'Failed to correctly finalize.';
|
|
116
|
-
|
|
117
110
|
case 'missing_resources':
|
|
118
111
|
return missingParallel ? `Only ${parallelCount} of ${parallelTotal} parallel builds were received.` : 'Some build or snapshot resources failed to correctly upload.';
|
|
119
|
-
|
|
120
112
|
default:
|
|
121
113
|
return `Error: ${type}`;
|
|
122
114
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
115
|
+
}
|
|
125
116
|
|
|
117
|
+
// Return true or false if a build is considered failing or not
|
|
126
118
|
function isFailing({
|
|
127
119
|
attributes: {
|
|
128
120
|
state,
|
|
@@ -132,8 +124,8 @@ function isFailing({
|
|
|
132
124
|
failOnChanges
|
|
133
125
|
}) {
|
|
134
126
|
// not pending and not processing
|
|
135
|
-
return state != null && state !== 'pending' && state !== 'processing' && (
|
|
127
|
+
return state != null && state !== 'pending' && state !== 'processing' && (
|
|
128
|
+
// not finished or finished with diffs
|
|
136
129
|
state !== 'finished' || failOnChanges && !!diffs);
|
|
137
130
|
}
|
|
138
|
-
|
|
139
131
|
export default wait;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/cli-build",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@percy/cli-command": "1.
|
|
35
|
+
"@percy/cli-command": "1.14.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "fd72688e449d6dd3eafd346fc07879cb3bb01a4e"
|
|
38
38
|
}
|