generator-maido2 v0.4.0
Maido Yeoman Generator
This generator will create a project from scratch using Yeoman, Node, Bower and Grunt. It will create a project by defining configuration options through the wizard.
Running this generator will provide a back-end php framework skeleton if desired, front-end folder structure and dependency management setup, development and build processes, and other common project configuration files.
Installation
It requires Node / NPM - Get Node JS
npm install -g yo
npm install -g generator-maido
Update
To update yo and generator-maido:
npm update -g yo
npm update -g generator-maido
Instructions
mkdir project-name && cd project-name
yo maido
Editing this generator and templates
The main script file for this module is in /app/index.js
. It extends Yeoman's Base module and contains all options, prompts and lists of tasks. See Yeoman's documentation
Additionally, all template files that this generator will use to create a project can be found in /app/templates
Wizard Options
Project name? Defaults to the humanised version of the current working directory
PHP framework?
Zend Framework 2
, Laravel
, None
PHP framework branch, tag or commit?
Defaults to master
, but it can point to any valid Git id
Use MaidoJs common files?
Defaults to true
. If enabled, this option will also use Backbone-Requirejs.
Use Backbone-Requirejs folder structure?
Defaults to true
Use Jam?
Defaults to true
Scaffold javascript pages/routes (comma-separated list)?
Accepts a comma-separated list of valid values (e.g. home
, game
, terms-conditions
), if empty defaults to demo
Include Vagrant configuration?
Defaults to true
Use database?
Defaults to true
Database name? Defaults to the underscored version of the current working directory name (e.g. 'test project' will become 'test_project')
Minimum IE version support?
IE 8
, IE 9
See below for more details about each option.
Generated content
PHP Framework (optional)
Option: ZF2 Skeleton
It will clone the zf2 skeleton application and copy its full contents to the project's root except for composer.phar, LICENSE.txt, public/css, public/fonts, public/img, public/js, module/Application/language
@todo Update module.config.php
@todo Update Application/src/Module.php with db session configuration
Option: Laravel
It will clone the Laravel repository and copy its full contents to the project's root directory.
@todo Create config files (staging, local, production)
Javascript
Backbone-Require.js files and structure (optional)
The generator will create a basic folder structure in /public/assets/js
/src/main.js
/src/app/app.js
/src/app/router/router.js
/src/app/view/main.js
/src/app/model
/dist
It will also (conditionally, based on options provided) add and install dependencies with Bower and re-configure main.js
by adding paths to these components in the paths
key.
MaidoJs (common javascript require.js modules) (optional)
The generator will clone Maido Js from Bitbucket using bower and copy all .js
files to public/assets/js/src/lib
keeping the folder structure.
Some modules included:
- Backbone plugins (TreeView, Load)
- Tracking (Analytics, pixel)
- Facebook (user, photos, share)
- Instagram (photos)
- Asynchronous image upload
And more...
Javascript pages/routes scaffolding (optional)
For each valid value passed in the wizard's Page scaffolding option (as comma-separated values) it will create a view script in /src/app/view/page
, configure the route in /src/app/router/router.js
and it as a dependency in /src/app/view/main.js
Modernizr
It will obtain Modernizr as a Bower dependency and copy modernizr.js
to /public/assets/js/src/
, which will later be optimised when building and output to /public/assets/js/dist/
Jam CSS Framework (optional)
The generator will get Jam as a Bower dependency and copy all files to /public
, excluding .editorconfig, .gitignore, LICENSE.md, bower.json, readme.md, _.htaccess
Jam is mantained by Nathan Reed
Other configuration files
/.gitignore
/.editorconfig
Vagrant (optional)
Vagrantfile
./vagrant
@todo configuration
Grunt tasks (Gruntfile)
It requires running npm install
first in other dev enviornments, to fetch node dependencies first.
These tasks will be registered by default in ./Gruntfile
:
default
- It runs
compass:dev
andwatch
(optional, when using Jam)
To run:
grunt
build
It:
Compresses css
compass:dist
(optional, when using Jam)Optimises images with
imagemin
(optional, when using Jam)Optimises modernizr by code analysis using
grunt-modernizr
Concatenates and uglifies javascripts using
grunt-requirejs
reading the optimiser's configuration from/public/assets/js/src/main.js
(optional, when using MaidoJs or Backbone-Requirejs)
To run:
grunt build
info
It lists all the available tasks
To run:
grunt info
bower-requirejs
- It runs
grunt-bower-requirejs
and re-configures main.js paths to point to bower components.
This task will be automatically called from .bowerrc post-install script, after a new component gets installed using Bower.
In short it will automatically run after doing:
bower install $component$
9 years ago