Skip to content

Commit

Permalink
fix: better repo handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 7, 2018
1 parent 65f107e commit 4b1add8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/generators/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class App extends Generator {
if (bin.includes('/')) bin = bin.split('/').pop()
return bin
}
repository?: string

constructor(args: any, opts: any) {
super(args, opts)
Expand Down Expand Up @@ -121,6 +122,10 @@ class App extends Generator {
},
options: this.options,
}
this.repository = defaults.repository
if (this.repository && (this.repository as any).url) {
this.repository = (this.repository as any).url
}
try {
let yml = this.fs.read('.circleci/config.yml')
this.options['semantic-release'] = yml.includes('semantic-release')
Expand Down Expand Up @@ -182,7 +187,7 @@ class App extends Generator {
type: 'input',
name: 'github.user',
message: 'github owner of repository (https://github.com/OWNER/repo)',
default: defaults.repository.split('/').slice(0, -1).pop(),
default: repository.split('/').slice(0, -1).pop(),
when: !this.pjson.repository,
},
{
Expand Down
10 changes: 5 additions & 5 deletions templates/README.md.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<%= pjson.description %>

[![Version](https://img.shields.io/npm/v/<%= pjson.name %>.svg)](https://npmjs.org/package/<%= pjson.name %>)
[![CircleCI](https://circleci.com/gh/<%= pjson.repository %>/tree/master.svg?style=svg)](https://circleci.com/gh/<%= pjson.repository %>/tree/master)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/<%= pjson.repository %>?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/<%= pjson.repository.split('/').pop() %>/branch/master)
[![Codecov](https://codecov.io/gh/<%= pjson.repository %>/branch/master/graph/badge.svg)](https://codecov.io/gh/<%= pjson.repository %>)
[![Greenkeeper](https://badges.greenkeeper.io/<%= pjson.repository %>.svg)](https://greenkeeper.io/)
[![CircleCI](https://circleci.com/gh/<%= repository %>/tree/master.svg?style=svg)](https://circleci.com/gh/<%= repository %>/tree/master)
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/github/<%= repository %>?branch=master&svg=true)](https://ci.appveyor.com/project/heroku/<%= repository.split('/').pop() %>/branch/master)
[![Codecov](https://codecov.io/gh/<%= repository %>/branch/master/graph/badge.svg)](https://codecov.io/gh/<%= repository %>)
[![Greenkeeper](https://badges.greenkeeper.io/<%= repository %>.svg)](https://greenkeeper.io/)
[![Known Vulnerabilities](https://snyk.io/test/npm/<%= pjson.name %>/badge.svg)](https://snyk.io/test/npm/<%= pjson.name %>)
[![Downloads/week](https://img.shields.io/npm/dw/<%= pjson.name %>.svg)](https://npmjs.org/package/<%= pjson.name %>)
[![License](https://img.shields.io/npm/l/<%= pjson.name %>.svg)](https://github.com/<%= pjson.repository %>/blob/master/package.json)
[![License](https://img.shields.io/npm/l/<%= pjson.name %>.svg)](https://github.com/<%= repository %>/blob/master/package.json)

0 comments on commit 4b1add8

Please sign in to comment.