larsonjj / generator-yeogurt

A generator for creating static sites. Helps you harness the power of your favorite tools: Pug or Nunjucks, Gulp, ES6/2015, and much more!
MIT License
542 stars 73 forks source link

v1.0.0: Angular application restructure #108

Closed larsonjj closed 9 years ago

larsonjj commented 9 years ago

Angular Application Restructuring

For Yeogurt v1.0.0, a revamp/restructure is needed for all generated applications. That being said, Angular projects will not be changed by much as they are more-or-less setup with a modular structure. Nonetheless, I would like to keep the user base informed on the direction the project is taking when creating and scaling applications, so feel free to comment and leave feedback in this issue.

Old Structure

Here is an example of what the generator currently produces for angular projects:

├── client
    ├── bower_components
    ├── app                          # Application specific modules (not necessarily reusable)
    |   ├── index
    |   |   ├── index.html
    |   |   ├── index.js
    |   |   ├── index.controller.js
    |   |   ├── index.spec.js
    |   |   └── index.scss
    |   └── main.js                  # Main bootstrap file
    ├── images
    ├── styles                       # Styles folder (Global Stylesheets)
    |   └── main.scss                # Main stylesheet (import everything to this file)
    ├── favicon.ico
    ├── index.html                   # Base template
    └── robots.txt

New Proposed Structure

Here is an example of what could be produced for angular projects:

├── client
    ├── app                                  # Application specific modules (not necessarily reusable)
    |   ├── index                            # Homepage (all related files)
    |   |   ├── __tests__                    # Holds all tests for current folder
    |   |   |   └── index.controller.spec.js
    |   |   ├── index.html
    |   |   ├── index.js
    |   |   ├── index.controller.js
    |   |   └── index.scss
    |   ├── layout                           # Layout structure for app
    |   |   ├── base.html
    |   |   └── base.scss
    |   ├── modules                          # Reusable modules (self-contained, should be project agnostic)
    |   |   └── navbar
    |   |       ├── __tests__
    |   |       |   └── navbar.controller.spec.js
    |   |       ├── navbar.html
    |   |       ├── navbar.controller.js
    |   |       └── navbar.scss
    |   ├── main.js                          # Main bootstrap file
    |   └── main.scss                        # Main stylesheet (import everything to this file)
    ├── lib                                  # Global scripts, styles, etc
    ├── assets                               # Other static files (images, txt, fonts, etc)
    |   ├── images
    |   └── fonts
    ├── bower_components                     # Stores all bower files
    ├── vendor                               # Third-party (non-bower) files
    ├── favicon.ico
    ├── index.html                           # Base template
    └── robots.txt

This slightly updated structure is inspired by another great generator (generator-angular-fullstack) as well as many angular styleguides (johnpapa, mgechev, and toddmotto). I tried to pick some of my favorite features and techniques used between all of these great resources. Of course, I would like throw out some questions and get some feedback on the proposed changes.

Proposed/Existing Sub-generators

Below are the proposed sub-generators that would be usable for projects creating Angular applications.

_Module_

_Service_

_Factory_

_Provider_

_Directive_

_Filter_

_Decorator_

_Controller_

Feel free to offer your opinion on these questions (or any others) within the comments section.

As stated above, I would love to get some feedback on what you all think about this new structure. I think it is a massive move forward to the old "sock-drawer" style structure, but there is always room for improvement.

Let me know what you think!

NOTE: I continue to update this issue as more information comes in and feedback is gathered

larsonjj commented 9 years ago

Closing this in favor of generator-neopolitan