Skip to content

Commit b99fd3e

Browse files
committed
* 'canary' of https://github.com/DaftMonk/generator-angular-fullstack: feat(jscs): update to ^2.1.0, rename config file to .jscsrc, use esnext option docs(gen:readme): remove demo chore(npm): grunt-node-inspector ^0.2.0 -> ^0.4.1 Fix typo in readme.md fix(server:config): template db configs and add sequelize prod conf chore(dependencies): require peer-dependant modules directly, per npm 3+ feat(client:admin): use class for AdminController refactor(karma): update file globs, jade preprocessor only when `filters.jade` feat(client:admin): use controllerAs syntax for `AdminController` feat(client:admin): implement admin components as a seperate module chore(travis): add node 4.0.0 to travis targets
2 parents d2929b0 + 85feb4a commit b99fd3e

16 files changed

+97
-56
lines changed

Diff for: .travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ sudo: false
22
language: node_js
33
node_js:
44
- '0.12'
5+
- '4.0.0'
56
env:
67
global:
78
- SAUCE_USERNAME=fullstack_ci
89
- SAUCE_ACCESS_KEY=1a527ca6-4aa5-4618-86ce-0278bf158cbf
10+
matrix:
11+
fast_finish: true
12+
allow_failures:
13+
- node_js: 4.0.0
914
before_install:
1015
- ./scripts/sauce_connect_setup.sh
1116
- gem update --system

Diff for: app/generator.js

+1
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ export default class Generator extends Base {
401401
if(this.filters.uirouter) angModules.push("'ui.router'");
402402
if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'");
403403
if(this.filters.auth) {
404+
angModules.unshift(`'${this.scriptAppName}.admin'`);
404405
angModules.unshift(`'${this.scriptAppName}.auth'`);
405406
angModules.push("'validation.match'");
406407
}

Diff for: app/templates/.jscs.json renamed to app/templates/.jscsrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"esnext": true,
23
"maximumLineLength": {
34
"value": 100,
45
"allowComments": true,

Diff for: app/templates/.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
language: node_js
22
node_js:
33
- '0.12'
4+
- '4.0.0'
5+
matrix:
6+
fast_finish: true
7+
allow_failures:
8+
- node_js: 4.0.0
49
before_script:
510
- npm install -g bower grunt-cli<% if (filters.sass) { %>
611
- gem install sass<% } %>

Diff for: app/templates/Gruntfile(grunt).js

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ module.exports = function (grunt) {
165165

166166
jscs: {
167167
options: {
168-
config: ".jscs.json"
168+
config: ".jscsrc"
169169
},
170170
main: {
171171
files: {

Diff for: app/templates/_package.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,20 @@
9595
"grunt-contrib-jshint": "~0.11.2",
9696
"grunt-contrib-uglify": "^0.9.1",
9797
"grunt-contrib-watch": "~0.6.1",<% if (filters.jade) { %>
98-
"grunt-contrib-jade": "^0.15.0",<% } %><% if (filters.less) { %>
98+
"grunt-contrib-jade": "^0.15.0",
99+
"karma-ng-jade2js-preprocessor": "^0.2.0",<% } %><% if (filters.less) { %>
99100
"grunt-contrib-less": "^1.0.0",<% } %><% if(filters.babel) { %>
100101
"karma-babel-preprocessor": "^5.2.1",<% } %>
101102
"grunt-babel": "~5.0.0",
102103
"grunt-google-cdn": "~0.4.0",
103-
"grunt-jscs": "^2.0.0",
104+
"grunt-jscs": "^2.1.0",
104105
"grunt-newer": "^1.1.1",
105106
"grunt-ng-annotate": "^1.0.1",
106107
"grunt-ng-constant": "^1.1.0",
107108
"grunt-filerev": "^2.3.1",
108109
"grunt-usemin": "^3.0.0",
109110
"grunt-env": "~0.4.1",
110-
"grunt-node-inspector": "^0.2.0",
111+
"grunt-node-inspector": "^0.4.1",
111112
"grunt-nodemon": "^0.4.0",
112113
"grunt-angular-templates": "^0.5.4",
113114
"grunt-dom-munger": "^3.4.0",
@@ -129,6 +130,8 @@
129130
"connect-livereload": "^0.5.3",
130131
"mocha": "^2.2.5",
131132
"istanbul": "^0.3.17",
133+
"chai": "^3.2.0",
134+
"sinon": "^1.16.1",
132135
"chai-as-promised": "^5.1.0",
133136
"chai-things": "^0.2.0",
134137
"sinon-chai": "^2.8.0",<% if (filters.mocha) { %>
@@ -142,11 +145,11 @@
142145
"karma-firefox-launcher": "~0.1.6",
143146
"karma-script-launcher": "~0.1.0",
144147
"karma-html2js-preprocessor": "~0.1.0",
145-
"karma-ng-jade2js-preprocessor": "^0.2.0",
146148
"karma-chrome-launcher": "~0.2.0",
147149
"requirejs": "~2.1.11",
148150
"karma-requirejs": "~0.2.2",
149151
"karma-jade-preprocessor": "0.0.11",
152+
"phantomjs": "^1.9.18",
150153
"karma-phantomjs-launcher": "~0.2.0",
151154
"karma": "~0.13.3",
152155
"karma-ng-html2js-preprocessor": "~0.1.2",

Diff for: app/templates/client/app/admin(auth)/admin(html).html

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<div class="container">
44
<p>The delete user and user index api routes are restricted to users with the 'admin' role.</p>
55
<ul class="list-group">
6-
<li class="list-group-item" ng-repeat="user in users">
6+
<li class="list-group-item" ng-repeat="user in admin.users">
77
<strong>{{user.name}}</strong><br>
88
<span class="text-muted">{{user.email}}</span>
9-
<a ng-click="delete(user)" class="trash"><span class="glyphicon glyphicon-trash pull-right"></span></a>
9+
<a ng-click="admin.delete(user)" class="trash"><span class="glyphicon glyphicon-trash pull-right"></span></a>
1010
</li>
1111
</ul>
1212
</div>

Diff for: app/templates/client/app/admin(auth)/admin(jade).jade

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ navbar
33
p
44
| The delete user and user index api routes are restricted to users with the 'admin' role.
55
ul.list-group
6-
li.list-group-item(ng-repeat='user in users')
6+
li.list-group-item(ng-repeat='user in admin.users')
77
strong {{user.name}}
88
br
99
span.text-muted {{user.email}}
10-
a.trash(ng-click='delete(user)')
10+
a.trash(ng-click='admin.delete(user)')
1111
span.glyphicon.glyphicon-trash.pull-right
+16-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
'use strict';
22

3-
angular.module('<%= scriptAppName %>')
4-
.controller('AdminCtrl', function($scope, $http, Auth, User) {
3+
(function() {
54

5+
class AdminController {
6+
7+
constructor(User) {
68
// Use the User $resource to fetch all users
7-
$scope.users = User.query();
9+
this.users = User.query();
10+
}
11+
12+
delete(user) {
13+
user.$remove();
14+
this.users.splice(this.users.indexOf(user), 1);
15+
}
16+
}
17+
18+
angular.module('<%= scriptAppName %>.admin')
19+
.controller('AdminController', AdminController);
820

9-
$scope.delete = function(user) {
10-
User.remove({ id: user._id });
11-
$scope.users.splice(this.$index, 1);
12-
};
13-
});
21+
})();

Diff for: app/templates/client/app/admin(auth)/admin.module.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
angular.module('<%= scriptAppName %>.admin', [
4+
'<%= scriptAppName %>.auth'<% if (filters.ngroute) { %>,
5+
'ngRoute'<% } if (filters.uirouter) { %>,
6+
'ui.router'<% } %>
7+
]);
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
'use strict';
22

3-
angular.module('<%= scriptAppName %>')
3+
angular.module('<%= scriptAppName %>.admin')
44
<% if (filters.ngroute) { %>.config(function($routeProvider) {
55
$routeProvider
66
.when('/admin', {
77
templateUrl: 'app/admin/admin.html',
8-
controller: 'AdminCtrl',
8+
controller: 'AdminController',
9+
controllerAs: 'admin',
910
authenticate: 'admin'
1011
});
11-
});<% } %><% if (filters.uirouter) { %>.config(function($stateProvider) {
12+
});<% } if (filters.uirouter) { %>.config(function($stateProvider) {
1213
$stateProvider
1314
.state('admin', {
1415
url: '/admin',
1516
templateUrl: 'app/admin/admin.html',
16-
controller: 'AdminCtrl',
17+
controller: 'AdminController',
18+
controllerAs: 'admin',
1719
authenticate: 'admin'
1820
});
1921
});<% } %>

Diff for: app/templates/karma.conf.js

+8-15
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,25 @@ module.exports = function(config) {
2222
// endbower<% if (filters.socketio) { %>
2323
'node_modules/socket.io-client/socket.io.js',<% } %>
2424
'client/app/app.js',
25-
'client/app/**/*.js',
26-
'client/components/**/*.js',
27-
'client/app/**/*.jade',
28-
'client/components/**/*.jade',
29-
'client/app/**/*.html',
30-
'client/components/**/*.html'
25+
'client/{app,components}/**/*.module.js',
26+
'client/{app,components}/**/*.js',
27+
'client/{app,components}/**/*.<%= filters.jade ? '{jade,html}' : 'html' %>'
3128
],
3229

3330
preprocessors: {
34-
'**/*.jade': 'ng-jade2js',
35-
'**/*.html': 'html2js',<% if(filters.babel) { %>
31+
'**/*.html': 'html2js'<% if (filters.jade) { %>,
32+
'**/*.jade': 'ng-jade2js'<% } if (filters.babel) { %>,
3633
'client/{app,components}/**/*.js': 'babel'<% } %>
3734
},
3835

3936
ngHtml2JsPreprocessor: {
4037
stripPrefix: 'client/'
41-
},
38+
},<% if (filters.jade) { %>
4239

4340
ngJade2JsPreprocessor: {
4441
stripPrefix: 'client/'
45-
},
42+
},<% } if (filters.babel) { %>
4643

47-
<% if(filters.babel) { %>
4844
babelPreprocessor: {
4945
options: {
5046
sourceMap: 'inline'
@@ -55,8 +51,7 @@ module.exports = function(config) {
5551
sourceFileName: function (file) {
5652
return file.originalPath;
5753
}
58-
},
59-
<% } %>
54+
},<% } %>
6055

6156
// list of files / patterns to exclude
6257
exclude: [],
@@ -80,7 +75,6 @@ module.exports = function(config) {
8075
// enable / disable watching file and executing tests whenever any file changes
8176
autoWatch: false,
8277

83-
8478
// Start these browsers, currently available:
8579
// - Chrome
8680
// - ChromeCanary
@@ -91,7 +85,6 @@ module.exports = function(config) {
9185
// - IE (only Windows)
9286
browsers: ['PhantomJS'],
9387

94-
9588
// Continuous Integration mode
9689
// if true, it capture browsers, run tests and exit
9790
singleRun: false

Diff for: app/templates/server/config/environment/development.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
// Development specific configuration
44
// ==================================
5-
module.exports = {
5+
module.exports = {<% if (filters.mongoose) { %>
6+
67
// MongoDB connection options
78
mongo: {
89
uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-dev'
9-
},
10+
},<% } if (filters.sequelize) { %>
11+
12+
// Sequelize connecton opions
1013
sequelize: {
1114
uri: 'sqlite://',
1215
options: {
@@ -16,7 +19,9 @@ module.exports = {
1619
timestamps: false
1720
}
1821
}
19-
},
22+
},<% } %>
2023

24+
// Seed database on startup
2125
seedDB: true
26+
2227
};

Diff for: app/templates/server/config/environment/production.js

+24-12
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,33 @@
44
// =================================
55
module.exports = {
66
// Server IP
7-
ip: process.env.OPENSHIFT_NODEJS_IP ||
8-
process.env.IP ||
9-
undefined,
7+
ip: process.env.OPENSHIFT_NODEJS_IP ||
8+
process.env.IP ||
9+
undefined,
1010

1111
// Server port
12-
port: process.env.OPENSHIFT_NODEJS_PORT ||
13-
process.env.PORT ||
14-
8080,
12+
port: process.env.OPENSHIFT_NODEJS_PORT ||
13+
process.env.PORT ||
14+
8080<% if (filters.mongoose) { %>,
1515

1616
// MongoDB connection options
1717
mongo: {
18-
uri: process.env.MONGOLAB_URI ||
19-
process.env.MONGOHQ_URL ||
20-
process.env.OPENSHIFT_MONGODB_DB_URL +
21-
process.env.OPENSHIFT_APP_NAME ||
22-
'mongodb://localhost/<%= lodash.slugify(appname) %>'
23-
}
18+
uri: process.env.MONGOLAB_URI ||
19+
process.env.MONGOHQ_URL ||
20+
process.env.OPENSHIFT_MONGODB_DB_URL +
21+
process.env.OPENSHIFT_APP_NAME ||
22+
'mongodb://localhost/<%= lodash.slugify(appname) %>'
23+
}<% } if (filters.sequelize) { %>,
24+
25+
sequelize: {
26+
uri: process.env.SEQUELIZE_URI ||
27+
'sqlite://',
28+
options: {
29+
logging: false,
30+
storage: 'dist.sqlite',
31+
define: {
32+
timestamps: false
33+
}
34+
}
35+
}<% } %>
2436
};

Diff for: readme.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
## Example project
1414

15-
Generated with defaults: http://fullstack-demo.herokuapp.com/.
16-
1715
Source code: https://github.com/DaftMonk/fullstack-demo
1816

1917
## Usage
@@ -442,7 +440,7 @@ See the [contributing docs](https://github.com/DaftMonk/generator-angular-fullst
442440

443441
This project has 2 main branches: `master` and `canary`. The `master` branch is where the current stable code lives and should be used for production setups. The `canary` branch is the main development branch, this is where PRs should be submitted to (backport fixes may be applied to `master`).
444442

445-
By seperating the current stable code from the cutting-edge development we hope to provide a stable and efficient workflow for users and developers alike.
443+
By separating the current stable code from the cutting-edge development we hope to provide a stable and efficient workflow for users and developers alike.
446444

447445
When submitting an issue, please follow the [guidelines](https://github.com/yeoman/yeoman/blob/master/contributing.md#issue-submission). Especially important is to make sure Yeoman is up-to-date, and providing the command or commands that cause the issue.
448446

Diff for: test/test-file-creation.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ describe('angular-fullstack generator', function () {
213213
'.gitattributes',
214214
'.gitignore',
215215
'.travis.yml',
216-
'.jscs.json',
216+
'.jscsrc',
217217
'.yo-rc.json',
218218
'Gruntfile.js',
219219
'package.json',
@@ -268,7 +268,8 @@ describe('angular-fullstack generator', function () {
268268
'client/app/account/signup/signup.controller.' + script,
269269
'client/app/admin/admin.' + markup,
270270
'client/app/admin/admin.' + stylesheet,
271-
'client/app/admin/admin.' + script,
271+
'client/app/admin/admin.module.' + script,
272+
'client/app/admin/admin.router.' + script,
272273
'client/app/admin/admin.controller.' + script,
273274
'client/components/auth/auth.module.' + script,
274275
'client/components/auth/auth.service.' + script,

0 commit comments

Comments
 (0)