Skip to content

Commit ed6b383

Browse files
eunjae-leemillotp
andauthored
chore(ci): fix regression regarding emptyDir (#306)
* chore(ci): fix regression regarding emptyDir * chore: fix import order problem * Update scripts/release/process-release.ts Co-authored-by: Pierre Millot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 7163ce0 commit ed6b383

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/release/process-release.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/* eslint-disable no-console */
22
import fsp from 'fs/promises';
3+
import path from 'path';
34

45
import dotenv from 'dotenv';
56
import execa from 'execa';
6-
import { emptyDir, copy } from 'fs-extra';
7+
import { copy, remove } from 'fs-extra';
78
import semver from 'semver';
89
import type { ReleaseType } from 'semver';
910

@@ -110,6 +111,14 @@ async function updateOpenApiTools(
110111
);
111112
}
112113

114+
async function emptyDirExceptForDotGit(dir: string): Promise<void> {
115+
for (const file of await fsp.readdir(dir)) {
116+
if (file !== '.git') {
117+
await remove(path.resolve(dir, file));
118+
}
119+
}
120+
}
121+
113122
async function updateChangelog({
114123
lang,
115124
issueBody,
@@ -206,7 +215,7 @@ async function processRelease(): Promise<void> {
206215
});
207216

208217
const clientPath = toAbsolutePath(getLanguageFolder(lang));
209-
await emptyDir(tempGitDir);
218+
await emptyDirExceptForDotGit(tempGitDir);
210219
await copy(clientPath, tempGitDir, { preserveTimestamps: true });
211220

212221
await configureGitHubAuthor(tempGitDir);

0 commit comments

Comments
 (0)