angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.13k stars 1.24k forks source link

My project is taking too long to load on angular fulstack v2.1.1 #2584

Open akshayseth opened 7 years ago

akshayseth commented 7 years ago

Hello, I have made a new project and now I have completed it.My only concern with it is that it is taking too long to load on certain times.The version of angular fullstack I am using is v2.1.1 Below is my bower.json: { "name": "ubuntu-fullstackj", "version": "0.0.0", "dependencies": { "angular": ">=1.2.", "json3": "~3.3.1", "es5-shim": "~3.0.1", "bootstrap": "~3.1.1", "angular-resource": ">=1.2.", "angular-cookies": ">=1.2.", "angular-sanitize": ">=1.2.", "angular-bootstrap": "~0.11.0", "font-awesome": ">=4.1.0", "lodash": "~2.4.1", "angular-socket-io": "~0.6.0", "angular-ui-router": "~0.2.15", "angular-typewrite": "^0.0.15", "ng-file-upload": "^12.2.13", "angular-material": "1.0.0", "animate.css": "3.5.2", "angular-animate": "1.4.0", "angular-aria": "1.4.0", "Ionicons": "ionicons#^2.0.1", "angular-file-saver": "^1.1.3" }, "devDependencies": { "angular-mocks": ">=1.2.", "angular-scenario": ">=1.2." } } and below is my package.json: { "name": "ubuntu-fullstackj", "version": "0.0.0", "main": "server/app.js", "dependencies": { "angular-typewriter": "0.0.15", "body-parser": "~1.5.0", "composable-middleware": "^0.3.0", "compression": "~1.0.1", "connect-mongo": "^0.8.1", "cookie-parser": "~1.0.1", "ejs": "~0.8.4", "errorhandler": "~1.0.0", "express": "~4.9.0", "express-jwt": "^3.0.0", "express-session": "~1.0.2", "jsonwebtoken": "^5.0.0", "lodash": "~2.4.1", "method-override": "~1.0.0", "mongoose": "~4.0.3", "morgan": "~1.0.0", "passport": "~0.2.0", "passport-facebook": "latest", "passport-google-oauth": "latest", "passport-local": "~0.1.6", "passport-twitter": "latest", "serve-favicon": "~2.0.1", "socket.io": "^1.0.6", "socket.io-client": "^1.0.6", "socketio-jwt": "^3.0.0", "angular-aria": "1.5.8" }, "devDependencies": { "connect-livereload": "~0.4.0", "grunt": "^0.4.2", "grunt-angular-templates": "^0.5.4", "grunt-autoprefixer": "~0.7.2", "grunt-babel": "~5.0.0", "grunt-build-control": "~0.4.0", "grunt-concurrent": "~0.5.0", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-concat": "~0.4.0", "grunt-contrib-copy": "~0.5.0", "grunt-contrib-cssmin": "~0.9.0", "grunt-contrib-htmlmin": "~0.2.0", "grunt-contrib-imagemin": "~0.7.1", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-uglify": "~0.4.0", "grunt-contrib-watch": "~0.6.1", "grunt-dom-munger": "^3.4.0", "grunt-env": "~0.4.1", "grunt-express-server": "~0.4.17", "grunt-google-cdn": "~0.4.0", "grunt-injector": "~0.5.4", "grunt-karma": "~0.8.2", "grunt-mocha-test": "~0.10.2", "grunt-newer": "~0.7.0", "grunt-ng-annotate": "^0.2.3", "grunt-node-inspector": "~0.1.5", "grunt-nodemon": "~0.2.0", "grunt-open": "~0.2.3", "grunt-protractor-runner": "^1.1.0", "grunt-rev": "~0.1.0", "grunt-svgmin": "~0.4.0", "grunt-usemin": "~2.1.1", "grunt-wiredep": "~1.8.0", "jit-grunt": "^0.5.0", "jshint-stylish": "~0.1.5", "karma": "~0.12.9", "karma-babel-preprocessor": "^5.2.1", "karma-chrome-launcher": "~0.1.3", "karma-coffee-preprocessor": "~0.2.1", "karma-firefox-launcher": "~0.1.3", "karma-html2js-preprocessor": "~0.1.0", "karma-jade-preprocessor": "0.0.11", "karma-jasmine": "~0.1.5", "karma-ng-html2js-preprocessor": "~0.1.0", "karma-ng-jade2js-preprocessor": "^0.1.2", "karma-ng-scenario": "~0.1.0", "karma-phantomjs-launcher": "~0.1.4", "karma-requirejs": "~0.2.1", "karma-script-launcher": "~0.1.0", "open": "~0.0.4", "requirejs": "~2.1.11", "should": "~3.3.1", "supertest": "~0.11.0", "time-grunt": "~0.3.1" }, "engines": { "node": ">=0.10.0" }, "scripts": { "start": "node server/app.js", "test": "grunt test", "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update" }, "private": true }

I think there is some versioning issue because of which it is taking a long time to process. This is the console I get for minimum 2mins before the project gets loaded: Running "serve" task target: undefined

Running "clean:server" (clean) task Cleaning .tmp...OK

Running "env:all" (env) task

Running "concurrent:server" (concurrent) task

Running "babel:server" (babel) task

Done, without errors.

Execution Time (2017-05-31 09:44:00 UTC) loading tasks 796ms ■■■■■■■■■■■■■■■■■■■■■■■■■ 52% babel:server 742ms ■■■■■■■■■■■■■■■■■■■■■■■ 48% Total 1.5s

Running "injector:scripts" (injector) task Missing option template, using dest as template instead Injecting js files (19 files)

Running "injector:css" (injector) task Missing option template, using dest as template instead Injecting css files (7 files)

Running "wiredep:target" (wiredep) task

Running "autoprefixer:dist" (autoprefixer) task

Running "express:dev" (express) task Starting background Express server Debugger listening on [::]:5858 Express server listening on 9000, in development mode

Running "wait" task

Waiting for server reload... Done waiting!

Running "open:server" (open) task

Running "watch" task Waiting...

Please help.I need to deploy my project at the earliest and with this problem I can't.

Awk34 commented 7 years ago

Such an old version of the generator isn't supported anymore. Can you upgrade to a newer version?

akshayseth commented 7 years ago

Can you please look in my bower.json and suggest me a version of the generator which will be best for it? Also,many of my projects are on same version so why the heck am I getting the waiting time now? If it was old enough waiting time should be in every single step.

smirciat commented 7 years ago

If you are looking for a similar experience to what you had with 2.1, I'd recommend 3.8.0, sense it still supports grunt and bower. Version 4+ is the latest, and it works well, but it uses gulp and webpack, which behave differently than what you were used to in 2.1. Hope this helps!

akshayseth commented 7 years ago

@smirciat I installed generator~3.8.0 but the controller file is a bit different from what I work on. Below is the login controller of version 3.8.0: 'use strict';

class LoginController { constructor(Auth, $state) { this.user = {}; this.errors = {}; this.submitted = false;

this.Auth = Auth;
this.$state = $state;

}

login(form) { this.submitted = true;

if (form.$valid) {
  this.Auth.login({
      email: this.user.email,
      password: this.user.password
    })
    .then(() => {
      // Logged in, redirect to home
      this.$state.go('main');
    })
    .catch(err => {
      this.errors.other = err.message;
    });
}

} }

angular.module('380App') .controller('LoginController', LoginController);

And below is the login page of the controller I worked on: 'use strict'; // @flow

type User = { name: string; email: string; password: string; };

export default class LoginController { user: User = { name: '', email: '', password: '' }; errors = { login: undefined }; submitted = false; Auth; $state;

/@ngInject/ constructor(Auth, $state) { this.Auth = Auth; this.$state = $state; }

login(form) { this.submitted = true;

if(form.$valid) {
  this.Auth.login({
    email: this.user.email,
    password: this.user.password
  })
    .then(() => {
      // Logged in, redirect to home
      this.$state.go('main');
    })
    .catch(err => {
      this.errors.login = err.message;
    });
}

} } I need something like this...Is there any version suitable? Thanks in advance.

akshayseth commented 7 years ago

Nothing?

smirciat commented 7 years ago

As far as I can tell, version 3.8.0 uses the class/constructor style in the controllers, which makes use of Typescript, a more modern superscript of javascript. For something like the login controller, I have never needed it modified very much in any of my projects, and it should work well as generated. I you really need your old controller style, it should work to copy and paste over the generated code. I did just that on an Ionic app I converted from angular-fullstack for use on mobile. It was having trouble with Typescript, so I copied the older style code over the top and it worked fine for me.

akshayseth commented 7 years ago

I shifted my project to meanjs generator but my heart still resides in angular fullstack generator. I dont know why support for previous versions are discontinued.I will give it a shot though @smirciat . Thanks for your inputs.