Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
Merge branch 'origin/master'
Browse files Browse the repository at this point in the history
Conflicts:
	templates/common/root/_package.json (grunt packages updated)
  • Loading branch information
hermansje committed Dec 14, 2014
2 parents 776d125 + 95cd7bd commit cd420f7
Show file tree
Hide file tree
Showing 15 changed files with 150 additions and 81 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
}
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
<a name="0.10.0"></a>
## 0.10.0 (2014-11-07)


#### Bug Fixes

* **build:**
* allow to copy font files from subfolders ([eb5a096e](yeoman/generator-angular/commit/eb5a096e27c7c8a7f00541b97fffe2873bafd462))
* do not clean git related subfolders of dist ([00673f5e](yeoman/generator-angular/commit/00673f5e4385c106738837899b2b838a27c22499))
* **gen:**
* replace named function with anonymous ([c82f336b](yeoman/generator-angular/commit/c82f336bbbdc9bcf44beddbd620b471a60f832eb))
* fix coffee service using wrong name ([3437a270](yeoman/generator-angular/commit/3437a270df349b0fbcd2855a530b208282ca170d))


#### Features

* **app:** add ngAria and ngMessages ([dfbfd1f4](yeoman/generator-angular/commit/dfbfd1f4feb788608dd71dbd54fced69c5a09fb3), closes [#917](yeoman/generator-angular/issues/917))


<a name="0.9.8"></a>
### 0.9.8 (2014-09-08)


#### Bug Fixes

* **wiredep:** remove cwd property ([dbe5d3e5](yeoman/generator-angular/commit/dbe5d3e5d85965ba67e5a47dfc2abb959992791d))


<a name="0.9.7"></a>
### 0.9.7 (2014-09-03)


#### Bug Fixes

* **deps:** use latest 1.2.x ng ([45c3eb67](yeoman/generator-angular/commit/45c3eb67b1440956fb2fdaf0d536ff766f13fa0f))


<a name="0.9.6"></a>
### 0.9.6 (2014-09-03)


#### Bug Fixes

* **build:** no need to ngAnnotate oldieshim ([ed413a19](yeoman/generator-angular/commit/ed413a19880511f37f2b40c5c94ef0f675796e2f))
* **deps:** update Angular to v1.2.23 ([8667f1cb](yeoman/generator-angular/commit/8667f1cbb29a1290b39ea67db8957683dce7295e))
* **oldieshim:** avoid json3 being injected twice ([b421e13b](yeoman/generator-angular/commit/b421e13ba6029eeae3e43cd12b65813464471b5b))


<a name="0.9.5"></a>
### 0.9.5 (2014-07-13)

Expand Down
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
28 changes: 27 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,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 @@ -76,10 +76,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 @@ -239,6 +247,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 @@ -247,6 +259,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 @@ -266,7 +282,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 @@ -278,10 +296,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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-angular",
"version": "0.9.5",
"version": "0.10.0",
"description": "Yeoman generator for AngularJS",
"keywords": [
"yeoman-generator",
Expand Down
34 changes: 12 additions & 22 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,30 +204,13 @@ To output JavaScript files, even if CoffeeScript files exist (the default is to

### Minification Safe

**Removed**

[Related Issue #452](https://github.com/yeoman/generator-angular/issues/452): This option has been removed from the generator. Initially it was needed as ngMin was not entirely stable. As it has matured, the need to keep separate versions of the script templates has led to extra complexity and maintenance of the generator. By removing these extra burdens, new features and bug fixes should be easier to implement. If you are dependent on this option, please take a look at ngMin and seriously consider implementing it in your own code. It will help reduce the amount of typing you have to do (and look through) as well as make your code cleaner to look at.
**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 `ngmin`, a tool that automatically adds these annotations. However, if you'd rather not use `ngmin`, you have to add these annotations manually yourself. **One thing to note is that `ngmin` does not produce minsafe code for things that are not main level elements like controller, services, providers, etc.:

```javascript
resolve: {
User: function(myService) {
return MyService();
}
}
```

will need to be manually done like so:
```javascript
resolve: {
User: ['myService', function(myService) {
return MyService();
}]
}
```
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
Expand All @@ -253,8 +236,10 @@ 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

Expand All @@ -277,6 +262,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 angular [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() {
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
14 changes: 7 additions & 7 deletions templates/common/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<div class="container">
<div class="header">
<ul class="nav nav-pills pull-right">
<li class="active"><a ng-href="#">Home</a></li>
<li><a ng-href="<% if (ngRoute) { %>#/about<% } else { %>#<% } %>">About</a></li>
<li><a ng-href="#">Contact</a></li>
<li class="active"><a ng-href="#/">Home</a></li>
<li><a ng-href="<% if (ngRoute) { %>#/about<% } else { %>#/<% } %>">About</a></li>
<li><a ng-href="#/">Contact</a></li>
</ul>
<h3 class="text-muted"><%= appname %></h3>
</div>
Expand All @@ -44,10 +44,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 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
7 changes: 2 additions & 5 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 All @@ -175,9 +175,6 @@ module.exports = function (grunt) {

// Automatically inject Bower components into the app
wiredep: {
options: {
cwd: '<%%= yeoman.app %>'
},
app: {
src: ['<%%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
Expand Down Expand Up @@ -383,7 +380,7 @@ module.exports = function (grunt) {
'*.html',
'views/{,*/}*.html',
'images/{,*/}*.{webp}',
'fonts/*'
'fonts/{,*/}*.*'
]
}, {
expand: true,
Expand Down
30 changes: 16 additions & 14 deletions templates/common/root/_bower.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{<% var ngVer = "1.2.23" %>
{<% var ngVer = "1.3.0" %>
"name": "<%= _.slugify(_.humanize(appname)) %>",
"version": "0.0.0",
"dependencies": {
"angular": "<%= ngVer %>",
"json3": "~3.3.1",
"es5-shim": "~3.1.0"<% if (bootstrap) { %>,<% if (!compassBootstrap) { %>
"bootstrap": "~3.2.0"<% } else { %>
"bootstrap-sass-official": "~3.2.0"<% } } %><% if (resourceModule) { %>,
"angular-resource": "<%= ngVer %>"<% } %><% if (cookiesModule) { %>,
"angular-cookies": "<%= ngVer %>"<% } %><% if (sanitizeModule) { %>,
"angular-sanitize": "<%= ngVer %>"<% } %><% if (animateModule) { %>,
"angular-animate": "<%= ngVer %>"<% } %><% if (touchModule) { %>,
"angular-touch": "<%= ngVer %>"<% } %><% if (routeModule) { %>,
"angular-route": "<%= ngVer %>"<% } %>
"angular": "^<%= ngVer %>",
"json3": "^3.3.0",
"es5-shim": "^4.0.0"<% if (bootstrap) { %>,<% if (!compassBootstrap) { %>
"bootstrap": "^3.2.0"<% } else { %>
"bootstrap-sass-official": "^3.2.0"<% } } %><% if (animateModule) { %>,
"angular-animate": "^<%= ngVer %>"<% } %><% if (ariaModule) { %>,
"angular-aria": "^<%= ngVer %>"<% } %><% if (cookiesModule) { %>,
"angular-cookies": "^<%= ngVer %>"<% } %><% if (messagesModule) { %>,
"angular-messages": "^<%= ngVer %>"<% } %><% if (resourceModule) { %>,
"angular-resource": "^<%= ngVer %>"<% } %><% if (routeModule) { %>,
"angular-route": "^<%= ngVer %>"<% } %><% if (sanitizeModule) { %>,
"angular-sanitize": "^<%= ngVer %>"<% } %><% if (touchModule) { %>,
"angular-touch": "^<%= ngVer %>"<% } %>
},
"devDependencies": {
"angular-mocks": "<%= ngVer %>",
"angular-scenario": "<%= ngVer %>"
"angular-mocks": "^<%= ngVer %>",
"angular-scenario": "^<%= ngVer %>"
}<% if (appPath) { %>,
"appPath": "<%= appPath %>"<% } %>
}
Loading

0 comments on commit cd420f7

Please sign in to comment.