Skip to content

Commit

Permalink
fix(server): fix static server cwd error when there is no ykit config…
Browse files Browse the repository at this point in the history
… file
  • Loading branch information
yuhaoju committed Aug 10, 2017
1 parent fe56b5f commit 3a29c0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions lib/commands/server.js
Expand Up @@ -640,12 +640,13 @@ exports.run = function (options) {
dirLevel += i === 0 ? dirSections[i] : '/' + dirSections[i];

var searchDir = sysPath.join(cwd, dirLevel, '');
var ykitConf = globby.sync(['ykit.*.js', 'ykit.js'], { cwd: searchDir })[0];

if (ykitConf) {
projectDir = searchDir;
projectName = sysPath.basename(searchDir);
break;
if (fs.lstatSync(searchDir).isDirectory()) {
var ykitConf = globby.sync(['ykit.*.js', 'ykit.js'], { cwd: searchDir })[0];
if (ykitConf) {
projectDir = searchDir;
projectName = sysPath.basename(searchDir);
break;
}
}
}

Expand Down
13 changes: 7 additions & 6 deletions src/commands/server.js
Expand Up @@ -629,12 +629,13 @@ exports.run = (options) => {
dirLevel += i === 0 ? dirSections[i] : '/' + dirSections[i] ;

const searchDir = sysPath.join(cwd, dirLevel, '');
const ykitConf = globby.sync(['ykit.*.js', 'ykit.js'], {cwd: searchDir})[0];

if(ykitConf) {
projectDir = searchDir;
projectName = sysPath.basename(searchDir);
break;
if (fs.lstatSync(searchDir).isDirectory()) {
const ykitConf = globby.sync(['ykit.*.js', 'ykit.js'], {cwd: searchDir})[0];
if(ykitConf) {
projectDir = searchDir;
projectName = sysPath.basename(searchDir);
break;
}
}
}

Expand Down

0 comments on commit 3a29c0d

Please sign in to comment.