Skip to content

Commit 75e8a93

Browse files
authored
Merge pull request #2387 from angular-fullstack/ng2
feat(app): convert to Angular 2 merging to release 5.0.0 alpha
2 parents 8e7b56c + 6c3b307 commit 75e8a93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1168
-1202
lines changed

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"babel-plugin-transform-flow-strip-types": "^6.18.0",
4444
"bluebird": "^3.4.5",
4545
"chalk": "^1.1.0",
46-
"generator-ng-component": "~1.0.5",
4746
"glob": "^7.0.5",
4847
"gulp-babel": "^6.1.2",
4948
"gulp-beautify": "^2.0.0",
@@ -58,6 +57,8 @@
5857
"yeoman-welcome": "^1.0.1"
5958
},
6059
"devDependencies": {
60+
"babel-plugin-syntax-decorators": "^6.13.0",
61+
"babel-plugin-syntax-export-extensions": "^6.13.0",
6162
"babel-plugin-transform-class-properties": "^6.19.0",
6263
"babel-preset-es2015": "^6.18.0",
6364
"chai": "^3.5.0",

Diff for: src/generators/app/index.js

+6-34
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import path from 'path';
55
import Promise from 'bluebird';
66
import { runCmd } from '../util';
77
import chalk from 'chalk';
8-
import {Base} from 'yeoman-generator';
9-
import {genBase} from '../generator-base';
8+
import { Base } from 'yeoman-generator';
9+
import { genBase } from '../generator-base';
1010
import insight from '../insight-init';
11-
import {exec} from 'child_process';
11+
import { exec } from 'child_process';
1212
import babelStream from 'gulp-babel';
1313
import beaufityStream from 'gulp-beautify';
1414
import tap from 'gulp-tap';
@@ -479,7 +479,9 @@ export class Generator extends Base {
479479

480480
let babelPlugins = [
481481
'babel-plugin-syntax-flow',
482-
'babel-plugin-syntax-class-properties'
482+
'babel-plugin-syntax-class-properties',
483+
'babel-plugin-syntax-decorators',
484+
'babel-plugin-syntax-export-extensions',
483485
];
484486

485487
if(this.filters.babel && !flow) {
@@ -505,27 +507,6 @@ export class Generator extends Base {
505507
},
506508
babelrc: false // don't grab the generator's `.babelrc`
507509
}),
508-
beaufityStream({
509-
"indent_size": 2,
510-
"indent_char": " ",
511-
"indent_level": 0,
512-
"indent_with_tabs": false,
513-
"preserve_newlines": true,
514-
"max_preserve_newlines": 10,
515-
"jslint_happy": false,
516-
"space_after_anon_function": false,
517-
"brace_style": "collapse",
518-
"keep_array_indentation": false,
519-
"keep_function_indentation": false,
520-
"space_before_conditional": true,
521-
"break_chained_methods": true,
522-
"eval_code": false,
523-
"unescape_strings": false,
524-
"wrap_line_length": 100,
525-
"wrap_attributes": "auto",
526-
"wrap_attributes_indent_size": 4,
527-
"end_with_newline": true
528-
}),
529510
eslint({
530511
fix: true,
531512
configFile: path.join(genDir, 'templates/app/client/.eslintrc(babel)')
@@ -538,14 +519,6 @@ export class Generator extends Base {
538519
*/
539520
if(this.filters.ts) {
540521
const modulesToFix = [
541-
['angular', 'angular'],
542-
['ngCookies', 'angular-cookies'],
543-
['ngResource', 'angular-resource'],
544-
['ngSanitize', 'angular-sanitize'],
545-
['uiRouter', 'angular-ui-router'],
546-
['ngRoute', 'angular-route'],
547-
['uiBootstrap', 'angular-ui-bootstrap'],
548-
['ngMessages', 'angular-messages'],
549522
['io', 'socket.io-client']
550523
];
551524
function replacer(contents) {
@@ -580,7 +553,6 @@ export class Generator extends Base {
580553
serverJsFilter.restore
581554
]);
582555

583-
let self = this;
584556
this.sourceRoot(path.join(__dirname, '../../templates/app'));
585557
this.processDirectory('.', '.');
586558
},

Diff for: templates/app/.eslintrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
"brace-style": 2, //enforce one true brace style
141141
"camelcase": 1, //require camel case names
142142
"comma-spacing": [2, {"before": false, "after": true}], //enforce spacing before and after comma
143-
"comma-style": 2, //enforce one true comma style
143+
"comma-style": ["error", "last"], //enforce one true comma style
144144
"computed-property-spacing": 2, //require or disallow padding inside computed properties
145145
"consistent-this": 2, //enforce consistent naming when capturing the current execution context
146146
"eol-last": 2, //enforce newline at the end of file, with no multiple empty lines
@@ -170,7 +170,7 @@
170170
"max-nested-callbacks": 2, //specify the maximum depth callbacks can be nested
171171
"max-params": 0, //limits the number of parameters that can be used in the function declaration.
172172
"max-statements": 0, //specify the maximum number of statement allowed in a function
173-
"max-statements-per-line": 0, //enforce a maximum number of statements allowed per line
173+
"max-statements-per-line": ["error", { "max": 1 }], //enforce a maximum number of statements allowed per line
174174
"new-cap": 0, //require a capital letter for constructors
175175
"new-parens": 2, //disallow the omission of parentheses when invoking a constructor with no arguments
176176
"newline-after-var": 0, //require or disallow an empty newline after variable declarations

Diff for: templates/app/_.babelrc

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
{
2-
"presets": ["es2015"],
2+
"presets": [
3+
"es2015",
4+
"es2016",
5+
"es2017",
6+
"stage-0"
7+
],
38
"plugins": [
49
<%_ if(filters.flow) { -%>
510
"transform-flow-comments",
611
<%_ } -%>
7-
"transform-class-properties"
12+
"angular2-annotations",
13+
"transform-runtime",
14+
"transform-decorators-legacy"
815
]
916
}

Diff for: templates/app/_package.json

+57-29
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,8 @@
33
"version": "0.0.0",
44
"main": "server/index.js",
55
"dependencies": {
6-
<%# CLIENT %>
7-
"angular": "~1.5.5",<% if(filters.bootstrap) { if(filters.sass) { %>
8-
"bootstrap-sass": "~3.3.7",<% } %>
9-
"bootstrap": "~3.3.7",<% if(filters.oauth) { %>
10-
"bootstrap-social": "^5.0.0",<% }} %>
11-
"angular-animate": "~1.5.5",
12-
"angular-aria": "~1.5.5",
13-
"angular-resource": "~1.5.5",
14-
"angular-cookies": "~1.5.5",
15-
"angular-sanitize": "~1.5.5",<% if(filters.ngroute) { %>
16-
"angular-route": "~1.5.5",<% } if(filters.uibootstrap) { %>
17-
"angular-ui-bootstrap": "^2.0.1",<% } %>
18-
"font-awesome": ">=4.1.0",<% if(filters.socketio) { %>
19-
"angular-socket-io": "~0.7.0",<% } if(filters.uirouter) { %>
20-
"angular-ui-router": "~0.3.1",<% } if(filters.auth) { %>
21-
"angular-validation-match": "^1.9.0",<% } %>
22-
<%# END CLIENT %>
23-
"core-js": "^2.2.1",
6+
"core-js": "^2.4.1",
7+
"cors": "^2.8.1",
248
"express": "^4.13.3",
259
"morgan": "~1.7.0",
2610
"body-parser": "^1.13.3",
@@ -31,10 +15,18 @@
3115
"composable-middleware": "^0.3.0",
3216
"fast-json-patch": "^1.0.0",
3317
"lodash": "^4.6.1",
34-
"lusca": "^1.3.0",
35-
"babel-runtime": "^6.6.1",
36-
"babel-polyfill": "^6.7.2",<% if(filters.pug) { %>
37-
"pug": "2.0.0-beta4",<% } %><% if(filters.html) { %>
18+
"lusca": "^1.4.1",
19+
"babel-core": "^6.18.2",
20+
"babel-plugin-angular2-annotations": "^5.1.0",
21+
"babel-plugin-transform-decorators-legacy": "^1.3.4",
22+
"babel-plugin-transform-runtime": "^6.6.0",
23+
"babel-polyfill": "^6.16.0",
24+
"babel-preset-es2015": "^6.18.0",
25+
"babel-preset-es2016": "^6.16.0",
26+
"babel-preset-es2017": "^6.16.0",
27+
"babel-preset-stage-0": "^6.16.0",
28+
"babel-runtime": "^6.18.0",<% if(filters.pug) { %>
29+
"pug": "2.0.0-beta6",<% } %><% if(filters.html) { %>
3830
"ejs": "^2.5.3",<% } %><% if(filters.mongoose) { %>
3931
"mongoose": "^4.1.2",
4032
"bluebird": "^3.3.3",
@@ -53,20 +45,56 @@
5345
"socket.io-client": "^1.3.5",
5446
"socketio-jwt": "^4.2.0",<% } %>
5547
"serve-favicon": "^2.3.0",
56-
"shrink-ray": "^0.1.3",
57-
"sprint-js": "~0.1.0"
48+
"shrink-ray": "^0.1.3"
5849
},
5950
"devDependencies": {
6051
<%# CLIENT %>
61-
"angular-mocks": "~1.5.5",<% if(filters.stylus) { %>
62-
<%_ if(filters.bootstrap) { -%>
63-
"bootstrap-styl": "^5.0.5",<% } %>
52+
"@angularclass/match-control": "^2.0.0",
53+
"reflect-metadata": "^0.1.3",
54+
"rxjs": "5.0.0-beta.12",
55+
"zone.js": "^0.6.25",
56+
"@angular/common": "^2.0.1",
57+
"@angular/compiler": "^2.0.1",
58+
"@angular/core": "^2.0.1",
59+
"@angular/forms": "^2.0.1",
60+
"@angular/http": "^2.0.1",
61+
<%#"@angular/material": "^2.0.0-alpha.10",%>
62+
"@angular/platform-browser": "^2.0.1",
63+
"@angular/platform-browser-dynamic": "^2.0.1",
64+
<% if(filters.ngroute) { %>
65+
"@angular/router": "^2.0.1",<% } %>
66+
"@angular/upgrade": "^2.0.1",
67+
"@angularclass/hmr": "^1.2.1",
68+
"angular2-universal": "2.1.0-rc.1",
69+
"angular2-jwt": "^0.1.24",
70+
<% if(filters.auth) { %>
71+
"angular-validation-match": "^1.9.0",<% } %>
72+
<% if(filters.uirouter) { %>
73+
"ui-router-ng2": "^1.0.0-beta.3",<% } %>
74+
75+
<% if(filters.bootstrap) { %>
76+
"bootstrap": "~3.3.7",
77+
<% if(filters.uibootstrap) { %>
78+
"ng2-bootstrap": "~1.1.16",<% } %>
79+
<% if(filters.sass) { %>
80+
"bootstrap-sass": "~3.3.7",<% } %>
81+
<% if(filters.stylus) { %>
82+
"bootstrap-styl": "^5.0.8",<% } %>
83+
<% if(filters.oauth) { %>
84+
"bootstrap-social": "^5.1.1",<% } %>
85+
<% } %>
86+
87+
"font-awesome": ">=4.1.0",
88+
<% if(filters.stylus) { %>
6489
"font-awesome-stylus": "^4.6.2",<% } %>
90+
<%# CLIENT DEV %>
91+
6592
<%# END CLIENT %>
93+
6694
"autoprefixer": "^6.0.0",
6795
"babel-core": "^6.6.5",
6896
"babel-eslint": "^6.0.4",
69-
"babel-register": "^6.6.5",
97+
"babel-register": "^6.16.0",
7098
"browser-sync": "^2.8.0",
7199
"bs-fullscreen-message": "^1.0.0",
72100
<%_ if(filters.flow) { -%>
@@ -92,7 +120,7 @@
92120
"gulp-istanbul-enforcer": "^1.0.3",
93121
"gulp-load-plugins": "^1.0.0-rc.1",
94122
"gulp-mocha": "^2.1.3",
95-
"gulp-node-inspector": "^0.1.0",
123+
<%# "gulp-node-inspector": "^0.1.0", %>
96124
"gulp-plumber": "^1.0.1",
97125
"gulp-protractor": "^3.0.0",
98126
"gulp-rev": "^7.0.0",

Diff for: templates/app/client/__index.html

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
ga('send', 'pageview');
2626
</script>
2727

28+
<app>LOADING</app>
2829
<navbar></navbar>
2930
<% if (filters.ngroute) { %><div ng-view=""></div><% } %><% if (filters.uirouter) { %><div ui-view=""></div><% } %>
3031
<footer></footer>
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { NgModule } from '@angular/core';
2+
import { FormsModule } from '@angular/forms';
3+
<%_ if (filters.uirouter) { -%>
4+
import { UIRouterModule } from 'ui-router-ng2';<% } %>
5+
<%_ if (filters.ngroute) { -%><% } %>
6+
<%_ if(filters.oauth) { -%>
7+
import { DirectivesModule } from '../../components/directives.module';<% } %>
8+
9+
import { STATES } from './account.routes';
10+
11+
import { LoginComponent } from './login/login.component';
12+
import { SignupComponent } from './signup/signup.component';
13+
import { SettingsComponent } from './settings/settings.component';
14+
15+
export let AccountModule = @NgModule({
16+
imports: [
17+
FormsModule,
18+
<%_ if (filters.uirouter) { -%>
19+
UIRouterModule.forChild({
20+
states: STATES,
21+
}),<% } %>
22+
<%_ if (filters.ngroute) { -%><% } %>
23+
DirectivesModule,
24+
],
25+
declarations: [
26+
LoginComponent,
27+
SignupComponent,
28+
SettingsComponent,
29+
],
30+
})
31+
class AccountModule {}

0 commit comments

Comments
 (0)