File tree 3 files changed +16
-11
lines changed
3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-console */
2
+ import { copy } from 'fs-extra' ;
3
+
2
4
import {
5
+ emptyDirExceptForDotGit ,
3
6
gitBranchExists ,
4
7
gitCommit ,
5
8
LANGUAGES ,
@@ -71,7 +74,8 @@ async function spreadGeneration(): Promise<void> {
71
74
} ) ;
72
75
73
76
const clientPath = toAbsolutePath ( getLanguageFolder ( lang ) ) ;
74
- await run ( `cp -r ${ clientPath } / ${ tempGitDir } ` ) ;
77
+ await emptyDirExceptForDotGit ( tempGitDir ) ;
78
+ await copy ( clientPath , tempGitDir , { preserveTimestamps : true } ) ;
75
79
76
80
await configureGitHubAuthor ( tempGitDir ) ;
77
81
await run ( `git add .` , { cwd : tempGitDir } ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import path from 'path';
3
3
4
4
import execa from 'execa' ; // https://github.com/sindresorhus/execa/tree/v5.1.1
5
5
import { hashElement } from 'folder-hash' ;
6
+ import { remove } from 'fs-extra' ;
6
7
7
8
import openapitools from '../openapitools.json' ;
8
9
@@ -280,3 +281,11 @@ export async function buildCustomGenerators(verbose: boolean): Promise<void> {
280
281
export async function gitBranchExists ( branchName : string ) : Promise < boolean > {
281
282
return Boolean ( await run ( `git ls-remote --heads origin ${ branchName } ` ) ) ;
282
283
}
284
+
285
+ export async function emptyDirExceptForDotGit ( dir : string ) : Promise < void > {
286
+ for ( const file of await fsp . readdir ( dir ) ) {
287
+ if ( file !== '.git' ) {
288
+ await remove ( path . resolve ( dir , file ) ) ;
289
+ }
290
+ }
291
+ }
Original file line number Diff line number Diff line change 1
1
/* eslint-disable no-console */
2
2
import fsp from 'fs/promises' ;
3
- import path from 'path' ;
4
3
5
4
import dotenv from 'dotenv' ;
6
5
import execa from 'execa' ;
7
- import { copy , remove } from 'fs-extra' ;
6
+ import { copy } from 'fs-extra' ;
8
7
import semver from 'semver' ;
9
8
import type { ReleaseType } from 'semver' ;
10
9
@@ -16,6 +15,7 @@ import {
16
15
exists ,
17
16
getGitHubUrl ,
18
17
gitCommit ,
18
+ emptyDirExceptForDotGit ,
19
19
} from '../common' ;
20
20
import { getLanguageFolder } from '../config' ;
21
21
@@ -127,14 +127,6 @@ async function updateOpenApiTools(
127
127
) ;
128
128
}
129
129
130
- async function emptyDirExceptForDotGit ( dir : string ) : Promise < void > {
131
- for ( const file of await fsp . readdir ( dir ) ) {
132
- if ( file !== '.git' ) {
133
- await remove ( path . resolve ( dir , file ) ) ;
134
- }
135
- }
136
- }
137
-
138
130
async function updateChangelog ( {
139
131
lang,
140
132
issueBody,
You can’t perform that action at this time.
0 commit comments