From bab2c992bdbf8d1c0eb5fc5512dd4e6e56dea427 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Wed, 2 Aug 2023 08:48:20 -0400 Subject: [PATCH] fix: migrate directory path (#110) --- bin/migrate-goldens.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bin/migrate-goldens.js b/bin/migrate-goldens.js index c6ef015b..2977d990 100755 --- a/bin/migrate-goldens.js +++ b/bin/migrate-goldens.js @@ -8,7 +8,6 @@ import { stdout } from 'node:process'; const { pattern = './test/**' } = commandLineArgs({ name: 'pattern', type: String, defaultOption: true }, { partial: true }); const oldSuffix = 'screenshots/ci/golden'; -const newSuffix = `${PATHS.GOLDEN}/chromium`; const dirs = await glob(`${pattern}/${oldSuffix}`, { ignore: 'node_modules/**', posix: true }); let fileCount = 0; @@ -20,9 +19,6 @@ if (!new RegExp(`${PATHS.VDIFF_ROOT}/(\n|$)`).test(gitignore)) { await Promise.all(dirs.map(async dir => { const files = await glob(`${dir}/*/*.png`, { posix: true }); - const base = dir.replace(normalize(oldSuffix), ''); - - await mkdir(join(base, normalize(newSuffix)), { recursive: true }); await Promise.all(files.map(async file => { fileCount += 1; @@ -33,7 +29,7 @@ await Promise.all(dirs.map(async dir => { .replace(/^d2l-/, '') .replace(new RegExp(`^${dirName}-`), ''); - const newDir = join(dir.replace(oldSuffix, newSuffix)); + const newDir = dir.replace(`${oldSuffix}/${dirName}`, `${PATHS.GOLDEN}/${dirName}/chromium`); await mkdir(newDir, { recursive: true }); return rename(file, join(newDir, newName));