-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command to update your generator
- Loading branch information
Showing
2 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict'; | ||
var generators = require('yeoman-generator'); | ||
|
||
module.exports = generators.Base.extend({ | ||
constructor: function () { | ||
generators.Base.apply(this, arguments); | ||
|
||
this.option('skip-install', { | ||
desc: 'Skip installing dependencies', | ||
type: Boolean | ||
}); | ||
}, | ||
|
||
prompting: function () { | ||
var prompts = [{ | ||
name: 'babel', | ||
type: 'confirm', | ||
message: 'Compile your JS with Babel', | ||
when: this.options.babel === undefined | ||
}, { | ||
name: 'uploading', | ||
type: 'list', | ||
message: 'How do you want to upload your site?', | ||
choices: ['Amazon S3', 'Rsync', 'Github Pages', 'None'], | ||
store: true | ||
}]; | ||
|
||
return this.prompt(prompts).then(function (props) { | ||
// To access props later use this.props.someAnswer; | ||
this.props = props; | ||
}.bind(this)); | ||
}, | ||
|
||
default: function () { | ||
this.composeWith('jekyllized:gulp', { | ||
options: { | ||
uploading: this.props.uploading, | ||
babel: this.props.babel | ||
} | ||
}, { | ||
local: require.resolve('generator-statisk/generators/gulp') | ||
}); | ||
}, | ||
|
||
install: function () { | ||
this.installDependencies({ | ||
bower: false, | ||
skipInstall: this.options['skip-install'] | ||
}); | ||
this.spawnCommand('bundle', ['install', '--quiet']); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters