og-screenshots
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -58,4 +58,4 @@ import React, { useEffect } from 'react'; | ||
setFinisedWorks((prev) => [...prev, transformedUrl || url]); | ||
}, (url, _error, transformedUrl) => { | ||
setErrorWorks((prev) => [...prev, transformedUrl || url]); | ||
}, (url, error, transformedUrl) => { | ||
setErrorWorks((prev) => [...prev, [transformedUrl || url, error.toString()]]); | ||
}, (url, _outputPath, transformedUrl) => { | ||
@@ -81,3 +81,3 @@ setSkippedWorks((prev) => [...prev, transformedUrl || url]); | ||
const isSkipped = skippedWorks.includes(url); | ||
const isError = errorWorks.includes(url); | ||
const isError = errorWorks.some(([theUrl]) => theUrl === url); | ||
const isProcessing = !isFinished && !isError && !isSkipped; | ||
@@ -117,3 +117,11 @@ const isScreenshotted = didScreenshotWorks.includes(url); | ||
skippedWorks.length + | ||
' URLs because they already exist. Run the command with the --overwrite option to overwrite them.')))); | ||
' URLs because they already exist. Run the command with the --overwrite option to overwrite them.')), | ||
errorWorks.length > 0 && (React.createElement(Text, null, | ||
"\u274C Errors occurred while processing ", | ||
errorWorks.length, | ||
" URLs.", | ||
errorWorks.map(([url, error]) => (React.createElement(Text, { key: url }, | ||
url, | ||
": ", | ||
error))))))); | ||
} |
@@ -45,7 +45,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
onStart?.(url, outputPath, transformOrigin ? theUrl.toString() : undefined); | ||
const existing = await fs.stat(outputPath); | ||
if (!overwrite && existing.isFile()) { | ||
onSkip?.(url, outputPath, transformOrigin ? theUrl.toString() : undefined); | ||
return null; | ||
try { | ||
const existing = await fs.stat(outputPath); | ||
if (!overwrite && existing.isFile()) { | ||
onSkip?.(url, outputPath, transformOrigin ? theUrl.toString() : undefined); | ||
return null; | ||
} | ||
} | ||
catch (error) { | ||
// ignore | ||
} | ||
onScreenshot?.(url, outputPath, 'start', transformOrigin ? theUrl.toString() : undefined); | ||
@@ -52,0 +57,0 @@ const command = `"${chromePath}" --headless=new --force-device-scale-factor=1 --screenshot="${outputPath}" --window-size=${windowSize} "${theUrl.toString()}"`; |
{ | ||
"name": "og-screenshots", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"license": "AGPL-3.0-only", | ||
"bin": "dist/cli.js", | ||
"bin": { | ||
"og-screenshots": "dist/cli.js" | ||
}, | ||
"type": "module", | ||
@@ -7,0 +9,0 @@ "engines": { |
93817
386