@@ -14,34 +14,33 @@ const ghUrl = 'https://github.com/'
1414repos . forEach ( ( repo ) => {
1515 const repoDir = `repo_to_be_edited/${ repo . label } `
1616
17- // Clone the repository
18- const cloneCommand = `git clone ${ ghUrl + repo . repo } ${ repoDir } `
17+ // If the repo contains "cluster-stacks", clone the "restructure_container" branch
18+ const branchOption = repo . repo . includes ( 'cluster-stacks' )
19+ ? '--branch docs/r8 '
20+ : ''
21+ const cloneCommand = `git clone ${ branchOption } ${
22+ ghUrl + repo . repo
23+ } ${ repoDir } `
24+
25+ console . log ( `Cloning: ${ cloneCommand } ` )
1926 execSync ( cloneCommand )
2027
2128 // Remove git folders
22- const removeGitCommand = `rm -rf ${ repoDir } /.git`
23- execSync ( removeGitCommand )
29+ execSync ( `rm -rf ${ repoDir } /.git` )
2430
2531 // Remove README files
26- const removeReadmeCommand = `find ${ repoDir } -name "README.md" | xargs rm -f`
27- execSync ( removeReadmeCommand )
32+ execSync ( `find ${ repoDir } -name "README.md" | xargs rm -f` )
2833
2934 // Create the docusaurus subdirectory
3035 const subDirPath = `${ repo . target } /${ repo . label } `
3136 fs . mkdirSync ( subDirPath , { recursive : true } )
3237
3338 // Copy docs content from A to B
34- // allow multiple sources here so the same repo need not be checked out multiple times
35- // however, it would be better if this script automatically grouped all entries by repo and then only
36- // checked out each repo only once; I leave this as a TODO because I don't fully grasp the meaning of
37- // label, for instance, and the label is used for the temporary repo directory
3839 let sources = Array . isArray ( repo . source ) ? repo . source : [ repo . source ]
3940 sources . forEach ( ( source ) => {
40- const copyDocsCommand = `cp -r ${ repoDir } /${ source } ${ subDirPath } `
41- execSync ( copyDocsCommand )
41+ execSync ( `cp -r ${ repoDir } /${ source } ${ subDirPath } ` )
4242 } )
4343
4444 // Remove the cloned repository
45- const removeRepoCommand = 'rm -rf repo_to_be_edited'
46- execSync ( removeRepoCommand )
45+ execSync ( 'rm -rf repo_to_be_edited' )
4746} )
0 commit comments