@@ -9,20 +9,6 @@ import Logger from "../utils/logger.js";
99
1010const reactionRepoRoot = "https://raw.githubusercontent.com/reactioncommerce/reaction/trunk" ;
1111
12- /**
13- * @summary create the git instance
14- * @param {String } projectName - The name of the directory to create
15- * @returns {Object } - the git instance
16- */
17- function getGitInstance ( projectName ) {
18- const gitOptions = {
19- baseDir : `${ process . cwd ( ) } /${ projectName } ` ,
20- binary : "git" ,
21- maxConcurrentProcesses : 6
22- } ;
23- return simpleGit ( gitOptions ) ;
24- }
25-
2612/**
2713 * @summary create project directory
2814 * @param {String } projectName - The name of the directory to create
@@ -130,16 +116,28 @@ async function getFilesFromCore(projectName, options) {
130116 return true ;
131117}
132118
119+ /**
120+ * @summary create the git instance
121+ * @param {String } projectName - The name of the directory to create
122+ * @returns {Object } - the git instance
123+ */
124+ function getGit ( projectName ) {
125+ const gitOptions = {
126+ baseDir : `${ process . cwd ( ) } /${ projectName } ` ,
127+ binary : "git" ,
128+ maxConcurrentProcesses : 6
129+ } ;
130+ return simpleGit ( gitOptions ) ;
131+ }
133132
134133/**
135134 * @summary git init the newly created project
136135 * @param {String } projectName - The project to init
137136 * @returns {Promise<Boolean> } true if success
138137 */
139138async function gitInitDirectory ( projectName ) {
140- const git = getGitInstance ( projectName ) ;
141139 try {
142- await git . init ( ) ;
140+ await getGit ( projectName ) . init ( ) ;
143141 } catch ( error ) {
144142 Logger . error ( error ) ;
145143 }
@@ -152,9 +150,8 @@ async function gitInitDirectory(projectName) {
152150 * @returns {Promise<boolean> } true for success
153151 */
154152async function addSampleDataPlugin ( projectName ) {
155- const git = getGitInstance ( projectName ) ;
156153 try {
157- await git . clone ( "[email protected] :reactioncommerce/api-plugin-sample-data.git" , "custom-packages/api-plugin-sample-data" ) ; 154+ await getGit ( projectName ) . clone ( "[email protected] :reactioncommerce/api-plugin-sample-data.git" , "./ custom-packages/api-plugin-sample-data" ) ; 158155
159156 const pluginJsonPath = `${ projectName } /plugins.json` ;
160157 const plugins = JSON . parse ( await readFile ( pluginJsonPath ) ) ;
0 commit comments