Skip to content

Commit

Permalink
Fix Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bearfriend committed Aug 1, 2023
1 parent a8611ba commit 10445c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/migrate-goldens.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import { appendFile, mkdir, readFile, rename, rm } from 'node:fs/promises';
import { join, normalize, parse, sep } from 'node:path';
import { join, normalize, parse } from 'node:path';
import commandLineArgs from 'command-line-args';
import { glob } from 'glob';
import { PATHS } from '../src/server/visual-diff-plugin.js';
Expand All @@ -9,7 +9,7 @@ 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/**' });
const dirs = await glob(`${pattern}/${oldSuffix}`, { ignore: 'node_modules/**', posix: true });
let fileCount = 0;

const gitignore = await readFile('.gitignore', { encoding: 'UTF8' }).catch(() => '');
Expand All @@ -19,7 +19,7 @@ if (!new RegExp(`${PATHS.VDIFF_ROOT}/(\n|$)`).test(gitignore)) {
}

await Promise.all(dirs.map(async dir => {
const files = await glob(`${dir.replaceAll(sep, '/')}/*/*.png`);
const files = await glob(`${dir}/*/*.png`, { posix: true });
const base = dir.replace(normalize(oldSuffix), '');

await mkdir(join(base, normalize(newSuffix)), { recursive: true });
Expand Down

0 comments on commit 10445c0

Please sign in to comment.