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
2 changes: 1 addition & 1 deletion app/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"gulp/.eslintrc",
"gulp/e2e-tests.js",
"gulp/tsd.js",
"gulp/unit-tests.js",

"src/favicon.ico",
"src/assets/images/yeoman.png"
Expand All @@ -38,6 +37,7 @@
"gulp/styles.js",
"gulp/watch.js",
"gulp/server.js",
"gulp/unit-tests.js",

"src/app/index.module.js",
"src/app/index.config.js",
Expand Down
2 changes: 1 addition & 1 deletion app/src/preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ module.exports = function(GulpAngularGenerator) {
}

if(this.props.jsPreprocessor.key !== 'none') {
rejectWithRegexp.call(this, /spec\.js/);
rejectWithRegexp.call(this, /^(?!^e2e\/).*spec\.js/);
}
};

Expand Down
3 changes: 3 additions & 0 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"gulp-uglify": "~1.2.0",
"gulp-useref": "~1.2.0",
"gulp-util": "~3.0.5",
<% if (props.jsPreprocessor.srcExtension !== 'es6' && props.jsPreprocessor.key !== 'typescript') { -%>
"gulp-ng-annotate": "~1.0.0",
<% } -%>
"gulp-replace": "~0.5.3",
"gulp-rename": "~1.2.2",
"gulp-rev": "~5.0.0",
Expand All @@ -46,6 +48,7 @@
"gulp-coffeelint": "~0.5.0",
<% } if (props.jsPreprocessor.srcExtension === 'es6' || props.jsPreprocessor.key === 'typescript') { -%>
"webpack-stream": "~2.0.0",
"ng-annotate-loader": "0.0.6",
<% } if (props.jsPreprocessor.srcExtension === 'es6') { -%>
"eslint-loader": "~1.0.0",
<% } if (props.jsPreprocessor.key === 'babel') { -%>
Expand Down
2 changes: 2 additions & 0 deletions app/templates/gulp/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ gulp.task('html', ['inject', 'partials'], function () {
.pipe($.rev())
.pipe(jsFilter)
.pipe($.sourcemaps.init())
<% if (props.jsPreprocessor.srcExtension !== 'es6' && props.jsPreprocessor.key !== 'typescript') { -%>
.pipe($.ngAnnotate())
<% } -%>
.pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify'))
.pipe($.sourcemaps.write('maps'))
.pipe(jsFilter.restore)
Expand Down
31 changes: 22 additions & 9 deletions app/templates/gulp/_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ gulp.task('scripts', function () {
.pipe($.size())
});
<% } else { -%>
function webpackWrapper(watch, callback) {
function webpackWrapper(watch, test, callback) {
var webpackOptions = {
<% if (props.jsPreprocessor.key === 'typescript') { -%>
resolve: { extensions: ['', '.ts'] },
Expand All @@ -44,11 +44,11 @@ function webpackWrapper(watch, callback) {
preLoaders: [{ test: /\.ts$/, exclude: /node_modules/, loader: 'tslint-loader'}],
<% } -%>
<% if (props.jsPreprocessor.key === 'babel') { -%>
loaders: [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}]
loaders: [{ test: /\.js$/, exclude: /node_modules/, loaders: ['ng-annotate', 'babel-loader']}]
<% } if (props.jsPreprocessor.key === 'traceur') { -%>
loaders: [{ test: /\.js$/, exclude: /node_modules/, loader: 'traceur-loader'}]
loaders: [{ test: /\.js$/, exclude: /node_modules/, loaders: ['ng-annotate', 'traceur-loader']}]
<% } if (props.jsPreprocessor.key === 'typescript') { -%>
loaders: [{ test: /\.ts$/, exclude: /node_modules/, loader: 'awesome-typescript-loader'}]
loaders: [{ test: /\.ts$/, exclude: /node_modules/, loaders: ['ng-annotate', 'awesome-typescript-loader']}]
<% } -%>
},
output: { filename: 'index.module.js' }
Expand All @@ -75,20 +75,33 @@ function webpackWrapper(watch, callback) {
}
};

return gulp.src(path.join(conf.paths.src, '/app/index.module.<%- props.jsPreprocessor.extension %>'))
var sources = [ path.join(conf.paths.src, '/app/index.module.<%- props.jsPreprocessor.extension %>') ];
if (test) {
sources.push(path.join(conf.paths.src, '/app/**/*.spec.<%- props.jsPreprocessor.extension %>'));
}

return gulp.src(sources)
.pipe(webpack(webpackOptions, null, webpackChangeHandler))
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app')));
}

<% if (props.jsPreprocessor.key === 'typescript') { -%>
gulp.task('scripts', ['tsd:install'], function () {
<% } else { %>
<% } else { -%>
gulp.task('scripts', function () {
<% } %>
return webpackWrapper(false);
<% } -%>
return webpackWrapper(false, false);
});

gulp.task('scripts:watch', ['scripts'], function (callback) {
return webpackWrapper(true, callback);
return webpackWrapper(true, false, callback);
});

gulp.task('scripts:test', function () {
return webpackWrapper(false, true);
});

gulp.task('scripts:test-watch', ['scripts'], function (callback) {
return webpackWrapper(true, true, callback);
});
<% } -%>
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ function runTests (singleRun, done) {
});
}

<% if (props.jsPreprocessor.srcExtension !== 'es6' && props.jsPreprocessor.key !== 'typescript') { -%>
gulp.task('test', ['scripts'], function(done) {
runTests(true, done);
});

gulp.task('test:auto', ['watch'], function(done) {
runTests(false, done);
});
<% } else { -%>
gulp.task('test', ['scripts:test'], function(done) {
runTests(true, done);
});

gulp.task('test:auto', ['scripts:test-watch'], function(done) {
runTests(false, done);
});
<% } -%>
4 changes: 4 additions & 0 deletions app/templates/src/_index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<!doctype html>
<% if (props.jsPreprocessor.srcExtension !== 'es6' && props.jsPreprocessor.key !== 'typescript') { -%>
<html<% if (includeModernizr) { %> class="no-js"<% } %> ng-app="<%- appName %>">
<% } else { -%>
<html<% if (includeModernizr) { %> class="no-js"<% } %> ng-app="<%- appName %>" ng-strict-di>
<% } -%>
<head>
<meta charset="utf-8">
<title><%- appName %></title>
Expand Down
3 changes: 2 additions & 1 deletion app/templates/src/app/_index.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export /** @ngInject */ function config($logProvider: ng.ILogProvider, toastrConfig) {
/** @ngInject */
export function config($logProvider: ng.ILogProvider, toastrConfig) {
// enable log
$logProvider.debugEnabled(true);
// set options third-party lib
Expand Down
2 changes: 1 addition & 1 deletion app/templates/src/app/main/_main.controller.spec.es6
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
describe('controllers', function(){

beforeEach(module('<%- appName %>'));
beforeEach(angular.mock.module('<%- appName %>'));

it('should define more than 5 awesome things', inject(function($controller) {
var vm = $controller('MainController');
Expand Down
2 changes: 1 addition & 1 deletion app/templates/src/app/main/_main.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
describe('controllers', function(){

beforeEach(module('<%- appName %>'));
beforeEach(angular.mock.module('<%- appName %>'));

it('should define more than 5 awesome things', inject(function($controller) {
var vm = $controller('MainController');
Expand Down
Loading