Skip to content

Commit

Permalink
fix(demo generator): fix running demo generator through composeWith()
Browse files Browse the repository at this point in the history
The real `package.json` file didn't yet exist when the `bat:demo` generator was invoked from the `app` generator.
  • Loading branch information
cueedee committed Jul 22, 2015
1 parent 07fd501 commit 0b4ce2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,7 @@ var AppGenerator = generators.Base.extend(
]
;

if ( data.demo )
{
this.composeWith( 'bat:demo' );
}
else
if ( !( data.demo ))
{
//
// Do not write these when a demo app is wanted right now; avoids conflicts.
Expand Down Expand Up @@ -386,6 +382,14 @@ var AppGenerator = generators.Base.extend(

this._templatesProcess( templates );
}

, setupDemo: function ()
{
if ( this.templateData.demo )
{
this.composeWith( 'bat:demo' );
}
}
}

, install: function ()
Expand Down
2 changes: 1 addition & 1 deletion generators/demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var DemoGenerator = generators.Base.extend(
{
this._assertBatApp();

var npm = require( this.destinationPath( 'package.json' ));
var npm = this.fs.readJSON( this.destinationPath( 'package.json' ));

// Container for template expansion data.
//
Expand Down

0 comments on commit 0b4ce2a

Please sign in to comment.