@@ -110,12 +110,12 @@ function rmDir(dir, rmSelf) {
110110async function cleanupFiles ( workingDir ) {
111111
112112 try {
113- const gitModule = simpleGit ( __dirname ) ;
113+ const gitModule = simpleGit ( process . cwd ( ) ) ;
114114
115115 await gitModule . subModule ( [ 'deinit' , '-f' , workingDir ] ) ;
116116 await gitModule . rm ( workingDir ) ;
117117 await gitModule . reset ( [ 'HEAD' ] ) ;
118- rmDir ( path . join ( __dirname , '.git' , 'modules' , workingDir ) ) ;
118+ rmDir ( path . join ( process . cwd ( ) , '.git' , 'modules' , workingDir ) ) ;
119119 rmDir ( workingDir ) ;
120120
121121 return true ;
@@ -135,12 +135,14 @@ async function build({ repo, codeBranch, setupBranch, isLocal }) {
135135
136136 let git ;
137137 let isSubModule = false ;
138+ let localPath ;
138139
139140 if ( isLocal ) {
140141 git = simpleGit ( repo ) ;
142+ localPath = repo ;
141143 }
142144 else {
143- const gitTest = simpleGit ( __dirname ) ;
145+ const gitTest = simpleGit ( process . cwd ( ) ) ;
144146 const isRepo = await gitTest . checkIsRepo ( ) ;
145147
146148 if ( isRepo ) {
@@ -152,14 +154,16 @@ async function build({ repo, codeBranch, setupBranch, isLocal }) {
152154
153155 await gitTest . submoduleAdd ( repo , workingDir ) ;
154156
155- git = simpleGit ( path . join ( __dirname , workingDir ) ) ;
157+ git = simpleGit ( path . join ( process . cwd ( ) , workingDir ) ) ;
156158
157159 isSubModule = true ;
160+ localPath = path . join ( process . cwd ( ) , workingDir ) ;
158161
159162 }
160163 else {
161164 await gitTest . clone ( repo ) ;
162- git = simpleGit ( __dirname ) ;
165+ git = simpleGit ( process . cwd ( ) ) ;
166+ localPath = process . cwd ( ) ;
163167 }
164168 }
165169
@@ -169,8 +173,8 @@ async function build({ repo, codeBranch, setupBranch, isLocal }) {
169173 await git . checkout ( setupBranch ) ;
170174
171175 // Load files
172- const _mdContent = fs . readFileSync ( path . join ( __dirname , workingDir , 'TUTORIAL.md' ) , 'utf8' ) ;
173- let _config = fs . readFileSync ( path . join ( __dirname , workingDir , 'coderoad.yaml' ) , 'utf8' ) ;
176+ const _mdContent = fs . readFileSync ( path . join ( localPath , 'TUTORIAL.md' ) , 'utf8' ) ;
177+ let _config = fs . readFileSync ( path . join ( localPath , 'coderoad.yaml' ) , 'utf8' ) ;
174178
175179 // Add one more line to the content as per Shawn's request
176180 const mdContent = parseContent ( _mdContent ) ;
0 commit comments