Skip to content

Commit 8a0febd

Browse files
authored
fix: removeSync in case of directory in copy-to-clients (#1452)
1 parent 0a97419 commit 8a0febd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

scripts/generate-clients/copy-to-clients.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22
const { join } = require("path");
3-
const { copySync, ensureDirSync } = require("fs-extra");
3+
const { copySync, removeSync } = require("fs-extra");
44
const { readdirSync, lstatSync, readFileSync, existsSync, writeFileSync } = require("fs");
55

66
const getOverwritablePredicate = (packageName) => (pathName) => {
@@ -96,8 +96,7 @@ const copyToClients = async (sourceDir, destinationDir) => {
9696
pinDependencies(mergedManifest);
9797
writeFileSync(destSubPath, JSON.stringify(mergedManifest, null, 2).concat(`\n`));
9898
} else if (overwritablePredicate(packageSub) || !existsSync(destSubPath)) {
99-
//Overwrite the directories and files that are overwritable, or not yet exists
100-
if (lstatSync(packageSubPath).isDirectory()) ensureDirSync(destSubPath);
99+
if (lstatSync(packageSubPath).isDirectory()) removeSync(destSubPath);
101100
copySync(packageSubPath, destSubPath, {
102101
overwrite: true,
103102
});

0 commit comments

Comments
 (0)