Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65defbe

Browse files
committed
replace __dirname by process.cwd() as dir finder
1 parent9268392 commit65defbe

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

‎src/parse.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ function rmDir(dir, rmSelf) {
110110
asyncfunctioncleanupFiles(workingDir){
111111

112112
try{
113-
constgitModule=simpleGit(__dirname);
113+
constgitModule=simpleGit(process.cwd());
114114

115115
awaitgitModule.subModule(['deinit','-f',workingDir]);
116116
awaitgitModule.rm(workingDir);
117117
awaitgitModule.reset(['HEAD']);
118-
rmDir(path.join(__dirname,'.git','modules',workingDir));
118+
rmDir(path.join(process.cwd(),'.git','modules',workingDir));
119119
rmDir(workingDir);
120120

121121
returntrue;
@@ -135,12 +135,14 @@ async function build({ repo, codeBranch, setupBranch, isLocal }) {
135135

136136
letgit;
137137
letisSubModule=false;
138+
letlocalPath;
138139

139140
if(isLocal){
140141
git=simpleGit(repo);
142+
localPath=repo;
141143
}
142144
else{
143-
constgitTest=simpleGit(__dirname);
145+
constgitTest=simpleGit(process.cwd());
144146
constisRepo=awaitgitTest.checkIsRepo();
145147

146148
if(isRepo){
@@ -152,14 +154,16 @@ async function build({ repo, codeBranch, setupBranch, isLocal }) {
152154

153155
awaitgitTest.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
awaitgitTest.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
awaitgit.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
constmdContent=parseContent(_mdContent);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp