Skip to content

Commit

Permalink
fix(wpt): remove stale fixtures before pulling fresh ones (#679)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickm68 committed Mar 6, 2023
1 parent ba9d9bc commit 58400eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ export function readJson(file) {
}
return {};
};

export function removeDirectory(directory) {
return fs.promises.rm(directory, { recursive: true, force: true });
}
7 changes: 6 additions & 1 deletion lib/wpt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import path from 'node:path';
import _ from 'lodash';

import GitHubTree from '../github/tree.js';
import { writeFile, readJson, writeJson, readFile } from '../file.js';
import {
writeFile, readJson, writeJson, readFile, removeDirectory
} from '../file.js';
import {
shortSha
} from '../utils.js';
Expand Down Expand Up @@ -73,6 +75,9 @@ export class WPTUpdater {
assets = await this.getAssetList();
}

this.cli.startSpinner('Removing stale assets...');
await removeDirectory(this.fixtures(this.path));

this.cli.startSpinner('Pulling assets...');
await Promise.all(assets.map(
(asset) => this.pullTextFile(fixtures, asset.name)
Expand Down

0 comments on commit 58400eb

Please sign in to comment.