Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
Wipe files in gist before copy
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXyfir committed Mar 24, 2019
1 parent 219db5a commit 827513a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gist-mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ interface GistMirrorConfig {
// Clone gist
await exec(`git clone -q [email protected]:${id}.git`);

// Wipe gist
const gistFiles = await glob(`${id}/**`);
console.log('Wiping gist');
for (let filePath of gistFiles.slice(1)) {
const file = basename(filePath);
console.log(`\t${file}`);
await remove(resolve(gistDir, file));
}

// Copy in files and overwrite existing
console.log('Copying files');
for (let filePath of filesPaths) {
Expand Down

0 comments on commit 827513a

Please sign in to comment.