build(analytics): allow build analytics to take previous exit code as the first argument
This commit is contained in:
parent
10fedd0dfc
commit
d9e78e4fa8
|
@ -1,5 +1,10 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
// Usage:
|
||||||
|
//
|
||||||
|
// build analytics start|success|error|<exitCode> <actionCategory> <actionName>
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +21,11 @@ if (!analytics[actionCategory + 'Start']) {
|
||||||
throw new Error('Unknown build-analytics actionCategory "' + actionCategory + '"');
|
throw new Error('Unknown build-analytics actionCategory "' + actionCategory + '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var exitCode = Number.parseInt(eventType, 10);
|
||||||
|
if (!Number.isNaN(exitCode)) {
|
||||||
|
eventType = (exitCode === 0) ? 'success' : 'error';
|
||||||
|
}
|
||||||
|
|
||||||
if (eventType != 'start' && eventType != 'success' && eventType != 'error') {
|
if (eventType != 'start' && eventType != 'success' && eventType != 'error') {
|
||||||
throw new Error('Unknown build-analytics eventType "' + eventType + '"');
|
throw new Error('Unknown build-analytics eventType "' + eventType + '"');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue