Skip to content

Commit

Permalink
Merge pull request #2387 from angular-fullstack/ng2
Browse files Browse the repository at this point in the history
feat(app): convert to Angular 2

merging to release 5.0.0 alpha
Awk34 authored Dec 8, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 8e7b56c + 6c3b307 commit 75e8a93
Showing 58 changed files with 1,168 additions and 1,202 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -43,7 +43,6 @@
"babel-plugin-transform-flow-strip-types": "^6.18.0",
"bluebird": "^3.4.5",
"chalk": "^1.1.0",
"generator-ng-component": "~1.0.5",
"glob": "^7.0.5",
"gulp-babel": "^6.1.2",
"gulp-beautify": "^2.0.0",
@@ -58,6 +57,8 @@
"yeoman-welcome": "^1.0.1"
},
"devDependencies": {
"babel-plugin-syntax-decorators": "^6.13.0",
"babel-plugin-syntax-export-extensions": "^6.13.0",
"babel-plugin-transform-class-properties": "^6.19.0",
"babel-preset-es2015": "^6.18.0",
"chai": "^3.5.0",
40 changes: 6 additions & 34 deletions src/generators/app/index.js
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ import path from 'path';
import Promise from 'bluebird';
import { runCmd } from '../util';
import chalk from 'chalk';
import {Base} from 'yeoman-generator';
import {genBase} from '../generator-base';
import { Base } from 'yeoman-generator';
import { genBase } from '../generator-base';
import insight from '../insight-init';
import {exec} from 'child_process';
import { exec } from 'child_process';
import babelStream from 'gulp-babel';
import beaufityStream from 'gulp-beautify';
import tap from 'gulp-tap';
@@ -479,7 +479,9 @@ export class Generator extends Base {

let babelPlugins = [
'babel-plugin-syntax-flow',
'babel-plugin-syntax-class-properties'
'babel-plugin-syntax-class-properties',
'babel-plugin-syntax-decorators',
'babel-plugin-syntax-export-extensions',
];

if(this.filters.babel && !flow) {
@@ -505,27 +507,6 @@ export class Generator extends Base {
},
babelrc: false // don't grab the generator's `.babelrc`
}),
beaufityStream({
"indent_size": 2,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": true,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 100,
"wrap_attributes": "auto",
"wrap_attributes_indent_size": 4,
"end_with_newline": true
}),
eslint({
fix: true,
configFile: path.join(genDir, 'templates/app/client/.eslintrc(babel)')
@@ -538,14 +519,6 @@ export class Generator extends Base {
*/
if(this.filters.ts) {
const modulesToFix = [
['angular', 'angular'],
['ngCookies', 'angular-cookies'],
['ngResource', 'angular-resource'],
['ngSanitize', 'angular-sanitize'],
['uiRouter', 'angular-ui-router'],
['ngRoute', 'angular-route'],
['uiBootstrap', 'angular-ui-bootstrap'],
['ngMessages', 'angular-messages'],
['io', 'socket.io-client']
];
function replacer(contents) {
@@ -580,7 +553,6 @@ export class Generator extends Base {
serverJsFilter.restore
]);

let self = this;
this.sourceRoot(path.join(__dirname, '../../templates/app'));
this.processDirectory('.', '.');
},
4 changes: 2 additions & 2 deletions templates/app/.eslintrc
Original file line number Diff line number Diff line change
@@ -140,7 +140,7 @@
"brace-style": 2, //enforce one true brace style
"camelcase": 1, //require camel case names
"comma-spacing": [2, {"before": false, "after": true}], //enforce spacing before and after comma
"comma-style": 2, //enforce one true comma style
"comma-style": ["error", "last"], //enforce one true comma style
"computed-property-spacing": 2, //require or disallow padding inside computed properties
"consistent-this": 2, //enforce consistent naming when capturing the current execution context
"eol-last": 2, //enforce newline at the end of file, with no multiple empty lines
@@ -170,7 +170,7 @@
"max-nested-callbacks": 2, //specify the maximum depth callbacks can be nested
"max-params": 0, //limits the number of parameters that can be used in the function declaration.
"max-statements": 0, //specify the maximum number of statement allowed in a function
"max-statements-per-line": 0, //enforce a maximum number of statements allowed per line
"max-statements-per-line": ["error", { "max": 1 }], //enforce a maximum number of statements allowed per line
"new-cap": 0, //require a capital letter for constructors
"new-parens": 2, //disallow the omission of parentheses when invoking a constructor with no arguments
"newline-after-var": 0, //require or disallow an empty newline after variable declarations
11 changes: 9 additions & 2 deletions templates/app/_.babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{
"presets": ["es2015"],
"presets": [
"es2015",
"es2016",
"es2017",
"stage-0"
],
"plugins": [
<%_ if(filters.flow) { -%>
"transform-flow-comments",
<%_ } -%>
"transform-class-properties"
"angular2-annotations",
"transform-runtime",
"transform-decorators-legacy"
]
}
86 changes: 57 additions & 29 deletions templates/app/_package.json
Original file line number Diff line number Diff line change
@@ -3,24 +3,8 @@
"version": "0.0.0",
"main": "server/index.js",
"dependencies": {
<%# CLIENT %>
"angular": "~1.5.5",<% if(filters.bootstrap) { if(filters.sass) { %>
"bootstrap-sass": "~3.3.7",<% } %>
"bootstrap": "~3.3.7",<% if(filters.oauth) { %>
"bootstrap-social": "^5.0.0",<% }} %>
"angular-animate": "~1.5.5",
"angular-aria": "~1.5.5",
"angular-resource": "~1.5.5",
"angular-cookies": "~1.5.5",
"angular-sanitize": "~1.5.5",<% if(filters.ngroute) { %>
"angular-route": "~1.5.5",<% } if(filters.uibootstrap) { %>
"angular-ui-bootstrap": "^2.0.1",<% } %>
"font-awesome": ">=4.1.0",<% if(filters.socketio) { %>
"angular-socket-io": "~0.7.0",<% } if(filters.uirouter) { %>
"angular-ui-router": "~0.3.1",<% } if(filters.auth) { %>
"angular-validation-match": "^1.9.0",<% } %>
<%# END CLIENT %>
"core-js": "^2.2.1",
"core-js": "^2.4.1",
"cors": "^2.8.1",
"express": "^4.13.3",
"morgan": "~1.7.0",
"body-parser": "^1.13.3",
@@ -31,10 +15,18 @@
"composable-middleware": "^0.3.0",
"fast-json-patch": "^1.0.0",
"lodash": "^4.6.1",
"lusca": "^1.3.0",
"babel-runtime": "^6.6.1",
"babel-polyfill": "^6.7.2",<% if(filters.pug) { %>
"pug": "2.0.0-beta4",<% } %><% if(filters.html) { %>
"lusca": "^1.4.1",
"babel-core": "^6.18.2",
"babel-plugin-angular2-annotations": "^5.1.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-runtime": "^6.6.0",
"babel-polyfill": "^6.16.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-es2016": "^6.16.0",
"babel-preset-es2017": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"babel-runtime": "^6.18.0",<% if(filters.pug) { %>
"pug": "2.0.0-beta6",<% } %><% if(filters.html) { %>
"ejs": "^2.5.3",<% } %><% if(filters.mongoose) { %>
"mongoose": "^4.1.2",
"bluebird": "^3.3.3",
@@ -53,20 +45,56 @@
"socket.io-client": "^1.3.5",
"socketio-jwt": "^4.2.0",<% } %>
"serve-favicon": "^2.3.0",
"shrink-ray": "^0.1.3",
"sprint-js": "~0.1.0"
"shrink-ray": "^0.1.3"
},
"devDependencies": {
<%# CLIENT %>
"angular-mocks": "~1.5.5",<% if(filters.stylus) { %>
<%_ if(filters.bootstrap) { -%>
"bootstrap-styl": "^5.0.5",<% } %>
"@angularclass/match-control": "^2.0.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.25",
"@angular/common": "^2.0.1",
"@angular/compiler": "^2.0.1",
"@angular/core": "^2.0.1",
"@angular/forms": "^2.0.1",
"@angular/http": "^2.0.1",
<%#"@angular/material": "^2.0.0-alpha.10",%>
"@angular/platform-browser": "^2.0.1",
"@angular/platform-browser-dynamic": "^2.0.1",
<% if(filters.ngroute) { %>
"@angular/router": "^2.0.1",<% } %>
"@angular/upgrade": "^2.0.1",
"@angularclass/hmr": "^1.2.1",
"angular2-universal": "2.1.0-rc.1",
"angular2-jwt": "^0.1.24",
<% if(filters.auth) { %>
"angular-validation-match": "^1.9.0",<% } %>
<% if(filters.uirouter) { %>
"ui-router-ng2": "^1.0.0-beta.3",<% } %>

<% if(filters.bootstrap) { %>
"bootstrap": "~3.3.7",
<% if(filters.uibootstrap) { %>
"ng2-bootstrap": "~1.1.16",<% } %>
<% if(filters.sass) { %>
"bootstrap-sass": "~3.3.7",<% } %>
<% if(filters.stylus) { %>
"bootstrap-styl": "^5.0.8",<% } %>
<% if(filters.oauth) { %>
"bootstrap-social": "^5.1.1",<% } %>
<% } %>

"font-awesome": ">=4.1.0",
<% if(filters.stylus) { %>
"font-awesome-stylus": "^4.6.2",<% } %>
<%# CLIENT DEV %>

<%# END CLIENT %>

"autoprefixer": "^6.0.0",
"babel-core": "^6.6.5",
"babel-eslint": "^6.0.4",
"babel-register": "^6.6.5",
"babel-register": "^6.16.0",
"browser-sync": "^2.8.0",
"bs-fullscreen-message": "^1.0.0",
<%_ if(filters.flow) { -%>
@@ -92,7 +120,7 @@
"gulp-istanbul-enforcer": "^1.0.3",
"gulp-load-plugins": "^1.0.0-rc.1",
"gulp-mocha": "^2.1.3",
"gulp-node-inspector": "^0.1.0",
<%# "gulp-node-inspector": "^0.1.0", %>
"gulp-plumber": "^1.0.1",
"gulp-protractor": "^3.0.0",
"gulp-rev": "^7.0.0",
1 change: 1 addition & 0 deletions templates/app/client/__index.html
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
ga('send', 'pageview');
</script>

<app>LOADING</app>
<navbar></navbar>
<% if (filters.ngroute) { %><div ng-view=""></div><% } %><% if (filters.uirouter) { %><div ui-view=""></div><% } %>
<footer></footer>
31 changes: 31 additions & 0 deletions templates/app/client/app/account(auth)/account.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
<%_ if (filters.uirouter) { -%>
import { UIRouterModule } from 'ui-router-ng2';<% } %>
<%_ if (filters.ngroute) { -%><% } %>
<%_ if(filters.oauth) { -%>
import { DirectivesModule } from '../../components/directives.module';<% } %>

import { STATES } from './account.routes';

import { LoginComponent } from './login/login.component';
import { SignupComponent } from './signup/signup.component';
import { SettingsComponent } from './settings/settings.component';

export let AccountModule = @NgModule({
imports: [
FormsModule,
<%_ if (filters.uirouter) { -%>
UIRouterModule.forChild({
states: STATES,
}),<% } %>
<%_ if (filters.ngroute) { -%><% } %>
DirectivesModule,
],
declarations: [
LoginComponent,
SignupComponent,
SettingsComponent,
],
})
class AccountModule {}
Loading

0 comments on commit 75e8a93

Please sign in to comment.