@@ -110,12 +110,12 @@ function rmDir(dir, rmSelf) {
110110async function cleanupFiles ( workingDir ) {
111111
112112try {
113- const gitModule = simpleGit ( __dirname ) ;
113+ const gitModule = simpleGit ( process . cwd ( ) ) ;
114114
115115await gitModule . subModule ( [ 'deinit' , '-f' , workingDir ] ) ;
116116await gitModule . rm ( workingDir ) ;
117117await gitModule . reset ( [ 'HEAD' ] ) ;
118- rmDir ( path . join ( __dirname , '.git' , 'modules' , workingDir ) ) ;
118+ rmDir ( path . join ( process . cwd ( ) , '.git' , 'modules' , workingDir ) ) ;
119119rmDir ( workingDir ) ;
120120
121121return true ;
@@ -135,12 +135,14 @@ async function build({ repo, codeBranch, setupBranch, isLocal }) {
135135
136136let git ;
137137let isSubModule = false ;
138+ let localPath ;
138139
139140if ( isLocal ) {
140141git = simpleGit ( repo ) ;
142+ localPath = repo ;
141143}
142144else {
143- const gitTest = simpleGit ( __dirname ) ;
145+ const gitTest = simpleGit ( process . cwd ( ) ) ;
144146const isRepo = await gitTest . checkIsRepo ( ) ;
145147
146148if ( isRepo ) {
@@ -152,14 +154,16 @@ async function build({ repo, codeBranch, setupBranch, isLocal }) {
152154
153155await gitTest . submoduleAdd ( repo , workingDir ) ;
154156
155- git = simpleGit ( path . join ( __dirname , workingDir ) ) ;
157+ git = simpleGit ( path . join ( process . cwd ( ) , workingDir ) ) ;
156158
157159isSubModule = true ;
160+ localPath = path . join ( process . cwd ( ) , workingDir ) ;
158161
159162}
160163else {
161164await 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 }) {
169173await 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
176180const mdContent = parseContent ( _mdContent ) ;