netlify-build-plugin-dareboost
Advanced tools
Comparing version
31
index.js
@@ -21,3 +21,3 @@ const { | ||
try { | ||
const { status, statusText } = await fetch( | ||
const fetchResult = await fetch( | ||
`https://www.dareboost.com/api/0.6${route}`, | ||
@@ -32,3 +32,6 @@ { | ||
); | ||
const fetchData = await fetchResult.json(); | ||
const { status, statusText } = fetchResult; | ||
if (status != 200) { | ||
@@ -38,5 +41,6 @@ return failPlugin( | ||
); | ||
} else { | ||
console.log(`Dareboost: calling route "${route}" => Success`); | ||
} | ||
console.log(`Dareboost: calling route "${route}" => Success`); | ||
return fetchData; | ||
} catch (error) { | ||
@@ -54,2 +58,3 @@ return failPlugin( | ||
build: { failPlugin }, | ||
status: { show }, | ||
}, | ||
@@ -80,5 +85,11 @@ inputs: { monitoringIds, scenarioIds, configurations }, | ||
let showMessage = { | ||
title: "Dareboost Build Plugin", | ||
summary: "Monitoring event created.", | ||
text: "", | ||
}; | ||
if (configurations.length) { | ||
for (let index = 0; index < configurations.length; index++) { | ||
await callAPI( | ||
const { reportId } = await callAPI( | ||
"/analysis/launch", | ||
@@ -88,5 +99,17 @@ configurations[index], | ||
); | ||
if (index == 0) { | ||
showMessage.summary += " Analyses launched:"; | ||
} else { | ||
showMessage.text += "\n"; | ||
} | ||
showMessage.text += ` - for ${configurations[index].url}`; | ||
if (configurations[index].browser && configurations[index].browser.name) | ||
showMessage.text += ` (${configurations[index].browser.name})`; | ||
showMessage.text += `\n report URL: https://www.dareboost.com/en/loading/audit?reportIds=${reportId}`; | ||
} | ||
} | ||
show(showMessage); | ||
}, | ||
}; |
{ | ||
"name": "netlify-build-plugin-dareboost", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
7787
26.11%5
25%115
49.35%