Skip to content

Commit 6f15975

Browse files
committed
Merge branch 'master' into angular-new-router
Conflicts: app/templates/src/app/_index.module.ts package.json
2 parents 30e52b6 + c0b7424 commit 6f15975

33 files changed

+5677
-4847
lines changed

app/files.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
".bowerrc",
44
".editorconfig",
55

6+
"tsconfig.json",
67
"protractor.conf.js",
78

8-
"e2e/.jshintrc",
9+
"e2e/.eslintrc",
910
"e2e/main.spec.js",
1011

1112
"gulpfile.js",
12-
"gulp/.jshintrc",
13+
"gulp/.eslintrc",
1314
"gulp/e2e-tests.js",
1415
"gulp/tsd.js",
1516
"gulp/unit-tests.js",
@@ -19,7 +20,7 @@
1920
],
2021
"templates": [
2122
".gitignore",
22-
".jshintrc",
23+
".eslintrc",
2324

2425
"package.json",
2526
"bower.json",

app/src/preprocessors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ module.exports = function(GulpAngularGenerator) {
6262
if(this.props.jsPreprocessor.key !== 'typescript') {
6363
rejectWithRegexp.call(this, /tsd\.js/);
6464
rejectWithRegexp.call(this, /tsd\.json/);
65+
rejectWithRegexp.call(this, /tsconfig\.json/);
6566
}
6667

6768
if(this.props.jsPreprocessor.srcExtension === 'es6' || this.props.jsPreprocessor.key === 'typescript') {

app/templates/_.eslintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"plugins": ["angular"],
4+
"env": {
5+
<% if (props.jsPreprocessor.srcExtension === 'es6') { -%>
6+
"es6": true,
7+
<% } -%>
8+
"browser": true,
9+
"jasmine": true
10+
},
11+
<% if (props.jsPreprocessor.srcExtension === 'es6') { -%>
12+
"ecmaFeatures": {
13+
"modules": true
14+
},
15+
<% } -%>
16+
"globals": {
17+
"angular": true,
18+
"module": true,
19+
"inject": true
20+
}
21+
}

app/templates/_.jshintrc

Lines changed: 0 additions & 21 deletions
This file was deleted.

app/templates/_karma.conf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ function listFiles() {
2424
path.join(conf.paths.tmp, '/serve/app/**/*.js'),
2525
path.join(conf.paths.tmp, '/**/*.spec.js'),
2626
path.join(conf.paths.tmp, '/**/*.mock.js'),
27+
<% } else if (props.jsPreprocessor.key === 'typescript') { -%>
28+
path.join(conf.paths.tmp, '/serve/app/index.module.js'),
29+
path.join(conf.paths.src, '/**/*.spec.{js,ts}'),
30+
path.join(conf.paths.src, '/**/*.mock.{js,ts}'),
2731
<% } else { -%>
2832
path.join(conf.paths.tmp, '/serve/app/index.module.js'),
2933
path.join(conf.paths.src, '/**/*.spec.js'),

app/templates/_package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
<% if (imageMin) { -%>
1818
"gulp-imagemin": "~2.2.0",
1919
<% } -%>
20-
"gulp-jshint": "~1.11.0",
20+
"gulp-eslint": "~1.0.0",
21+
"eslint-plugin-angular": "~0.7.0",
2122
"gulp-load-plugins": "~0.10.0",
2223
"gulp-size": "~1.2.1",
2324
"gulp-uglify": "~1.2.0",
@@ -43,18 +44,19 @@
4344
<% } if (props.jsPreprocessor.key === 'coffee') { -%>
4445
"gulp-coffee": "~2.3.1",
4546
"gulp-coffeelint": "~0.5.0",
46-
<% } if (props.jsPreprocessor.srcExtension === 'es6') { -%>
47+
<% } if (props.jsPreprocessor.srcExtension === 'es6' || props.jsPreprocessor.key === 'typescript') { -%>
4748
"webpack-stream": "~2.0.0",
48-
"jshint-loader": "~0.8.3",
49+
<% } if (props.jsPreprocessor.srcExtension === 'es6') { -%>
50+
"eslint-loader": "~1.0.0",
4951
<% } if (props.jsPreprocessor.key === 'babel') { -%>
5052
"babel-core": "~5.5.8",
5153
"babel-loader": "~5.1.4",
5254
<% } if (props.jsPreprocessor.key === 'traceur') { -%>
5355
"traceur-loader": "~0.6.3",
5456
<% } if (props.jsPreprocessor.key === 'typescript') { -%>
55-
"gulp-typescript": "~2.7.7",
56-
"gulp-tslint": "~2.0.0",
57-
"gulp-concat": "~2.5.2",
57+
"typescript": "~1.5.3",
58+
"awesome-typescript-loader": "~0.11.2",
59+
"tslint-loader": "~1.0.1",
5860
"tsd": "~0.6.1",
5961
<% } else if (props.jsPreprocessor.srcExtension !== 'es6') { -%>
6062
"gulp-angular-filesort": "~1.1.1",
@@ -69,7 +71,6 @@
6971
<% } -%>
7072
"main-bower-files": "~2.8.0",
7173
"merge-stream": "~0.1.7",
72-
"jshint-stylish": "~2.0.0",
7374
"wiredep": "~2.2.2",
7475
"karma": "~0.12.36",
7576
"karma-jasmine": "~0.3.5",

app/templates/e2e/.jshintrc renamed to app/templates/e2e/.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"extends": "../.jshintrc",
32
"globals": {
43
"browser": false,
54
"element": false,

app/templates/gulp/.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"env": {
3+
"node": true
4+
}
5+
}

app/templates/gulp/.jshintrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

app/templates/gulp/_scripts.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,24 @@ var gulp = require('gulp');
55
var conf = require('./conf');
66

77
var browserSync = require('browser-sync');
8-
<% if (props.jsPreprocessor.srcExtension === 'es6') { -%>
8+
<% if (props.jsPreprocessor.srcExtension === 'es6' || props.jsPreprocessor.key === 'typescript') { -%>
99
var webpack = require('webpack-stream');
1010
<% } -%>
1111

1212
var $ = require('gulp-load-plugins')();
1313

14-
<% if (props.jsPreprocessor.srcExtension !== 'es6') { -%>
15-
<% if (props.jsPreprocessor.key === 'typescript') { -%>
16-
var tsProject = $.typescript.createProject({
17-
target: 'es5',
18-
sortOutput: true
19-
});
20-
21-
gulp.task('scripts', ['tsd:install'], function () {
22-
<% } else { -%>
14+
<% if (props.jsPreprocessor.srcExtension !== 'es6' && props.jsPreprocessor.key !== 'typescript') { -%>
2315
gulp.task('scripts', function () {
24-
<% } -%>
2516
return gulp.src(path.join(conf.paths.src, '/app/**/*.<%- props.jsPreprocessor.extension %>'))
2617
<% if (props.jsPreprocessor.extension === 'js') { -%>
27-
.pipe($.jshint())
28-
.pipe($.jshint.reporter('jshint-stylish'))
18+
.pipe($.eslint())
19+
.pipe($.eslint.format())
2920
<% } if (props.jsPreprocessor.key !== 'none') { -%>
3021
.pipe($.sourcemaps.init())
3122
<% } if (props.jsPreprocessor.key === 'coffee') { -%>
3223
.pipe($.coffeelint())
3324
.pipe($.coffeelint.reporter())
3425
.pipe($.coffee()).on('error', conf.errorHandler('CoffeeScript'))
35-
<% } if (props.jsPreprocessor.key === 'typescript') { -%>
36-
.pipe($.tslint())
37-
.pipe($.tslint.report('prose', { emitError: false }))
38-
.pipe($.typescript(tsProject)).on('error', conf.errorHandler('TypeScript'))
39-
.pipe($.concat('index.module.js'))
4026
<% } if (props.jsPreprocessor.key !== 'none') { -%>
4127
.pipe($.sourcemaps.write())
4228
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app')))
@@ -47,13 +33,22 @@ gulp.task('scripts', function () {
4733
<% } else { -%>
4834
function webpackWrapper(watch, callback) {
4935
var webpackOptions = {
36+
<% if (props.jsPreprocessor.key === 'typescript') { -%>
37+
resolve: { extensions: ['', '.ts'] },
38+
<% } -%>
5039
watch: watch,
5140
module: {
52-
preLoaders: [{ test: /\.js$/, exclude: /node_modules/, loader: 'jshint-loader'}],
41+
<% if (props.jsPreprocessor.extension === 'js') { -%>
42+
preLoaders: [{ test: /\.js$/, exclude: /node_modules/, loader: 'eslint-loader'}],
43+
<% } if (props.jsPreprocessor.key === 'typescript') { -%>
44+
preLoaders: [{ test: /\.ts$/, exclude: /node_modules/, loader: 'tslint-loader'}],
45+
<% } -%>
5346
<% if (props.jsPreprocessor.key === 'babel') { -%>
5447
loaders: [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}]
5548
<% } if (props.jsPreprocessor.key === 'traceur') { -%>
5649
loaders: [{ test: /\.js$/, exclude: /node_modules/, loader: 'traceur-loader'}]
50+
<% } if (props.jsPreprocessor.key === 'typescript') { -%>
51+
loaders: [{ test: /\.ts$/, exclude: /node_modules/, loader: 'awesome-typescript-loader'}]
5752
<% } -%>
5853
},
5954
output: { filename: 'index.module.js' }
@@ -80,12 +75,16 @@ function webpackWrapper(watch, callback) {
8075
}
8176
};
8277

83-
return gulp.src(path.join(conf.paths.src, '/app/index.module.js'))
78+
return gulp.src(path.join(conf.paths.src, '/app/index.module.<%- props.jsPreprocessor.extension %>'))
8479
.pipe(webpack(webpackOptions, null, webpackChangeHandler))
8580
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app')));
8681
}
8782

83+
<% if (props.jsPreprocessor.key === 'typescript') { -%>
84+
gulp.task('scripts', ['tsd:install'], function () {
85+
<% } else { %>
8886
gulp.task('scripts', function () {
87+
<% } %>
8988
return webpackWrapper(false);
9089
});
9190

0 commit comments

Comments
 (0)