diff --git a/scripts/package.json b/scripts/package.json index f751249243e..37a56637e42 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -25,6 +25,7 @@ "eslint": "8.12.0", "execa": "5.1.1", "folder-hash": "4.0.2", + "fs-extra": "10.0.1", "inquirer": "8.2.2", "jest": "27.5.1", "js-yaml": "4.1.0", diff --git a/scripts/release/common.ts b/scripts/release/common.ts index 63ae2a586f8..5a4ab9335eb 100644 --- a/scripts/release/common.ts +++ b/scripts/release/common.ts @@ -1,3 +1,5 @@ +import path from 'path'; + import clientsConfig from '../../config/clients.config.json'; import config from '../../config/release.config.json'; import { getGitHubUrl, run } from '../common'; @@ -59,7 +61,7 @@ export async function cloneRepository({ const targetBranch = getTargetBranch(lang); const gitHubUrl = getGitHubUrl(lang, { token: githubToken }); - const tempGitDir = `${tempDir}/${lang}`; + const tempGitDir = path.resolve(tempDir, lang); await run(`rm -rf ${tempGitDir}`); await run( `git clone --depth 1 --branch ${targetBranch} ${gitHubUrl} ${tempGitDir}` diff --git a/scripts/release/process-release.ts b/scripts/release/process-release.ts index 68cbaae0bd1..5c4b09d44b9 100755 --- a/scripts/release/process-release.ts +++ b/scripts/release/process-release.ts @@ -3,6 +3,7 @@ import fsp from 'fs/promises'; import dotenv from 'dotenv'; import execa from 'execa'; +import { emptyDir, copy } from 'fs-extra'; import semver from 'semver'; import type { ReleaseType } from 'semver'; @@ -205,7 +206,8 @@ async function processRelease(): Promise { }); const clientPath = toAbsolutePath(getLanguageFolder(lang)); - await run(`cp -r ${clientPath}/ ${tempGitDir}`); + await emptyDir(tempGitDir); + await copy(clientPath, tempGitDir, { preserveTimestamps: true }); await configureGitHubAuthor(tempGitDir); await run(`git add .`, { cwd: tempGitDir }); diff --git a/yarn.lock b/yarn.lock index 3c6e9d21180..35ae76b128c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10967,7 +10967,7 @@ __metadata: languageName: node linkType: hard -"fs-extra@npm:^10.0.1": +"fs-extra@npm:10.0.1, fs-extra@npm:^10.0.1": version: 10.0.1 resolution: "fs-extra@npm:10.0.1" dependencies: @@ -18835,6 +18835,7 @@ __metadata: eslint: 8.12.0 execa: 5.1.1 folder-hash: 4.0.2 + fs-extra: 10.0.1 inquirer: 8.2.2 jest: 27.5.1 js-yaml: 4.1.0