Commit e08bcc3f authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] basic tasks + differenicate between projecct types

parent e600b86f
'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
var yeoman = require('yeoman-generator'),
chalk = require('chalk'),
yosay = require('yosay'),
path = require('path');
module.exports = yeoman.generators.Base.extend({
initializing: function () {
......@@ -13,18 +14,40 @@ module.exports = yeoman.generators.Base.extend({
// Have Yeoman greet the user.
this.log(yosay(
'Welcome to the dandy' + chalk.red('Sgalinski') + ' generator!'
'Welcome to the dandy ' + chalk.red('Sgalinski') + ' generator!'
));
var prompts = [{
type: 'confirm',
name: 'someOption',
message: 'Would you like to enable this option?',
default: true
}];
var prompts = [
{
type: 'list',
name: 'projectType',
message: 'What kind of project do you want me to build?',
choices: [
{
value: 'extbaseExtension',
name: 'Typo3 Extbase Extension'
},
{
value: 'standalone',
name: 'Standalone Frontend Project'
},
{
value: 'typo3Frontend',
name: 'Typo3 Frontend Setup'
}
]
},
{
type: 'input',
name: 'projectName',
message: 'Please enter the name for your project',
default: process.cwd().split(path.sep).pop()
}
];
this.prompt(prompts, function (props) {
this.someOption = props.someOption;
this.projectType = props.projectType;
this.projectName = props.projectName;
done();
}.bind(this));
......@@ -32,9 +55,10 @@ module.exports = yeoman.generators.Base.extend({
writing: {
app: function () {
this.fs.copy(
this.fs.copyTpl(
this.templatePath('_package.json'),
this.destinationPath('package.json')
this.destinationPath('package.json'),
{projectName: this.projectName}
);
this.fs.copy(
this.templatePath('_bower.json'),
......@@ -51,6 +75,16 @@ module.exports = yeoman.generators.Base.extend({
this.templatePath('jshintrc'),
this.destinationPath('.jshintrc')
);
if (this.projectType === 'standalone') {
this.fs.copyTpl(
this.templatePath('_gulpfile.js'),
this.destinationPath('gulpfile.js'),
{projectType: this.projectType}
);
this.mkdir('Sass');
this.mkdir('Images');
this.mkdir('Scripts');
}
}
},
......
......@@ -9,13 +9,13 @@ var gulp = require('gulp'),
browserSync = require('browser-sync'),
imagemin = require('gulp-imagemin'),
jshint = require('gulp-jshint'),
argv = require('yargs').argv,
argv = require('yargs').argv,<% if (projectType == 'typo3Frontend') { %>
extension = (function() {
if (typeof argv.ext === 'undefined') {
throw new Error('You have to specify the extension you want to work on with the --ext option.');
}
return argv.ext;
}()),
}()),<% } %>
extensionPath = path.join('typo3conf', 'ext', extension),
sassPath = path.join(extensionPath, 'Resources', 'Public', 'Sass'),
cssPath = path.join(extensionPath, 'Resources', 'Public', 'StyleSheets'),
......@@ -52,7 +52,5 @@ gulp.task('images', function() {
});
gulp.task('browser-sync', function() {
browserSync.init(null, {
proxy: '<%= browserSyncProxy %>'
});
browserSync.init();
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment