Skip to content

Deps updates #2729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 17, 2018
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,961 changes: 10,961 additions & 0 deletions docs/package-lock.json

Large diffs are not rendered by default.

13,299 changes: 13,299 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions templates/app/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"main": "server/index.js",
"dependencies": {
"compression": "^1.7.1",
"core-js": "^2.4.1",
"cors": "^2.8.1",
"core-js": "^2.5.0",
"express": "^4.13.3",
"morgan": "~1.8.2",
"morgan": "^1.9.0",
"body-parser": "^1.13.3",
"method-override": "^2.3.10",
"cookie-parser": "^1.3.5",
Expand Down Expand Up @@ -45,7 +44,7 @@
"passport-google-oauth20": "^1.0.0",<% } %><% if(filters.ws) { %>
"primus": "^7.0.1",
"primus-emit": "^1.0.0",
"uws": "^8.14.1",<% } %>
"uws": "^10.148.0",<% } %>
"serve-favicon": "^2.3.0"
},
"devDependencies": {
Expand All @@ -64,7 +63,7 @@
<%#"@angular/material": "5.0.0-rc0",%>
"@angularclass/hmr": "^2.1.3",
<%_ if(filters.ts) { -%>
"@types/core-js": "^0.9.41",
"@types/core-js": "^2.5.0",
<%_ if(filters.jasmine) { -%>
"@types/jasmine": "^2.5.47",
<%_ } -%>
Expand Down Expand Up @@ -104,7 +103,7 @@

<%# END CLIENT %>

"autoprefixer": "^7.1.3",
"autoprefixer": "^8.6.0",
"babel-eslint": "^8.2.3",
"babel-register": "^6.16.0",
"bs-fullscreen-message": "^1.0.0",
Expand All @@ -115,6 +114,7 @@
"babel-plugin-transform-class-properties": "^6.6.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-preset-env": "^1.6.1",
"cors": "^2.8.4",
"cross-env": "^5.1.1",
"eslint": "^4.19.1",
"del": "^3.0.0",
Expand Down Expand Up @@ -155,8 +155,8 @@
"html-webpack-harddisk-plugin": "~0.2.0",
<%_ if(filters.pug) { _%>
"pug-html-loader": "^1.1.5",<% } %>
"typescript": "~2.6.1",
"awesome-typescript-loader": "^3.3.0",
"typescript": "~2.9.0",
"awesome-typescript-loader": "^4.0.0",
"babel-loader": "^7.1.2",
"css-loader": "^0.28.7",
"file-loader": "^0.11.2",
Expand Down
22 changes: 12 additions & 10 deletions templates/app/client/app/account(auth)/signup/signup.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Component } from '@angular/core';
<%_ if(filters.uirouter) { -%>
import { StateService } from 'ui-router-ng2';<% } %>
<%_ if(filters.ngroute) { -%>
import { Router } from '@angular/router';<% } %>
import { Router } from '@angular/router';<% } %><% if(filters.mongoose) { %>
import { ValidationError } from 'mongoose';<% } %>
import { AuthService } from '../../../components/auth/auth.service';

<%_ if(filters.flow) { -%>
Expand All @@ -28,7 +29,7 @@ export class SignupComponent {
email: '',
password: ''
};
errors = {};
errors: {field?: Error} = {};
submitted = false;
AuthService;
<%_ if(filters.ngroute) { -%>
Expand Down Expand Up @@ -56,21 +57,22 @@ export class SignupComponent {
password: this.user.password
})
.then(() => {
// Account created, redirect to home
<% if(filters.ngroute) { %>this.Router.navigateByUrl('/home');<% } -%>
<% if(filters.uirouter) { %>this.StateService.go('main');<% } -%>
})
.catch(err => {<% if(filters.mongooseModels) { %>
// Account created, redirect to home<% if(filters.ngroute) { %>
this.Router.navigateByUrl('/home');<% } %><% if(filters.uirouter) { %>
this.StateService.go('main');<% } %>
})<% if(filters.mongooseModels) { %>
.catch((err: {errors: {field: ValidationError}}) => {
this.errors = err.errors;

// Update validity of form fields that match the mongoose errors
Object.entries(err.errors).forEach(([field, error]) => {
Object.entries(err.errors).forEach(([field, error]: [string, ValidationError]) => {
this.errors[field] = error.message;

if(field === 'email' && error.kind === 'user defined') {
form.form.controls[field].setErrors({inUse: true});
}
form.form.controls[field].setErrors({inUse: true});
}
});<% } %><% if(filters.sequelizeModels) { %>
.catch(err => {
this.errors = {};

// Update validity of form fields that match the sequelize errors
Expand Down
7 changes: 1 addition & 6 deletions templates/app/client/app/app.constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
<%_ if(filters.babel) { -%>
export default from '../../server/config/environment/shared';<% } %>
<%_ if(filters.ts) { -%>
import shared from '../../server/config/environment/shared.js';

export default shared;<% } %>
export * from '../../server/config/environment/shared';
6 changes: 3 additions & 3 deletions templates/app/client/components/auth(auth)/auth.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable, EventEmitter, Output } from '@angular/core';
import { UserService } from './user.service';
import { HttpClient } from '@angular/common/http';
import { safeCb } from '../util';
import constants from '../../app/app.constants';
import { userRoles } from '../../app/app.constants';

// @flow
class User {
Expand All @@ -16,7 +16,7 @@ class User {
export class AuthService {
_currentUser: User = new User();
@Output() currentUserChanged = new EventEmitter(true);
userRoles = constants.userRoles || [];
userRoles = userRoles || [];
UserService;

static parameters = [HttpClient, UserService];
Expand All @@ -43,7 +43,7 @@ export class AuthService {
* @param {String} role - role to check against
*/
static hasRole(userRole, role) {
return constants.userRoles.indexOf(userRole) >= constants.userRoles.indexOf(role);
return userRoles.indexOf(userRole) >= userRoles.indexOf(role);
}

get currentUser() {
Expand Down
14 changes: 9 additions & 5 deletions templates/app/server/config/environment/shared.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
'use strict';
/*eslint no-process-env:0*/

module.exports.default = {
env: process.env.NODE_ENV,
port: process.env.PORT || <%= devPort %>,
// List of user roles
userRoles: ['guest', 'user', 'admin']
export const env = process.env.NODE_ENV;
export const port = process.env.PORT || 9000;
// List of user roles
export const userRoles = ['guest', 'user', 'admin'];

export default {
env,
port,
userRoles,
};
3 changes: 1 addition & 2 deletions templates/app/server/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* Express configuration
*/

'use strict';

import express from 'express';
import favicon from 'serve-favicon';
import morgan from 'morgan';
Expand Down Expand Up @@ -31,6 +29,7 @@ export default function(app) {

if(env === 'development' || env === 'test') {
app.use(express.static(path.join(config.root, '.tmp')));
app.use(require('cors')());
}

if(env === 'production') {
Expand Down