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

Commit92c534f

Browse files
committed
update the build for the CLI
1 parent8029bb2 commit92c534f

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

‎src/main.js

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function rmDir(dir, rmSelf) {
104104
// check if user want to delete the directory ir just the files in this directory
105105
fs.rmdirSync(dir);
106106
}
107-
107+
108108
}
109109

110110
asyncfunctioncleanupFiles(workingDir){
@@ -137,18 +137,38 @@ async function cleanupFiles(workingDir) {
137137
*@param {string} isLocal define if the repo is local or remote
138138
*/
139139
asyncfunctionbuild({ repo, codeBranch, setupBranch, isLocal}){
140-
141-
constgitModule=simpleGit(__dirname);
142140

143-
conststartCleanup=cleanupFiles(workingDir);
141+
letgit;
142+
letisSubModule=false;
144143

145-
if(startCleanup){
146-
console.log('Clenned old files fromgitmodule...');
144+
if(isLocal){
145+
git=simpleGit(repo);
147146
}
147+
else{
148+
constgitTest=simpleGit(__dirname);
149+
constisRepo=awaitgitTest.checkIsRepo();
150+
151+
if(isRepo){
152+
// Add the new one as a submodule
153+
conststartCleanup=cleanupFiles(workingDir);
154+
155+
if(startCleanup){
156+
console.log('Clenned old files from git module...');
157+
}
148158

149-
awaitgitModule.submoduleAdd(repo,workingDir);
159+
awaitgitTest.submoduleAdd(repo,workingDir);
160+
161+
git=simpleGit(path.join(__dirname,workingDir));
162+
163+
isSubModule=true;
164+
165+
}
166+
else{
167+
awaitgitTest.clone(repo);
168+
git=simpleGit(__dirname);
169+
}
170+
}
150171

151-
constgit=simpleGit(path.join(__dirname,workingDir));
152172
awaitgit.fetch();
153173

154174
// checkout the branch to load configuration and content branch
@@ -215,22 +235,22 @@ async function build({ repo, codeBranch, setupBranch, isLocal }) {
215235
theLevel.setup.commits.push(commit.hash.substr(0,7));
216236
}
217237
}
218-
219238
}
220-
221239
};
222240

223241
// cleanup the submodules
224-
constendCleanup=awaitcleanupFiles(workingDir);
225-
226-
if(!endCleanup){
227-
console.log('Error when deleting the git submodules');
242+
if(!isLocal){
243+
constendCleanup=awaitcleanupFiles(workingDir);
244+
245+
if(!endCleanup){
246+
console.log('Error when deleting the git submodules');
247+
}
228248
}
229249

230250
constisValid=validate(config);
231251

232252
if(!isValid)returnvalidate.errors;
233-
253+
234254
returnconfig;
235255

236256
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp