Skip to content

Commit

Permalink
fix: 🐛 Valid if githubRepository.api.index exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael-R committed Aug 14, 2020
1 parent 9b96d75 commit ca24cb8
Show file tree
Hide file tree
Showing 2 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": "readme-template-generator",
"version": "0.7.1",
"version": "0.7.2",
"description": "CLI to help create readme file to document your project",
"private": false,
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/readme-template-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const command: GluegunCommand = {

const description: string = await question({
message: 'Write a short description about project:',
defaultValue: githubRepository.api.index.description || packageJson.description,
defaultValue: githubRepository.api.index?.description || packageJson.description,
validate: (value: string) => value === '' ? 'Description its necessary' : true
})

Expand Down Expand Up @@ -284,9 +284,9 @@ const command: GluegunCommand = {
})

const license: Types.License = {
name: githubRepository.api.index.license.name || read('LICENSE')?.split('\n')[0]?.trim() ||
name: githubRepository.api.index?.license.name || read('LICENSE')?.split('\n')[0]?.trim() ||
packageJson.license,
url: githubRepository.api.index.license.url || (githubRepository.url && read('LICENSE') && `${githubRepository.url}/blob/master/LICENSE`)
url: githubRepository.api.index?.license.url || (githubRepository.url && read('LICENSE') && `${githubRepository.url}/blob/master/LICENSE`)
}

license.name = await question({
Expand Down

0 comments on commit ca24cb8

Please sign in to comment.