Giter Club home page Giter Club logo

generator-fatarrow's Introduction

fatarrow

###An AngularJS application Reference Architecture License Version Build Status Dependency Status

Build AngularJS applications with CoffeeScript - without the ceremony. By the way, you can write JavaScript too.

Table of Contents

Installing

Before running, you must install and configure the following one-time dependencies:

Enter the following in the terminal

Option 1: Using Yeoman Generator (Recommended)

$ npm install -g gulp yo bower
$ npm install -g generator-fatarrow
$ mkdir my-new-project && cd $_
$ yo fatarrow

Option 2: Clone this repo

$ npm install -g gulp
$ git clone [email protected]:CaryLandholt/fatarrow.git
$ cd fatarrow
$ npm install

Running

Here are some useful commands to get started:

Get all commands and options by typing

$ gulp help

Running with With a fake backend ($httpBackend)

$ gulp

With a real backend (gulp will proxy calls to the backend of your choice)

$ gulp --backend

Build for production

$ gulp --prod --no-serve

Run tests on your build server

$ gulp test --citest --no-open

Deploy your app

$ gulp test --citest --no-open
$ gulp --prod --no-serve
# deploy to a path (configuration in /config/locationConfig.coffee)
$ gulp deploy
# deploy to S3 (configurtion in /config/s3Config.coffee)
$ gulp deploy --target s3

Scripting

Your choice of scripting languages.

Styling

Your choice of styling languages.

Templating

Your choice of templating engines.

Structure

  • File extensions supported by fatarrow:
    • Scripts: .coffee, .js, .ls, .ts, .es6
    • Styles: .less, .css, .scss
    • Templates: .html, .haml, .jade

(Note: to keep the example succint, .coffee, .html and .less extensions are used below. However, all of the file extensions listed above can be used, and even can be mix-and-matched.)

The root directory generated for a fatarrow app:

├──  e2e/
├──  config/
├──  src/
│   ├──  components/
│   │   └──  comp/
│   │   │   ├──  test
│   │   │   ├──  └──  comp.spec.coffee
│   │   │   ├──  comp.coffee
│   │   │   └──  comp.html
│   │   │   └──  comp.backend.coffee
│   │   │   └──  comp.less
│   ├──  app/
│   │   ├──  app.coffee
│   │   ├──  appRoutes.coffee
│   │   └──  views.backend.coffee
│   ├──  home/
│   │   ├──  homeController.coffee
│   │   ├──  homeRoutes.coffee
│   │   └──  home.html
│   ├──  img/
│   │   └──  angularjs.jpg
│   └──  index.html
├──  tasks/
├──  bower_components/
├──  nodes_modules/
├──  .bowerrc
├──  .gitignore
├──  bower.json
├──  gulpfile.coffee
├──  package.json

Explanation of the folders:

  • src/app: Angular module for the app. All app level config should go here.
  • src/home: Each feature of the app should go in its own folder. It should contain all scripts, styles, templates and tests within the feature folder.
  • src/components: Reusable components (directives, factories, styles, etc.)
  • e2e: Protractor tests. They should also be separated by features/components.
  • config: Configurtion for gulp tasks broken up by each task.

Features

  • Fake data: Running gulp will include the .backend.coffee files and therefore Angular's $httpBackend will be utilized. This should be used for backendless development.
  • Real data: Running gulp --backend will proxy all backend calls to the backend of your choice. See below for configuration instructions.
  • Production build: Running gulp --prod will produce builds for production. This includes:
    • ngAnnotate : make your angular code minification proof
    • ngClassify : CoffeeScript classes for angular
    • minification : JS, CSS and HTML
    • image minification: images from teh img folder are compressed
    • rev: minified files are rev'ed for browser cache busting
    • templatecache : take all angular templates and include them in the minified scripts
    • deploy: deploy to a path or to AWS S3. see above for commands.
  • Dev Workflow:
    • watch : watch your src folder and rebuild and reload automatically
    • linting : lint .js and .coffee files. style checking and fixing with JSCS
    • test : run e2e (protractor) and unit (karma) tests
    • browserSync : test on multiple devices simultaneously
    • newer: only process changed files
    • HTML5Mode: Angular's html5Mode is supported on the BrowserSync server. Be sure to configure your production web server. HTMO5Mode is turned on by default. See Angular's documentation to turn it off for browser compatibility.
    • plato: perform code visualization, static analysis, and complexity analysis
    • update notifications: yeoman scaffolded projects will get notifications and instructions on upgrading the project

Configuration

(Note: Configuration for the rest of the gulp plug-ins lives in the config folder.)

  • app.coffee
    • APP_NAME: name of the angular module for the app
  • bower.coffee
    • BOWER_COMPONENTS: consume dependencies from bower by specifying dependency name, version, dependency type (scripts, styles, etc.) and a list of files to be consumed (cherry picking files).
  • coffeeLint.coffee: options for linting CoffeeScript. See reference
  • e2e.coffee: options for protractor. See reference.
  • karma.coffee: options for karma. See reference
  • languages.coffee: disable compilers not in use to optimize your build
  • less.coffee: options for the less compiler. See reference
  • locationDeploy.coffee: deploy app to a path
  • plato.coffee: options for plato. See reference
  • s3Deploy.coffee: options to deploy to AWS S3. See reference
  • SCRIPTS: load order for scripts
  • server.coffee: options for browser-sync development server
    • PROXY_CONFIG: proxy backend calls during development with connect-modrewrite. See reference
    • PORT: run app on a specific port (default: 8181)
  • STYLES: load order for styles

Add Bower Component

You need three pieces of information for each Bower component to include in your app.

  1. The Bower component name (e.g. restangular)
  2. The version of the component (e.g. 1.4.0)
  3. The files within the component to include in your app (e.g. restangular.min.js)

The following will include the restangular component, version 1.4.0, and place the dist/restangular.min.js file in the vendor/scripts directory. By default, all Bower components will be placed in the vendor directory.

BOWER_COMPONENTS =
	'restangular': '1.4.0':
		scripts: 'dist/restangular.min.js'

If load order is important, include a reference to the file in the SCRIPTS section.

The following will ensure restangular is loaded prior to app.js.

SCRIPTS =
	'**/angular.min.js'
	'**/restangular.min.js'
	'**/app.js'
	'**/*.js'

For AngularJS components, include a reference to the module within your application. For example:

angular.module('app', ['restangular']);

Contributing

See CONTRIBUTING.md

Changelog

See CHANGELOG.md

License

See LICENSE

generator-fatarrow's People

Contributors

carylandholt avatar nach-mehta avatar nmehta6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nmehta6 hooptie45

generator-fatarrow's Issues

fatarrow "module"

I had some brief confusion with the usage of "module" since a fatarrow "module" doesn't link with the angular concept of a "module." If I'm understanding correctly that a fatarrow module is a convenient grouping of files (controller, route, service, view) under one name, it might be beneficial to rename this to distinguish the colliding concepts.

Possibilities:

  • segment
  • section
  • component (used within application structure for directives)
  • fragment
  • fletching (playing with arrow theme 🎯 :p)

Project level update notifications

Currently, notifications will indicate if you need to update the generator by npm i generator-fatarrow -g. However, the project level version stored in .yo-rc.json could be behind. Show notifications at the project level indicating how far behind each project is.

extra directory when adding a new feature

If I say:
yo fatarrow:feature user/login

it creates the directory structure:
user/login/user

with the files in the second user dir

Is this the intend behavior? If not I can fix and provide a pull request

Options to select languages

fatarrow now contains an array called LANGUAGES. Allow the user to select the languages they want when scaffolding a project. Also take out unnecessary packages from _package.json to speed up npm install.

CoffeeScript as a peer dependency?

CoffeeScript doesn't strike me as something that belongs as a peer dependency as it doesn't fit the bill as a plugin architecture. In the package.json, yeoman and gulp are great examples of this and definitely belong. I think CoffeeScript can be left as a DevDependency without also being included as a peer dependency.

yo fatarrow:module asks for module name?

yo fatarrow:module without the required named parameter currently barfs up a stacktrace. Would it be possible for it to instead politely ask what you want your module to be called?

Gulp command always just prints options

After generating a project with this generator, using coffeescript, sass, and generate code samples, the gulp command just prints the help no matter what I pass to it. I'm on OS X, using npm 3.7.3 and gulp 3.9.1.

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.