Giter Club home page Giter Club logo

generator-angular-material-fullstack's Introduction

AngularJS Material Full-Stack generator

Build Status npm version

Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS with Angular Material, and Node - lets you quickly set up a project following best practices.

Usage

Install generator-angular-material-fullstack:

npm install -g generator-angular-material-fullstack

Make a new directory, and cd into it:

mkdir my-new-project && cd $_

Run yo angular-material-fullstack, optionally passing an app name:

yo angular-material-fullstack [app-name]

Run grunt for building, grunt serve for preview, and grunt serve:dist for a preview of the built app.

Prerequisites

  • MongoDB - Download and Install MongoDB - If you plan on scaffolding your project with mongoose, you'll need mongoDB to be installed and have the mongod process running.

Supported Configurations

Client

  • Scripts: JavaScript, CoffeeScript, Babel
  • Markup: HTML, Jade
  • Stylesheets: CSS, Sass,
  • Angular Routers: ngRoute, ui-router

Server

  • Database: None, MongoDB
  • Authentication boilerplate: Yes, No
  • oAuth integrations: Facebook Twitter Google
  • Socket.io integration: Yes, No

Injection

A grunt task looks for new files in your client/app and client/components folder and automatically injects them in the appropriate places based on an injection block.

  • scss files into client/app.scss
  • css files into client/index.html
  • js files into client/index.html
  • coffeescript temp js files into client/index.html
  • babel temp js files into client/index.html

Generators

Available generators:

App

Sets up a new AngularJS + Express app, generating all the boilerplate you need to get started.

Example:

yo angular-material-fullstack

Endpoint

Generates a new API endpoint.

Example:

yo angular-material-fullstack:endpoint message
[?] What will the url of your endpoint be? /api/messages

Produces:

server/api/message/index.js
server/api/message/message.spec.js
server/api/message/message.controller.js
server/api/message/message.model.js  (optional)
server/api/message/message.socket.js (optional)

Route

Generates a new route.

Example:

yo angular-material-fullstack:route myroute
[?] Where would you like to create this route? client/app/
[?] What will the url of your route be? /myroute

Produces:

client/app/myroute/myroute.js
client/app/myroute/myroute.controller.js
client/app/myroute/myroute.controller.spec.js
client/app/myroute/myroute.html
client/app/myroute/myroute.scss

Controller

Generates a controller.

Example:

yo angular-material-fullstack:controller user
[?] Where would you like to create this controller? client/app/

Produces:

client/app/user/user.controller.js
client/app/user/user.controller.spec.js

Directive

Generates a directive.

Example:

yo angular-material-fullstack:directive myDirective
[?] Where would you like to create this directive? client/app/
[?] Does this directive need an external html file? Yes

Produces:

client/app/myDirective/myDirective.directive.js
client/app/myDirective/myDirective.directive.spec.js
client/app/myDirective/myDirective.html
client/app/myDirective/myDirective.scss

Simple directive without an html file

Example:

yo angular-material-fullstack:directive simple
[?] Where would you like to create this directive? client/app/
[?] Does this directive need an external html file? No

Produces:

client/app/simple/simple.directive.js
client/app/simple/simple.directive.spec.js

Filter

Generates a filter.

Example:

yo angular-material-fullstack:filter myFilter
[?] Where would you like to create this filter? client/app/

Produces:

client/app/myFilter/myFilter.filter.js
client/app/myFilter/myFilter.filter.spec.js

Service

Generates an AngularJS service.

Example:

yo angular-material-fullstack:service myService
[?] Where would you like to create this service? client/app/

Produces:

client/app/myService/myService.service.js
client/app/myService/myService.service.spec.js

You can also do yo angular-material-fullstack:factory and yo angular-material-fullstack:provider for other types of services.

Decorator

Generates an AngularJS service decorator.

Example:

yo angular-material-fullstack:decorator serviceName
[?] Where would you like to create this decorator? client/app/

Produces

client/app/serviceName/serviceName.decorator.js

###Openshift

Deploying to OpenShift can be done in just a few steps:

yo angular-material-fullstack:openshift

A live application URL will be available in the output.

oAuth

If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using Facebook oAuth we would do this :

rhc set-env FACEBOOK_ID=id -a my-openshift-app
rhc set-env FACEBOOK_SECRET=secret -a my-openshift-app

You will also need to set DOMAIN environment variable:

rhc set-env DOMAIN=<your-openshift-app-name>.rhcloud.com

# or (if you're using it):

rhc set-env DOMAIN=<your-custom-domain>

After you've set the required environment variables, restart the server:

rhc app-restart -a my-openshift-app

To make your deployment process easier consider using grunt-build-control.

Pushing Updates

grunt

Commit and push the resulting build, located in your dist folder:

grunt buildcontrol:openshift

Heroku

Deploying to heroku only takes a few steps.

yo angular-material-fullstack:heroku

To work with your new heroku app using the command line, you will need to run any heroku commands from the dist folder.

If you're using mongoDB you will need to add a database to your app:

heroku addons:add mongolab

Your app should now be live. To view it run heroku open.

If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using Facebook oAuth we would do this :

heroku config:set FACEBOOK_ID=id
heroku config:set FACEBOOK_SECRET=secret

You will also need to set DOMAIN environment variable:

heroku config:set DOMAIN=<your-heroku-app-name>.herokuapp.com

# or (if you're using it):

heroku config:set DOMAIN=<your-custom-domain>

To make your deployment process easier consider using grunt-build-control.

Pushing Updates

grunt

Commit and push the resulting build, located in your dist folder:

grunt buildcontrol:heroku

Bower Components

The following packages are always installed by the app generator:

  • angular
  • angular-cookies
  • angular-mocks
  • angular-resource
  • angular-messages
  • angular-animate
  • angular-sanitize
  • angular-scenario
  • angular-aria
  • es5-shim
  • font-awesome
  • json3
  • jquery
  • lodash

These packages are installed optionally depending on your configuration:

  • angular-route
  • angular-ui-router
  • angular-socket-io
  • angular-material

All of these can be updated with bower update as new versions are released.

Configuration

Yeoman generated projects can be further tweaked according to your needs by modifying project files appropriately.

A .yo-rc file is generated for helping you copy configuration across projects, and to allow you to keep track of your settings. You can change this as you see fit.

Testing

Running grunt test will run the client and server unit tests with karma and mocha.

Use grunt test:server to only run server tests.

Use grunt test:client to only run client tests.

Protractor tests

To setup protractor e2e tests, you must first run

npm run update-webdriver

Use grunt test:e2e to have protractor go through tests located in the e2e folder.

Environment Variables

Keeping your app secrets and other sensitive information in source control isn't a good idea. To have grunt launch your app with specific environment variables, add them to the git ignored environment config file: server/config/local.env.js.

Project Structure

Overview

├── client
│   ├── app                 - All of our app specific components go in here
│   ├── assets              - Custom assets: fonts, images, etc…
│   ├── components          - Our reusable components, non-specific to to our app
│
├── e2e                     - Our protractor end to end tests
│
└── server
    ├── api                 - Our apps server api
    ├── auth                - For handling authentication with different auth strategies
    ├── components          - Our reusable or app-wide components
    ├── config              - Where we do the bulk of our apps configuration
    │   └── local.env.js    - Keep our environment variables out of source control
    │   └── environment     - Configuration specific to the node environment
    └── views               - Server rendered views

An example client component in client/app

main
├── main.js                 - Routes
├── main.controller.js      - Controller for our main route
├── main.controller.spec.js - Test
├── main.html               - View
└── main.less               - Styles

An example server component in server/api

thing
├── index.js                - Routes
├── thing.controller.js     - Controller for our `thing` endpoint
├── thing.model.js          - Database model
├── thing.socket.js         - Register socket events
└── thing.spec.js           - Test

License

BSD license

generator-angular-material-fullstack's People

Contributors

omgimalexis avatar sincraianul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generator-angular-material-fullstack's Issues

no icons after fresh generation

I don't get icons when I start my app with grunt serve. After generation, I have nothing changed.

I'm using [email protected].

screeshot

my .yo-rc.json:

{
  "generator-angular-material-fullstack": {
    "insertRoutes": true,
    "registerRoutesFile": "server/routes.js",
    "routesNeedle": "// Insert routes below",
    "routesBase": "/api/",
    "pluralizeRoutes": true,
    "insertSockets": true,
    "registerSocketsFile": "server/config/socketio.js",
    "socketsNeedle": "// Insert sockets below",
    "filters": {
      "babel": false,
      "coffee": true,
      "jade": true,
      "sass": true,
      "uirouter": true,
      "material": true,
      "mongoose": true
    }
  },
  "generator-ng-component": {
    "routeDirectory": "client/app/",
    "directiveDirectory": "client/app/",
    "filterDirectory": "client/app/",
    "serviceDirectory": "client/app/",
    "basePath": "client",
    "moduleName": "",
    "filters": [
      "uirouter"
    ],
    "extensions": [
      "coffee",
      "jade",
      "scss"
    ],
    "directiveSimpleTemplates": "",
    "directiveComplexTemplates": "",
    "filterTemplates": "",
    "serviceTemplates": "",
    "factoryTemplates": "",
    "controllerTemplates": "",
    "decoratorTemplates": "",
    "providerTemplates": "",
    "routeTemplates": ""
  }

Gulp

Can you please make a file with the gulp configuration?

Restrict access origin

Hello, i am trying unsuccessfully to restrict access to enpoints only to my domain, i sought examples of expression, but only found as free full access and not restrict, tried res.header('Access-Control-Allow-Origin', 'myDomain'), but it did not work, could someone help me?

node-pre-gyp install --fallback-to-build

Hi, I've got an error and a fail on my system (OSX 10.11.4) when this command is running "node-pre-gyp install --fallback-to-build". Anyone who got the same issue ?

Wish: Using Swagger to define server API

Dear author

Thank you for your excellent generator. To make it perfect, an integration of swagger/open API would be perfect. If I could support by providing the YAML file for the service given, let me know.

Cheers
-as

Webdriver manager update script path is wrong

In package.json
the webdriver manager update path script is wrong is pointing to node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update and it should point to /node_modules/grunt-protractor-runner/scripts/webdriver-manager-update

I can create a very small pull request if you want.

HTTPS configuration

Hello
How can I configure the server to use HTTPS protocol to communicate with the client?

Dist Fail !

The grunt serve:dist command has broke some routes and the auth service, some tips???

Authentication routing is not functioning as expected

After initialising an angular-material-fullstack project today, it became clear that the authentication is not working as it should. Whenever I try to get to /signup, I get redirected to /login, and on the main page, the app seems to be totally confused about whether the user is logged in or not, because the dropdown in the shell displays the icons for login/logout, but no text.

This functionality works as expected on angular-fullstack.

Any idea what the problem is here?

Deprecated modules

After generation I get these deprecation messages from npm:

npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please use 2.2.16 or higher due to a regression in updateOne/Many upsertedId return value
npm WARN deprecated [email protected]: Deprecated, use jstransformer
npm WARN deprecated [email protected]: Please use 2.2.16 or higher due to a regression in updateOne/Many upsertedId return value
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: Use the globby package instead
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: use [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn) or [cross-spawn-async](https://github.com/IndigoUnited/node-cross-spawn-async) instead.
npm WARN deprecated [email protected]: the module is now available as 'css-select'
npm WARN deprecated [email protected]: the module is now available as 'css-what'
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: use uuid module instead
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: Deprecated, use jstransformer
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130

node-gyp fails for grunt-inspector

npm install fails with node > 4.2 and npm 3.4.1

ake: *** [Release/obj.target/debug/src/debug.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/user/workspace/git/app/node_modules/v8-debug/build/debug/v0.4.6/node-v47-darwin-x64/debug.node" "--module_name=debug" "--module_path=/Users/user/workspace/git/app/node_modules/v8-debug/build/debug/v0.4.6/node-v47-darwin-x64"
gyp ERR! cwd /Users/user/workspace/git/app/node_modules/v8-debug
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp build --fallback-to-build --module=/Users/user/workspace/git/app/node_modules/v8-debug/build/debug/v0.4.6/node-v47-darwin-x64/debug.node --module_name=debug --module_path=/Users/user/workspace/git/app/node_modules/v8-debug/build/debug/v0.4.6/node-v47-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/user/workspace/git/app/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 15.0.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/Users/user/workspace/git/app/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/user/workspace/git/app/node_modules/v8-debug
node-pre-gyp ERR! node -v v5.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.15
node-pre-gyp ERR! not ok 

I've seen this problem also for the "generator-angular-fullstack" generator and it is related to the grunt-inspector.

Grunt-inspector must be updated in the "package.json"

from

"grunt-node-inspector": "~0.1.5"

to

"grunt-node-inspector": "^0.4.1"

Then npm install won't fail.

Best regards

derMani

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.