Skip to content

Commit

Permalink
fix(app generator): dasherize the directory-derived default package name
Browse files Browse the repository at this point in the history
Ensure lowercase names containing no whitespace.
  • Loading branch information
cueedee committed Aug 26, 2016
1 parent e9a0c84 commit 22101b6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ var generators = require( 'yeoman-generator' )
, _ = require( 'lodash' )
;

var clean = require( 'underscore.string/clean' );
var clean = require( 'underscore.string/clean' )
, dasherize = require( 'underscore.string/dasherize' )
, trim = require( 'underscore.string/trim' )
;

// Use a different delimiter when our template itself is meant to be a template or template-like.
//
Expand Down Expand Up @@ -150,7 +153,11 @@ var AppGenerator = generators.Base.extend(
type: 'input'
, name: 'packageName'
, message: 'What is the name of this webapp you so desire?'
, default: youtil.definedToString( this.options.packageName ) || youtil.definedToString( this.appname )
, default:
(
youtil.definedToString( this.options.packageName )
|| trim( dasherize( youtil.definedToString( this.appname )), '-' )
)
, validate: youtil.isNpmName
}
, {
Expand Down

0 comments on commit 22101b6

Please sign in to comment.