Skip to content

Commit

Permalink
fix: migrate directory path (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
bearfriend committed Aug 2, 2023
1 parent 70480d8 commit bab2c99
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions bin/migrate-goldens.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand All @@ -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));
Expand Down

0 comments on commit bab2c99

Please sign in to comment.