diff --git a/experiments/automatedScreenshots/flatSkins/.gitignore b/experiments/automatedScreenshots/flatSkins/.gitignore new file mode 100644 index 00000000..5e7d2734 --- /dev/null +++ b/experiments/automatedScreenshots/flatSkins/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/experiments/automatedScreenshots/index.js b/experiments/automatedScreenshots/index.js index e1a48ef8..b54a292b 100644 --- a/experiments/automatedScreenshots/index.js +++ b/experiments/automatedScreenshots/index.js @@ -92,10 +92,16 @@ const config = { for (const skin of files) { const skinMd5 = md5File.sync(skin); - const screenshotFile = `screenshots/${skin.replace( - /\//g, - "-" - )}-${skinMd5}.png`; + const fileName = `${skin.replace(/\//g, "-")}-${skinMd5}`; + const screenshotFile = `screenshots/${fileName}.png`; + if (fs.existsSync(screenshotFile)) { + console.log(screenshotFile, "exists already"); + continue; + } + const flatSkinFile = `flatSkins/${fileName}.wsz`; + if (!fs.existsSync(flatSkinFile)) { + fs.linkSync(skin, flatSkinFile); + } const skinUrl = `experiments/automatedScreenshots/${skin}`; console.log("Going to try", screenshotFile); try { @@ -104,10 +110,6 @@ const config = { console.log("Error parsing", skinUrl, e); continue; } - if (fs.existsSync(screenshotFile)) { - console.log(screenshotFile, "exists already"); - continue; - } const page = await browser.newPage(); page.setViewport({ width: 275, height: 116 * 3 }); page.on("console", (...args) => {