Skip to content

Commit

Permalink
--ignore & --use-readme fixes (#4)
Browse files Browse the repository at this point in the history
* ignore files defaults to empty array, ignore readme by default if it doesnt exist

* bump version
  • Loading branch information
markmur committed May 19, 2017
1 parent 6e49fcf commit e633303
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion bin/docky.js
Expand Up @@ -43,7 +43,10 @@ Commander
options.color = color;
}

const ignoreFiles = [].concat(...ignore.map(pattern => glob.sync(pattern)));
const ignoreFiles = ignore && ignore.length ?
[].concat(...ignore.map(pattern => glob.sync(pattern))) :
[];

const validFiles = ignoreFiles.length ? without(files, ...ignoreFiles) : files;

let filesToWatch = [];
Expand Down
12 changes: 10 additions & 2 deletions index.js
Expand Up @@ -172,9 +172,17 @@ const run = (files, options = {}) => {
color: options.color
};

if (options.useReadme && fileExists('./README.md')) {
const readmeExists = fileExists('./README.md');
const useReadme = options.useReadme && readmeExists;

if (!readmeExists) {
log('No README found, continuing without');
}

data.readmeParts = useReadme ? parseReadme(data.readme) : [];

if (useReadme) {
data.readme = fs.readFileSync('./README.md', 'utf8');
data.readmeParts = parseReadme(data.readme);
}

pug.renderFile(`${dockyPath}/template/template.pug`, data, (renderErr, html) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "docky",
"title": "Docky",
"version": "1.2.0",
"version": "1.3.0",
"description": "Generate Documentation for React Components",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e633303

Please sign in to comment.