Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

Commit

Permalink
Fix ESLint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
acjh committed Jan 22, 2018
1 parent 969c071 commit 46a2293
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ program
})
.then(() => {
const watcher = chokidar.watch(rootFolder, {
ignored: [outputFolder, /(^|[\/\\])\../],
ignored: [outputFolder, /(^|[/\\])\../],
ignoreInitial: true,
});
watcher
Expand Down
6 changes: 3 additions & 3 deletions lib/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Page.prototype.resolveDependency = function (dependency) {
logger.info(`Converting dynamic external resource ${file} to ${resultPath}`);
tempPath = path.join(path.dirname(this.tempPath), '.external', path.basename(file));
}
markbinder.includeFile(file, {
return markbinder.includeFile(file, {
baseUrlMap: this.baseUrlMap,
rootPath: this.rootPath,
})
Expand All @@ -177,8 +177,8 @@ Page.prototype.resolveDependency = function (dependency) {
.then(() => {
// Recursion call to resolve nested dependency
const resolvingFiles = [];
unique(markbinder.getDynamicIncludeSrc()).forEach((source) => {
!FsUtil.isUrl(source.to) && resolvingFiles.push(this.resolveDependency(source));
unique(markbinder.getDynamicIncludeSrc()).forEach((src) => {
if (!FsUtil.isUrl(src.to)) resolvingFiles.push(this.resolveDependency(src));
});
return Promise.all(resolvingFiles);
})
Expand Down
30 changes: 14 additions & 16 deletions lib/Site.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ Site.initSite = function (rootPath) {
if (fs.existsSync(configPath)) {
return Promise.resolve();
}
fs.outputJsonAsync(configPath, SITE_CONFIG_DEFAULT);
return fs.outputJsonAsync(configPath, SITE_CONFIG_DEFAULT);
})
.then(() => fs.accessAsync(indexPath))
.catch(() => {
if (fs.existsSync(indexPath)) {
return Promise.resolve();
}
fs.outputFileAsync(indexPath, INDEX_MARKDOWN_DEFAULT);
return fs.outputFileAsync(indexPath, INDEX_MARKDOWN_DEFAULT);
})
.then(resolve)
.catch(reject);
Expand Down Expand Up @@ -160,20 +160,18 @@ Site.prototype.createPageData = function (config) {
};

Site.prototype.collectBaseUrl = function () {
return new Promise((resolve, reject) => {
// console.log('Root: ', this.rootPath)
const candidates
= walkSync(this.rootPath, { directories: false })
.filter(x => x.endsWith('site.json'))
.map(x => path.resolve(x));
const candidates
= walkSync(this.rootPath, { directories: false })
.filter(x => x.endsWith('site.json'))
.map(x => path.resolve(x));

const lookUp = candidates.reduce((pre, now) => {
pre[path.dirname(now)] = true;
return pre;
}, {});
this.baseUrlMap = lookUp;
resolve();
});
this.baseUrlMap = candidates.reduce((pre, now) => {
// eslint-disable-next-line no-param-reassign
pre[path.dirname(now)] = true;
return pre;
}, {});

return Promise.resolve();
};

Site.prototype.generate = function () {
Expand Down Expand Up @@ -300,7 +298,7 @@ Site.prototype.deploy = function () {
const basePath = this.siteConfig.deploy.baseDir || this.outputPath;
if (!fs.existsSync(basePath)) {
reject(new Error('The site directory does not exist. Please build the site first before deploy.'));
return;
return undefined;
}
const options = {};
options.branch = this.siteConfig.deploy.branch || defaultDeployConfig.branch;
Expand Down

0 comments on commit 46a2293

Please sign in to comment.