-
Notifications
You must be signed in to change notification settings - Fork 175
1. Install Builder & Build SDK
The @mean-expert/loopback-sdk-builder should be installed using NPM as follows:
$ cd to/loopback/project
$ npm install --save @mean-expert/{loopback-component-realtime,loopback-sdk-builder}
The @mean-expert/loopback-sdk-builder provides you with a built-in command line tool that allows you to build Software Development Kits fully compatible with Angular 2 Applications written in TypeScript Language.
Since Angular 2 is able to run in different environments, you will need to configure the @mean-expert/loopback-sdk-builder according your environment and the following configuration options.
$ cd to/loopback/project
$ ./node_modules/.bin/lb-sdk
******************************************* LoopBack SDK Builder 2.0 *******************************************
Generate Client SDK for your LoopBack Application.
Usage:
./node_modules/.bin/lb-sdk server/server app/shared/sdk -d [ng2web | ng2native | ng2universal] -i [enabled | disabled] -v [enabled | strict | disabled]
Options:
-l, --library Client's library (angular2, react <todo>, ...) [default: "angular2"]
-d, --driver Platform specific drivers (ng2web, ng2native, ng2universal) [default: "ng2web"]
-i, --io Enable PubSub, IO and FireLoop functionality [default: "enabled"]
-w, --wipe Automatically wipe SDK Directory [default: "disabled"]
-v, Add default values in models [default: "disabled"]
-f Generate only FireLoop SDK + Auth Services [default: "disabled"]
The @mean-expert/loopback-sdk-builder will wipe everything inside the path/to/sdk
directory you define, please make sure you always point to app/shared/sdk
and not to other critical directories where you don't want to lose any information.
The default options will create an Angular 2 SDK for Web.
$ ./node_modules/.bin/lb-sdk server/server.js /path/to/client/sdk
Is equivalent to
$ ./node_modules/.bin/lb-sdk server/server.js /path/to/client/sdk -l angular2 -d ng2web -i disabled
$ ./node_modules/.bin/lb-sdk server/server.js /path/to/client/sdk -d ng2native
Is equivalent to
$ ./node_modules/.bin/lb-sdk server/server.js /path/to/client/sdk -l angular2 -d ng2native -i disabled
To enable you will need to add the --io enabled
or -i enabled
flag.
$ ./node_modules/.bin/lb-sdk server/server.js /path/to/client/sdk -d ng2web -i enabled
$ ./node_modules/.bin/lb-sdk server/server.js /path/to/client/sdk -d ng2native -i enabled
Add a script within package.json
{
"scripts": {
"build:sdk": "./node_modules/.bin/lb-sdk server/server path/to/ng2-app/src/app/shared/sdk -d [ng2web | ng2native | ng2universal] -i [enabled | disabled]"
}
}
$ cd to/loopback/project
$ npm run build:sdk