Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into kato-auth
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGELOG.md
	package.json
	readme.md
	templates/common/app/index.html
	templates/common/root/_Gruntfile.js
	templates/common/root/_bower.json
	templates/common/root/_package.json
  • Loading branch information
katowulf committed Dec 19, 2014
2 parents 1d20e7c + 95cd7bd commit 89191b6
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 44 deletions.
5 changes: 1 addition & 4 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@
"noarg": true,
"undef": true,
"strict": false,
"globalstrict": true,
"trailing": true,
"smarttabs": true,
"node": true
"globalstrict": true
}
7 changes: 6 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ module.exports = function (grunt) {
bump: false, // we have our own bump
file: 'package.json',
commitMessage: 'chore(release): Release version <%= version %>',
tagName: 'v<%= version %>'
tagName: 'v<%= version %>',
github: {
repo: 'yeoman/generator-angular',
usernameVar: 'GITHUB_USERNAME',
passwordVar: 'GITHUB_AUTHTOKEN'
}
}
},
stage: {
Expand Down
30 changes: 28 additions & 2 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var Generator = module.exports = function Generator(args, options) {

if (typeof this.env.options.appPath === 'undefined') {
this.option('appPath', {
desc: 'Generate CoffeeScript instead of JavaScript'
desc: 'Allow to choose where to write the files'
});

this.env.options.appPath = this.options.appPath;
Expand Down Expand Up @@ -119,10 +119,18 @@ var Generator = module.exports = function Generator(args, options) {
enabledComponents.push('angular-animate/angular-animate.js');
}

if (this.ariaModule) {
enabledComponents.push('angular-aria/angular-aria.js');
}

if (this.cookiesModule) {
enabledComponents.push('angular-cookies/angular-cookies.js');
}

if (this.messagesModule) {
enabledComponents.push('angular-messages/angular-messages.js');
}

if (this.resourceModule) {
enabledComponents.push('angular-resource/angular-resource.js');
}
Expand Down Expand Up @@ -312,6 +320,10 @@ Generator.prototype.askForModules = function askForModules() {
value: 'animateModule',
name: 'angular-animate.js',
checked: true
}, {
value: 'ariaModule',
name: 'angular-aria.js',
checked: false
}, {
value: 'cookiesModule',
name: 'angular-cookies.js',
Expand All @@ -320,6 +332,10 @@ Generator.prototype.askForModules = function askForModules() {
value: 'resourceModule',
name: 'angular-resource.js',
checked: true
}, {
value: 'messagesModule',
name: 'angular-messages.js',
checked: false
}, {
value: 'routeModule',
name: 'angular-route.js',
Expand All @@ -339,7 +355,9 @@ Generator.prototype.askForModules = function askForModules() {
this.prompt(prompts, function (props) {
var hasMod = function (mod) { return props.modules.indexOf(mod) !== -1; };
this.animateModule = hasMod('animateModule');
this.ariaModule = hasMod('ariaModule');
this.cookiesModule = hasMod('cookiesModule');
this.messagesModule = hasMod('messagesModule');
this.resourceModule = hasMod('resourceModule');
this.routeModule = hasMod('routeModule');
this.sanitizeModule = hasMod('sanitizeModule');
Expand All @@ -351,10 +369,18 @@ Generator.prototype.askForModules = function askForModules() {
angMods.push("'ngAnimate'");
}

if (this.ariaModule) {
angMods.push("'ngAria'");
}

if (this.cookiesModule) {
angMods.push("'ngCookies'");
}

if (this.messagesModule) {
angMods.push("'ngMessages'");
}

if (this.resourceModule) {
angMods.push("'ngResource'");
}
Expand Down Expand Up @@ -528,4 +554,4 @@ Generator.prototype._defaultNamespace = function(envValue, prompts) {
return true;
});
}
};
};
21 changes: 19 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ A project can mix CoffeScript and JavaScript files.

To output JavaScript files, even if CoffeeScript files exist (the default is to output CoffeeScript files if the generator finds any in the project), use `--coffee=false`.

### Minification Safe

**tl;dr**: You don't need to write annotated code as the build step will
handle it for you.

By default, generators produce unannotated code. Without annotations, AngularJS's DI system will break when minified. Typically, these annotations that make minification safe are added automatically at build-time, after application files are concatenated, but before they are minified. The annotations are important because minified code will rename variables, making it impossible for AngularJS to infer module names based solely on function parameters.

The recommended build process uses `ng-annotate`, a tool that automatically adds these annotations. However, if you'd rather not use it, you have to add these annotations manually yourself. Why would you do that though? If you find a bug
in the annotated code, please file an issue at [ng-annotate](https://github.com/olov/ng-annotate/issues).


### Add to Index
By default, new scripts are added to the index.html file. However, this may not always be suitable. Some use cases:

Expand All @@ -223,11 +234,12 @@ The following packages are always installed by the [app](#app) generator:

The following additional modules are available as components on bower, and installable via `bower install`:

* angular-animate
* angular-aria
* angular-cookies
* angular-loader
* angular-messages
* angular-resource
* angular-sanitize
* firebase-simple-login

All of these can be updated with `bower update` as new versions of AngularJS or Firebase are released.

Expand All @@ -248,6 +260,11 @@ You can change the `app` directory by adding a `appPath` property to `bower.json
```
This will cause Yeoman-generated client-side files to be placed in `public`.

Note that you can also achieve the same results by adding an `--appPath` option when starting generator:
```bash
yo angularfire [app-name] --appPath=public
```

## Testing

Running `grunt test` will run the unit tests with karma.
Expand Down
5 changes: 5 additions & 0 deletions route/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ var angularUtils = require('../util.js');

var Generator = module.exports = function Generator(name, skipFiles) {
ScriptBase.apply(this, arguments);
this.option('uri', {
desc: 'Allow a custom uri for routing',
type: String,
required: false
});

var bower = require(path.join(process.cwd(), 'bower.json'));
var match = require('fs').readFileSync(path.join(
Expand Down
2 changes: 1 addition & 1 deletion templates/coffeescript/service/service.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
# Service in the <%= scriptAppName %>.
###
angular.module('<%= scriptAppName %>')
.service '<%= classedName %>', ->
.service '<%= cameledName %>', ->
# AngularJS will instantiate a singleton by calling "new" on this function
10 changes: 5 additions & 5 deletions templates/common/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ <h3 class="text-muted"><%= appname %></h3>

<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
!function(A,n,g,u,l,a,r){A.GoogleAnalyticsObject=l,A[l]=A[l]||function(){
(A[l].q=A[l].q||[]).push(arguments)},A[l].l=+new Date,a=n.createElement(g),
r=n.getElementsByTagName(g)[0],a.src=u,r.parentNode.insertBefore(a,r)
}(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-X');
ga('send', 'pageview');
Expand All @@ -70,7 +70,7 @@ <h3 class="text-muted"><%= appname %></h3>
<!-- build:js(.) scripts/oldieshim.js -->
<!--[if lt IE 9]>
<script src="bower_components/es5-shim/es5-shim.js"></script>
<script src="bower_components/json3/lib/json3.min.js"></script>
<script src="bower_components/json3/lib/json3.js"></script>
<![endif]-->
<!-- endbuild -->

Expand Down
2 changes: 1 addition & 1 deletion templates/common/app/views/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h1>'Allo, 'Allo!</h1>
<img src="images/yeoman.png" alt="I'm Yeoman"><br>
Always a pleasure scaffolding your apps.
</p>
<p><a class="btn btn-lg btn-success" ng-href="#">Splendid!<span class="glyphicon glyphicon-ok"></span></a></p>
<p><a class="btn btn-lg btn-success" ng-href="#/">Splendid!<span class="glyphicon glyphicon-ok"></span></a></p>
</div>

<div class="row marketing">
Expand Down
1 change: 0 additions & 1 deletion templates/common/root/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
Expand Down
6 changes: 3 additions & 3 deletions templates/common/root/_Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ module.exports = function (grunt) {
src: [
'.tmp',
'<%%= yeoman.dist %>/{,*/}*',
'!<%%= yeoman.dist %>/.git*'
'!<%%= yeoman.dist %>/.git{,*/}*'
]
}]
},
Expand Down Expand Up @@ -356,7 +356,7 @@ module.exports = function (grunt) {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
src: ['*.js', '!oldieshim.js'],
dest: '.tmp/concat/scripts'
}]
}
Expand All @@ -383,7 +383,7 @@ module.exports = function (grunt) {
'*.html',
'views/{,*/}*.html',
'images/{,*/}*.{webp}',
'fonts/*'
'fonts/{,*/}*.*'
]
}, {
expand: true,
Expand Down
2 changes: 1 addition & 1 deletion templates/common/root/_bower.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{<% var ngVer = "1.2.16" %>
{<% var ngVer = "1.3.0" %>
"name": "<%= _.slugify(_.humanize(appname)) %>",
"version": "0.0.0",
"dependencies": {
Expand Down
44 changes: 22 additions & 22 deletions templates/common/root/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@
"version": "0.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "^0.4.1",
"grunt-autoprefixer": "^0.7.3",
"grunt-concurrent": "^0.5.0",
"grunt-contrib-clean": "^0.5.0",<% if (coffee) { %>
"grunt-contrib-coffee": "^0.10.1",<% } %><% if (compass) { %>
"grunt-contrib-compass": "^0.7.2",<% } %>
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-connect": "^0.7.1",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-cssmin": "^0.9.0",
"grunt": "^0.4.5",
"grunt-autoprefixer": "^2.0.0",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",<% if (coffee) { %>
"grunt-contrib-coffee": "^0.12.0",<% } %><% if (compass) { %>
"grunt-contrib-compass": "^1.0.0",<% } %>
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.10.0",
"grunt-contrib-htmlmin": "^0.3.0",
"grunt-contrib-imagemin": "^0.7.0",
"grunt-contrib-imagemin": "^0.9.2",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-uglify": "^0.6.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^0.2.1",
"grunt-google-cdn": "^0.4.0",
"grunt-newer": "^0.7.0",
"grunt-ng-annotate": "^0.3.0",
"grunt-svgmin": "^0.4.0",
"grunt-usemin": "^2.1.1",
"grunt-wiredep": "^1.7.0",
"jshint-stylish": "^0.2.0",
"load-grunt-tasks": "^0.4.0",
"time-grunt": "^0.3.1",
"grunt-filerev": "^2.1.2",
"grunt-google-cdn": "^0.4.3",
"grunt-newer": "^0.8.0",
"grunt-ng-annotate": "^0.8.0",
"grunt-svgmin": "^2.0.0",
"grunt-usemin": "^2.6.2",
"grunt-wiredep": "^2.0.0",
"jshint-stylish": "^1.0.0",
"load-grunt-tasks": "^1.0.0",
"time-grunt": "^1.0.0",
"chalk": "^0.4.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion templates/javascript/service/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
* Service in the <%= scriptAppName %>.
*/
angular.module('<%= scriptAppName %>')
.service('<%= cameledName %>', function <%= cameledName %>() {
.service('<%= cameledName %>', function () {
// AngularJS will instantiate a singleton by calling "new" on this function
});

0 comments on commit 89191b6

Please sign in to comment.