From 4f1d089228e1b0ada525286a6c827bb3445899e1 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Mar 2022 16:08:35 +0200 Subject: [PATCH 1/3] chore(ci): copy generated folder to each repository --- package.json | 1 + scripts/release/common.ts | 4 +++- scripts/release/process-release.ts | 4 +++- yarn.lock | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0935bbb140a..3bb04733ca5 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "eslint-plugin-prettier": "4.0.0", "eslint-plugin-unused-imports": "2.0.0", "eslint-plugin-yml": "0.12.0", + "fs-extra": "10.0.1", "json": "11.0.0", "mustache": "4.2.0", "prettier": "2.5.1", 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 e07343b12e3..c307dbc4bc5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24,6 +24,7 @@ __metadata: eslint-plugin-prettier: 4.0.0 eslint-plugin-unused-imports: 2.0.0 eslint-plugin-yml: 0.12.0 + fs-extra: 10.0.1 json: 11.0.0 mustache: 4.2.0 prettier: 2.5.1 @@ -10656,7 +10657,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: From 9f49ea98a8a750def4ce664805dd0fac1de3d2b1 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Mar 2022 16:24:09 +0200 Subject: [PATCH 2/3] chore: move dependency --- package.json | 1 - scripts/package.json | 1 + yarn.lock | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3bb04733ca5..0935bbb140a 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "eslint-plugin-prettier": "4.0.0", "eslint-plugin-unused-imports": "2.0.0", "eslint-plugin-yml": "0.12.0", - "fs-extra": "10.0.1", "json": "11.0.0", "mustache": "4.2.0", "prettier": "2.5.1", diff --git a/scripts/package.json b/scripts/package.json index eb28bce0160..d3e415170af 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -25,6 +25,7 @@ "eslint": "8.6.0", "execa": "5.1.1", "folder-hash": "4.0.2", + "fs-extra": "10.0.1", "inquirer": "8.2.0", "jest": "27.4.7", "js-yaml": "4.1.0", diff --git a/yarn.lock b/yarn.lock index c307dbc4bc5..0b1bcaca6a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24,7 +24,6 @@ __metadata: eslint-plugin-prettier: 4.0.0 eslint-plugin-unused-imports: 2.0.0 eslint-plugin-yml: 0.12.0 - fs-extra: 10.0.1 json: 11.0.0 mustache: 4.2.0 prettier: 2.5.1 @@ -18299,6 +18298,7 @@ __metadata: eslint: 8.6.0 execa: 5.1.1 folder-hash: 4.0.2 + fs-extra: 10.0.1 inquirer: 8.2.0 jest: 27.4.7 js-yaml: 4.1.0 From 60decb61981cd2db8598e1405afa4ec75a344674 Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Mon, 28 Mar 2022 16:42:35 +0200 Subject: [PATCH 3/3] chore: fix yarn.lock --- yarn.lock | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index 72821465d87..35ae76b128c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18968,8 +18968,7 @@ __metadata: bytes: 3.0.0 content-disposition: 0.5.2 fast-url-parser: 1.1.3 - mime-types: - 2.1.18 + mime-types: 2.1.18 minimatch: 3.0.4 path-is-inside: 1.0.2 path-to-regexp: 2.2.1