Skip to content

Commit 68c9344

Browse files
Merge pull request #158 from mean-expert-official/development
Release 2.1.0-beta.11 🚀
2 parents adaca80 + a617221 commit 68c9344

File tree

24 files changed

+227
-84
lines changed

24 files changed

+227
-84
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
language: node_js
2+
node_js:
3+
- "6"

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
This file is created to keep history of the LoopBack SDK Builder, it does not consider or keeps any history of its parent module `loopback-sdk-angular`.
44

5+
## Release 2.1.0-beta.11
6+
7+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/157
8+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/155
9+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/154
10+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/153
11+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/152
12+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/151
13+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/148
14+
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/147
15+
516
## Release 2.1.0-beta.10
617

718
- Fix: https://github.com/mean-expert-official/loopback-sdk-builder/issues/142

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
[![Build Status](https://travis-ci.org/mean-expert-official/loopback-sdk-builder.svg?branch=development)](https://travis-ci.org/mean-expert-official/loopback-sdk-builder)
2+
13
![LoopBack SDK Builder](https://storage.googleapis.com/mean-expert-images/sdk-builder.jpg)
24

3-
LoopBack SDK Builder
5+
LoopBack SDK Builder
46
==================
57

8+
69
The [@mean-expert/loopback-sdk-builder](https://www.npmjs.com/package/@mean-expert/loopback-sdk-builder) is a community driven module forked from the official `loopback-sdk-angular` and refactored to support [Angular 2](http://angular.io).
710

811
The [LoopBack SDK Builder](https://www.npmjs.com/package/@mean-expert/loopback-sdk-builder) will explore your [LoopBack Application](http://loopback.io) and will automatically build everything you need to start writing your [Angular 2 Applications](http://angular.io) right away. From Interfaces and Models to API Services and Real-time communications.

bin/lb-sdk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ console.log(chalk.green('* CONTRIBUTORS
5353
console.log(chalk.green('* João Ribeiro <http://jonnybgod.ghost.io> *'));
5454
console.log(chalk.green('* Nikolay Matiushenkov <https://github.com/mnvx> *'));
5555
console.log(chalk.green('* Sylvain Dumont <https://www.weboaks.com> *'));
56+
console.log(chalk.green('* Yonggang Luo <https://github.com/lygstate> *'));
5657
console.log(chalk.green('* *'));
5758
console.log(chalk.green('* ORIGINALLY FORKED FROM *'));
5859
console.log(chalk.green('* Miroslav Bajtos\' <[email protected]> *'));

lib/angular2/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ module.exports = function generate(ctx) {
403403
{ module: 'ErrorHandler', from: './error.service'},
404404
{ module: 'LoopBackAuth', from: './auth.service'},
405405
{ module: 'LoopBackConfig', from: '../../lb.config'},
406-
{ module: 'AccessToken', from: '../../models'},
406+
{ module: 'AccessToken', from: '../../models/index'},
407407
{ module: 'Observable', from: 'rxjs/Observable' },
408408
{ module: 'ErrorObservable', from: 'rxjs/observable/ErrorObservable' },
409409
{ module: 'rxjs/add/operator/catch' },
@@ -505,7 +505,7 @@ module.exports = function generate(ctx) {
505505
* Testing if the param is route type
506506
*/
507507
function paramIsRoute(param) {
508-
return (param.http && param.http.source === 'path') || (param.arg && param.arg.match(/(id|fk|file|container)/));
508+
return (param.http && param.http.source === 'path') || (param.arg && param.arg.match(/(^id$|fk|file|container)/));
509509
}
510510
/**
511511
* @method paramIsFunction

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
{
22
"name": "@mean-expert/loopback-sdk-builder",
3-
"version": "2.1.0-beta.10",
3+
"version": "2.1.0-beta.11",
44
"description": "Tool for auto-generating Software Development Kits (SDKs) for LoopBack",
55
"bin": {
66
"lb-sdk": "bin/lb-sdk"
77
},
88
"main": "index.js",
99
"scripts": {
1010
"prepublish": "",
11-
"test": "npm run test:angular2",
12-
"pretest": "cd tests/angular2 && npm install",
13-
"test:angular2": "cd tests/angular2 && ng lint && npm run test"
11+
"test": "npm run load:api & npm run test:angular2",
12+
"pretest": "cd tests/angular2 && npm install && npm install ../../ && npm run build:sdk",
13+
"load:api": "cd tests/angular2 && NODE_ENV=testing node loopback/server",
14+
"test:angular2": "cd tests/angular2 && npm test"
1415
},
1516
"repository": {
1617
"type": "git",
@@ -44,6 +45,11 @@
4445
"name": "Sylvain Dumont",
4546
"email": "[email protected]",
4647
"url": "https://www.weboaks.com"
48+
},
49+
{
50+
"name": "Yonggang Luo",
51+
"email": "[email protected]",
52+
"url": "https://github.com/lygstate"
4753
}
4854
],
4955
"license": "MIT",
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# How to contribute
2+
3+
I'm really glad you're reading this, volunteer developers to help this project are always welcome.
4+
5+
If you haven't already, follow me ([@johncasarrubias](irc://chat.freenode.net/opengovernment) on twitter). I want you to keep informed about new features and tutorials.
6+
7+
Here are some important resources:
8+
9+
* [MEAN Expert Blog](http://mean.expert) tutorials about the MEAN Stack.
10+
* [WIKI](https://github.com/mean-expert-official/loopback-sdk-builder/wiki) official wiki documentation.
11+
* [Angular 2 Testing](https://angular.io/docs/ts/latest/guide/testing.html) official documentation for testing environment.
12+
* Bugs? [GitHub Issues](https://github.com/mean-expert-official/loopback-sdk-builder/issues) is where to report them
13+
14+
## Testing
15+
16+
Tests are being created and excecuted by using the Angular-CLI Tool, please refer to the official documentation.
17+
18+
````sh
19+
$ cd to/loopback-sdk-builder
20+
$ npm test
21+
````
22+
23+
## Submitting changes
24+
25+
Please send a [GitHub Pull Request](https://github.com/mean-expert-official/loopback-sdk-builder/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)). When you send a pull request, we will love you forever if you include RSpec examples. We can always use more test coverage. Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit).
26+
27+
Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:
28+
29+
$ git commit -m "A brief summary of the commit
30+
>
31+
> A paragraph describing what changed and its impact."
32+
33+
Thanks,
34+
Jonathan Casarrubias, [MEAN Expert](http://mean.expert).

tests/angular2/common/models/room.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,42 @@ module.exports = function (Room) {
1515
}
1616
);
1717

18-
Room.greetPost = greet;
19-
18+
// We receive 3 copies of the body from loopback, not sure why
19+
// I would expect body.a, body.b and body.c in 1 object param.
20+
Room.greetPost = (b1, b2, b3, next) => {
21+
next(null, `${b1.a}:${b2.b}:${b3.c}`);
22+
};
23+
2024
Room.remoteMethod(
2125
'greetPost',
2226
{
2327
accepts: [
24-
{ arg: 'a', type: 'string' },
25-
{ arg: 'b', type: 'string' },
26-
{ arg: 'c', type: 'string' }
28+
{ arg: 'a', type: 'object', http: { source: 'body' }},
29+
{ arg: 'b', type: 'object', http: { source: 'body' }},
30+
{ arg: 'c', type: 'object', http: { source: 'body' }}
2731
],
28-
returns: { arg: 'greeting', type: 'string' },
32+
returns: { arg: 'greeting', type: 'object' },
2933
http: { path: '/who', verb: 'post' }
3034
}
3135
);
3236

37+
Room.singleParamPost = function (body, next) {
38+
next(null, body);
39+
};
40+
41+
Room.remoteMethod(
42+
'singleParamPost',
43+
{
44+
accepts: {
45+
arg: 'param',
46+
type: 'object',
47+
http: { source: 'body' }
48+
},
49+
returns: { arg: 'param', type: 'object', root: true },
50+
http: { path: '/single-param-post', verb: 'post' }
51+
}
52+
);
53+
3354
Room.greetGet = greet;
3455

3556
Room.remoteMethod(

tests/angular2/karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = function (config) {
88
plugins: [
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
11+
require('karma-phantomjs-launcher'),
1112
require('karma-remap-istanbul'),
1213
require('angular-cli/plugins/karma')
1314
],
@@ -32,7 +33,7 @@ module.exports = function (config) {
3233
colors: true,
3334
logLevel: config.LOG_INFO,
3435
autoWatch: true,
35-
browsers: ['Chrome'],
36+
browsers: ['PhantomJS'],
3637
singleRun: false
3738
});
3839
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var net = require('net')
2+
3+
module.exports = function(app) {
4+
if (process.NODE_ENV !== 'testing') return;
5+
var testing = false;
6+
var interval = setInterval(function () {
7+
isPortTaken(9876, function (err, taken) {
8+
if (!testing && taken) testing = true;
9+
if (testing && !taken) process.exit()
10+
})
11+
}, 1000);
12+
};
13+
14+
var isPortTaken = function(port, fn) {
15+
var tester = net.createServer()
16+
.once('error', function (err) {
17+
if (err.code != 'EADDRINUSE') return fn(err)
18+
fn(null, true)
19+
})
20+
.once('listening', function() {
21+
tester.once('close', function() { fn(null, false) })
22+
.close()
23+
})
24+
.listen(port)
25+
}

0 commit comments

Comments
 (0)