Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Fix author meta data when author is an object.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Stone committed Jul 23, 2018
1 parent 99f9765 commit b73978e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/js/linkStyleguides.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ const currentPath = process.cwd();
const README_NAME = 'STYLEGUIDE.md';
const COMPONENTS = 'src/components/**/[A-Z]*.jsx';

const getAuthor = author => {
if (typeof author === 'string') {
return author;
}
if (author && author.name) {
return author.name;
}
return false;
};

const buildSection = (pkgPath, readmePath, components) => {
// eslint-disable-next-line
const pkg = require(pkgPath);
Expand All @@ -14,7 +24,7 @@ const buildSection = (pkgPath, readmePath, components) => {
components,
description: `| Version | Homepage | Author |\n| - | - | - |\n| ${
pkg.version
} | ${pkg.homepage || 'not specified'} | ${pkg.author || 'not specified'} |`,
} | ${pkg.homepage || 'not specified'} | ${getAuthor(pkg.author) || 'not specified'} |`,
};
if (fs.existsSync(readmePath)) {
section.content = fs.realpathSync(readmePath);
Expand Down

0 comments on commit b73978e

Please sign in to comment.