Skip to content

Commit

Permalink
🐛 Fix lastCommit optional author details bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 27, 2019
1 parent a487a77 commit 149f66e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@staart/site",
"version": "1.0.8",
"version": "1.1.1",
"module": "dist/module.js",
"main": "dist/index.js",
"bin": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const generatePage = async (path: string, content: string) => {
if (!config.noLastModified) {
const lastCommit = await getLastCommit(path);
const githubUrl = await getGitHubRepoUrl();
if (lastCommit)
if (lastCommit && lastCommit.author && lastCommit.commit)
content += `\n\n<p class="post-footer">This page was last modified in <a href="${
lastCommit.html_url
}" target="_blank">${lastCommit.sha.substr(0, 6)}</a> by <a href="${
Expand Down
4 changes: 2 additions & 2 deletions src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const getLastCommit = async (
| {
html_url: string;
sha: string;
author: {
author?: {
login: string;
name: string;
avatar_url: string;
html_url: string;
};
commit: {
commit?: {
message: string;
author: {
name: string;
Expand Down

0 comments on commit 149f66e

Please sign in to comment.