Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
var yeoman = require('yeoman-generator');
var yosay = require('yosay');
var chalk = require('chalk');
var Insight = require('insight');

var pkg = require('../package.json');

var GulpAngularGenerator = yeoman.generators.Base.extend({

Expand All @@ -15,7 +18,12 @@ var GulpAngularGenerator = yeoman.generators.Base.extend({
required: false
});

this.version = require('../package.json').version;
this.version = pkg.version;

this.insight = new Insight({
trackingCode: 'UA-66934495-1',
pkg: pkg
});

this.props = {};
},
Expand Down
18 changes: 9 additions & 9 deletions app/prompts.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
},
{
"value": {
"key": "none"
"key": "jqLite"
},
"name": "None (Angular will use its own jqLite)"
}
Expand All @@ -105,7 +105,7 @@
},
{
"value": {
"key": "none",
"key": "$http",
"module": null
},
"name": "None, $http is enough!"
Expand Down Expand Up @@ -140,7 +140,7 @@
},
{
"value": {
"key": "none",
"key": "noRouter",
"module": null
},
"name": "None"
Expand Down Expand Up @@ -182,7 +182,7 @@
},
{
"value": {
"key": "none",
"key": "noUI",
"module": null
},
"name": "None"
Expand Down Expand Up @@ -217,7 +217,7 @@
},
{
"value": {
"key": "none",
"key": "noBootstrapComponents",
"module": null
},
"name": "No JavaScript, just CSS"
Expand Down Expand Up @@ -245,7 +245,7 @@
},
{
"value": {
"key": "none",
"key": "noFoundationComponents",
"module": null
},
"name": "No JavaScript, just CSS"
Expand Down Expand Up @@ -287,7 +287,7 @@
},
{
"value": {
"key": "none",
"key": "noCssPrepro",
"extension": "css"
},
"name": "None, only the good old CSS"
Expand All @@ -301,7 +301,7 @@
"choices": [
{
"value": {
"key": "none",
"key": "noJsPrepro",
"extension": "js",
"srcExtension": "js"
},
Expand Down Expand Up @@ -348,7 +348,7 @@
"choices": [
{
"value": {
"key": "none",
"key": "noHtmlPrepro",
"extension": "html"
},
"name": "None, I like to code in standard HTML."
Expand Down
6 changes: 3 additions & 3 deletions app/src/bower.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function(GulpAngularGenerator) {

}

if (this.props.cssPreprocessor.key === 'none') {
if (this.props.cssPreprocessor.key === 'noCssPrepro') {
bowerOverrides.bootstrap.main.unshift('dist/css/bootstrap.css');
}

Expand Down Expand Up @@ -78,7 +78,7 @@ module.exports = function(GulpAngularGenerator) {
*/
GulpAngularGenerator.prototype.computeWiredepExclusions = function computeWiredepExclusions() {
this.wiredepExclusions = [];
if (this.props.jQuery.key === 'none' || this.props.jQuery.key === 'zepto') {
if (this.props.jQuery.key === 'jqLite' || this.props.jQuery.key === 'zepto') {
this.wiredepExclusions.push('/jquery/');
}
if (this.props.ui.key === 'bootstrap') {
Expand All @@ -88,7 +88,7 @@ module.exports = function(GulpAngularGenerator) {
this.wiredepExclusions.push('/bootstrap-sass\\/.*\\.js/');
}
}
if(this.props.cssPreprocessor.key !== 'none') {
if(this.props.cssPreprocessor.key !== 'noCssPrepro') {
this.wiredepExclusions.push('/bootstrap\\.css/');
}
} else if (this.props.ui.key === 'foundation') {
Expand Down
6 changes: 3 additions & 3 deletions app/src/mock-prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ module.exports = {
router: model.router.values['ui-router'],
ui: model.ui.values.bootstrap,
bootstrapComponents: model.bootstrapComponents.values['ui-bootstrap'],
foundationComponents: model.foundationComponents.values.none,
foundationComponents: model.foundationComponents.values.noFoundationComponents,
cssPreprocessor: model.cssPreprocessor.values['node-sass'],
jsPreprocessor: model.jsPreprocessor.values.none,
htmlPreprocessor: model.htmlPreprocessor.values.none
jsPreprocessor: model.jsPreprocessor.values.noJsPrepro,
htmlPreprocessor: model.htmlPreprocessor.values.noHtmlPrepro
}
};
8 changes: 4 additions & 4 deletions app/src/preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function(GulpAngularGenerator) {
this.watchTaskDeps.push('\'scripts:watch\'');
}

if (this.props.htmlPreprocessor.key !== 'none') {
if (this.props.htmlPreprocessor.key !== 'noHtmlPrepro') {
this.watchTaskDeps.push('\'markups\'');
}

Expand All @@ -55,7 +55,7 @@ module.exports = function(GulpAngularGenerator) {
* depending on options. This step reject these files.
*/
GulpAngularGenerator.prototype.rejectFiles = function rejectFiles() {
if(this.props.cssPreprocessor.key === 'none') {
if(this.props.cssPreprocessor.key === 'noCssPrepro') {
rejectWithRegexp.call(this, /styles\.js/);
}

Expand All @@ -69,11 +69,11 @@ module.exports = function(GulpAngularGenerator) {
rejectWithRegexp.call(this, /index\.constants\.js/);
}

if(this.props.htmlPreprocessor.key === 'none') {
if(this.props.htmlPreprocessor.key === 'noHtmlPrepro') {
rejectWithRegexp.call(this, /markups\.js/);
}

if(this.props.jsPreprocessor.key !== 'none') {
if(this.props.jsPreprocessor.key !== 'noJsPrepro') {
rejectWithRegexp.call(this, /^(?!^e2e\/).*spec\.js/);
}
};
Expand Down
27 changes: 27 additions & 0 deletions app/src/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ function logChoice(prompt, prop) {

module.exports = function(GulpAngularGenerator) {

/**
* Check Insight config
*/
GulpAngularGenerator.prototype.checkInsight = function checkInsight() {

if (this.insight.optOut === undefined) {
var done = this.async();

this.insight.track('downloaded');

this.insight.askPermission(null, done);
}
};

/**
* Check if the default option is set, if it is, use defaults props and log them
*/
Expand Down Expand Up @@ -137,4 +151,17 @@ module.exports = function(GulpAngularGenerator) {
}.bind(this));
};

/**
* Send anonymously report usage statistics by Insight
*/
GulpAngularGenerator.prototype.sendInsight = function sendInsight() {
var keyValues = [];
_.forEach(this.props, function(aProp) {
if (aProp.key) {
keyValues.push(aProp.key);
}
});
this.insight.track.apply(this.insight, keyValues);
};

};
2 changes: 1 addition & 1 deletion app/src/techs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function(GulpAngularGenerator) {
])
.filter(_.isString)
.filter(function(tech) {
return tech !== 'default' && tech !== 'css' && tech !== 'official' && tech !== 'none';
return listTechs[tech] !== undefined;
});

var techsContent = _.map(usedTechs, function(value) {
Expand Down
10 changes: 5 additions & 5 deletions app/templates/_karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function listFiles() {

return wiredep(wiredepOptions).js
.concat([
<% if (props.jsPreprocessor.key === 'none') { -%>
<% if (props.jsPreprocessor.key === 'noJsPrepro') { -%>
path.join(conf.paths.src, '/app/**/*.module.js'),
path.join(conf.paths.src, '/app/**/*.js'),
path.join(conf.paths.src, '/**/*.spec.js'),
Expand Down Expand Up @@ -53,11 +53,11 @@ module.exports = function(config) {

logLevel: 'WARN',

<% if (props.jsPreprocessor.key === 'none' || props.jsPreprocessor.key === 'coffee') { -%>
<% if (props.jsPreprocessor.key === 'noJsPrepro' || props.jsPreprocessor.key === 'coffee') { -%>
frameworks: ['jasmine', 'angular-filesort'],

angularFilesort: {
<% if (props.jsPreprocessor.key === 'none') { -%>
<% if (props.jsPreprocessor.key === 'noJsPrepro') { -%>
whitelist: [path.join(conf.paths.src, '/**/!(*.html|*.spec|*.mock).js')]
<% } else { -%>
whitelist: [path.join(conf.paths.tmp, '/**/!(*.html|*.spec|*.mock).js')]
Expand All @@ -68,7 +68,7 @@ module.exports = function(config) {

preprocessors: {
'src/**/*.html': ['ng-html2js'],
<% if (props.jsPreprocessor.key === 'none') { -%>
<% if (props.jsPreprocessor.key === 'noJsPrepro') { -%>
'src/**/!(*.spec).js': ['coverage']
<% } else { -%>
'.tmp/**/!(*.spec).js': ['coverage']
Expand Down Expand Up @@ -96,7 +96,7 @@ module.exports = function(config) {

plugins : [
'karma-phantomjs-launcher',
<% } if (props.jsPreprocessor.key === 'none' || props.jsPreprocessor.key === 'coffee') { -%>
<% } if (props.jsPreprocessor.key === 'noJsPrepro' || props.jsPreprocessor.key === 'coffee') { -%>
'karma-angular-filesort',
'karma-coverage',
<% } -%>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"tsd": "~0.6.1",
<% } else if (props.jsPreprocessor.srcExtension !== 'es6') { -%>
"gulp-angular-filesort": "~1.1.1",
<% } if (props.htmlPreprocessor.key !== 'none') { -%>
<% } if (props.htmlPreprocessor.key !== 'noHtmlPrepro') { -%>
"gulp-consolidate": "~0.1.2",
<% } if (props.htmlPreprocessor.key === 'jade') { -%>
"jade": "~1.11.0",
Expand Down
2 changes: 1 addition & 1 deletion app/templates/gulp/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
});

<% if (props.htmlPreprocessor.key === 'none') { -%>
<% if (props.htmlPreprocessor.key === 'noHtmlPrepro') { -%>
gulp.task('partials', function () {
<% } else { -%>
gulp.task('partials', ['markups'], function () {
Expand Down
2 changes: 1 addition & 1 deletion app/templates/gulp/_inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var $ = require('gulp-load-plugins')();
var wiredep = require('wiredep').stream;
var _ = require('lodash');

<% if (props.cssPreprocessor.key !== 'none') { -%>
<% if (props.cssPreprocessor.key !== 'noCssPrepro') { -%>
gulp.task('inject', ['scripts', 'styles'], function () {
var injectStyles = gulp.src([
path.join(conf.paths.tmp, '/serve/app/**/*.css'),
Expand Down
4 changes: 2 additions & 2 deletions app/templates/gulp/_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ gulp.task('scripts', function () {
<% if (props.jsPreprocessor.extension === 'js') { -%>
.pipe($.eslint())
.pipe($.eslint.format())
<% } if (props.jsPreprocessor.key !== 'none') { -%>
<% } if (props.jsPreprocessor.key !== 'noJsPrepro') { -%>
.pipe($.sourcemaps.init())
<% } if (props.jsPreprocessor.key === 'coffee') { -%>
.pipe($.coffeelint())
.pipe($.coffeelint.reporter())
.pipe($.coffee()).on('error', conf.errorHandler('CoffeeScript'))
<% } if (props.jsPreprocessor.key !== 'none') { -%>
<% } if (props.jsPreprocessor.key !== 'noJsPrepro') { -%>
.pipe($.sourcemaps.write())
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app')))
<% } -%>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/gulp/_watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ gulp.task('watch', [<%- watchTaskDeps.join(', ') %>], function () {
], function(event) {
<% } -%>
if(isOnlyChange(event)) {
<% if (props.cssPreprocessor.key === 'none') { -%>
<% if (props.cssPreprocessor.key === 'noCssPrepro') { -%>
browserSync.reload(event.path);
<% } else { -%>
gulp.start('styles');
Expand All @@ -50,7 +50,7 @@ gulp.task('watch', [<%- watchTaskDeps.join(', ') %>], function () {
});
<% } -%>

<% if (props.htmlPreprocessor.key !== 'none') { -%>
<% if (props.htmlPreprocessor.key !== 'noHtmlPrepro') { -%>
gulp.watch(path.join(conf.paths.src, '/app/**/*.<%- props.htmlPreprocessor.extension %>'), ['markups']);

<% } -%>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/src/app/_index.module.es6
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import config from './index.config';
<% if (props.router.key === 'new-router') { -%>
import { routerConfig, RouterController } from './index.route';
<% } else if (props.router.key !== 'none') { -%>
<% } else if (props.router.key !== 'noRouter') { -%>
import routerConfig from './index.route';
<% } -%>
import runBlock from './index.run';
Expand All @@ -17,7 +17,7 @@ angular.module('<%- appName %>', [<%- modulesDependencies %>])
.constant('malarkey', malarkey)
.constant('moment', moment)
.config(config)
<% if (props.router.key !== 'none') { -%>
<% if (props.router.key !== 'noRouter') { -%>
.config(routerConfig)
<% } -%>
.run(runBlock)
Expand Down
4 changes: 2 additions & 2 deletions app/templates/src/app/_index.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { config } from './index.config';
<% if (props.router.key === 'new-router') { -%>
import { routerConfig, RouterController } from './index.route';
<% } else if (props.router.key !== 'none') { -%>
<% } else if (props.router.key !== 'noRouter') { -%>
import { routerConfig } from './index.route';
<% } -%>
import { runBlock } from './index.run';
Expand All @@ -23,7 +23,7 @@ module <%- appName %> {
.constant('malarkey', malarkey)
.constant('moment', moment)
.config(config)
<% if (props.router.key !== 'none') { -%>
<% if (props.router.key !== 'noRouter') { -%>
.config(routerConfig)
<% } -%>
.run(runBlock)
Expand Down
Loading