Skip to content

Commit

Permalink
fix: added bin script to pjson
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 2, 2018
1 parent b7cf1f4 commit 190cb30
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/generators/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class App extends Generator {
githubUser: string | undefined
answers!: {
name: string
bin: string
description: string
version: string
engines: {node: string}
Expand Down Expand Up @@ -134,6 +135,13 @@ class App extends Generator {
default: defaults.name,
when: !this.pjson.name,
},
{
type: 'input',
name: 'bin',
message: 'command bin name the CLI will export',
default: (answers: any) => (answers.name || this._bin).split('/').pop(),
when: ['single', 'multi'].includes(this.type) && !this.pjson.anycli.bin,
},
{
type: 'input',
name: 'description',
Expand Down Expand Up @@ -210,6 +218,11 @@ class App extends Generator {
this.semantic_release = this.options['semantic-release']

this.pjson.name = this.answers.name || defaults.name
if (['single', 'multi'].includes(this.type)) {
this.pjson.anycli.bin = this.answers.bin || this._bin
this.pjson.bin = this.pjson.bin || {}
this.pjson.bin[this.pjson.anycli.bin] = './bin/run'
}
this.pjson.description = this.answers.description || defaults.description
this.pjson.version = this.answers.version || defaults.version
this.pjson.engines.node = this.answers.engines ? this.answers.engines.node : defaults.engines.node
Expand Down

0 comments on commit 190cb30

Please sign in to comment.