Giter VIP home page Giter VIP logo

loopback-cli's Introduction

loopback-cli

LoopBack CLI tool for creating projects, models and more. This package supersedes the older slc tool.

⚠️ LoopBack 3 has reached end of life. We are no longer accepting pull requests or providing support for community users. The only exception is fixes for critical bugs and security vulnerabilities provided as part of support for IBM API Connect customers. (See Module Long Term Support Policy below.)

We urge all LoopBack 3 users to migrate their applications to LoopBack 4 as soon as possible. Refer to our Migration Guide for more information on how to upgrade.

Installation

To install the LoopBack CLI tool:

$ npm install -g loopback-cli

Use

Getting started

  1. Run lb [appName] to create a new LoopBack application.
  2. Run node . to start the scaffolded server.

What's next

Run lb -l to list all available commands:

$ lb -l
Available commands:
  lb acl
  lb app
  lb boot-script
  lb bluemix
  lb datasource
  lb export-api-def
  lb middleware
  lb model
  lb property
  lb relation
  lb remote-method
  lb soap
  lb swagger
  lb zosconnectee

Run lb <command> --help to learn more about each command. For example:

$ lb model --help
Usage:
  lb model [options] [<name>]

Options:
  -h,   --help          # Print the generator's options and usage
        --skip-cache    # Do not remember prompt answers             Default: false
        --skip-install  # Do not automatically install dependencies  Default: false

Arguments:
  name  # Name of the model to create.  Type: String  Required: false

Description:
  Creates a new Model in the LoopBack application.

Example:

  lb model Product

  This adds an entry to `Product.json` defining the model "Product".

Refer to Create a simple API for more information.

Refer to README_Soap for more information on 'lb soap' command.

Contributing

IBM/StrongLoop is an active supporter of open source and welcomes contributions to our projects as well as those of the Node.js community in general. For more information on how to contribute please refer to the Contribution Guide.

Mailing List

Discuss features and ask questions on LoopBack Forum.

License

MIT

Module Long Term Support Policy

This module adopts the Module Long Term Support (LTS) policy, with the following End Of Life (EOL) dates:

Version Status Published EOL
5.x End-of-Life Nov 2018 Dec 2020
4.x End-of-Life Sep 2017 Dec 2019
3.x End-of-Life Jul 2017 Apr 2019

Learn more about our LTS plan in the docs.

loopback-cli's People

Contributors

achrinza avatar bajtos avatar crandmck avatar crshnburn avatar dhmlau avatar hacksparrow avatar hugopoi avatar jannyhou avatar rashmihunt avatar raymondfeng avatar shimks avatar virkt25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

loopback-cli's Issues

The lb command doesnt honour the options that most examples on the Internet still using slc provide

Feature Request - add command line options to avoid being prompted

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

I have just started using loopback and most of the tutorials I have found seem to have two modes, one using a command called slc (which is deprecated?) and this tool lb. For example, https://strongloop.com/strongblog/postgresql-node-js-apis-loopback-connector/

I'm very used to scripting tasks I repeat or up-arrowing to a prior command , and find it a little unproductive having to answer prompts all the time. I know it remembers answers but I would still be useful to be able to enter a command such as lb datasource accountDB --connector postgresql --quiet and not be prompted to confirm what I just typed. If anyone ever wanted to automated creating a skeleton into docker or a vm they would not be able to do that either

Loopback cli crashing on node 8.1.1 on windows

During loopback-cli installation on windows optional dependecy ursa always fail to install. But, cli works fine on node 6 , but after upgrading to node 8 it hangs on the second input option in model, property,app commands. So, i was forced to downgrade my node version.

Assignment with JS without any use of libraries

Hello,
I have to complete an assignment with JS and since I am a neophyte of programming in JS, if anyone can kindly help me understand how I should proceed.I created a responsive page with 2 columns on Bootstrap, a list of hotels displayed on the left, and when I click on a specific hotel I should see the hotel with info in a panel in the right column. Below I attach the link for the screenshot of how it should look.

Now using JS, without any use of libraries, I must do the following:

*Behavior Page interaction: Each time a user clicks on a hotel name in the list, the information panel should be updated with the hotel's relevant information.

*Data The hotel data is provided via a Dyson mock server. The routes to retrieve the data: * http://localhost:8765/api/hotels/list --> Will respond with the full list of hotels (names and ids) * http://localhost:8765/api/hotels/:id --> Will respond with the full information for the desired hotel.

I leave you the link of my folder, where I did the static page index.html (other files gave them the prof.) And now I have to add the interaction.
link folder and screenshot

Failure to install due to node-gyp

Bug or feature request

  • [ X] Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

Trying to install globally (and I tried to uninstall first) gives an error related to node-gyp:

/usr/bin/lb -> /usr/lib/node_modules/loopback-cli/bin/loopback-cli.js

[email protected] install /usr/lib/node_modules/loopback-cli/node_modules/ursa
node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/loopback-cli/node_modules/ursa/build'
gyp ERR! System Linux 4.4.0-43-Microsoft
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/loopback-cli/node_modules/ursa
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/loopback-cli/node_modules/ursa):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

Expected result

For it not to error. ;)

Actual result (if bug)

See stack trace above.

Additional information (Node.js version, LoopBack version, etc)

Node is v8.

Odd output making a new app

Bug or feature request

  • [ x] Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

I just ran "lb", and before the Yeoman hat man, some odd output was spit out that I've not seen before:

image

It didn't break anything as far as I can tell.

Additional information (Node.js version, LoopBack version, etc)

lb -v returns 1.0.0.
node -v returns 6.9.2.

Not able to install loopback-cli in Ubuntu

Not able to install loopback-cli
Ubuntu 18.04 LTS
Node 10.2.1
Npm 6.1.0

Description/Steps to reproduce

sudo npm install -g loopback-cli

Additional information

redrawlife@redrawlife:~$ npm install -g loopback-cli
npm WARN deprecated [email protected]: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated [email protected]: This project is unmaintained
npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm WARN deprecated [email protected]: This project is unmaintained
/home/redrawlife/.nvm/versions/node/v10.2.1/bin/lb -> /home/redrawlife/.nvm/versions/node/v10.2.1/lib/node_modules/loopback-cli/bin/loopback-cli.js

[email protected] install /home/redrawlife/.nvm/versions/node/v10.2.1/lib/node_modules/loopback-cli/node_modules/ursa
node-gyp rebuild

make: Entering directory '/home/redrawlife/.nvm/versions/node/v10.2.1/lib/node_modules/loopback-cli/node_modules/ursa/build'
CXX(target) Release/obj.target/ursaNative/src/ursaNative.o
../src/ursaNative.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RsaWrap::OpenPublicSshKey(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ursaNative.cc:389:13: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->n = BN_bin2bn(data_n, n_length, NULL);
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:390:13: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->e = BN_bin2bn(data_e, e_length, NULL);
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc: In static member function ‘static RsaWrap* RsaWrap::expectPrivateKey(RsaWrap*)’:
../src/ursaNative.cc:407:35: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
if ((obj == NULL) || (obj->rsa->d != NULL)) {
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RsaWrap::GetExponent(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ursaNative.cc:536:34: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
bignumToBuffer(args, obj->rsa->e);
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RsaWrap::GetPrivateExponent(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ursaNative.cc:552:34: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
bignumToBuffer(args, obj->rsa->d);
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RsaWrap::GetModulus(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ursaNative.cc:567:34: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
bignumToBuffer(args, obj->rsa->n);
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RsaWrap::CreatePrivateKeyFromComponents(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ursaNative.cc:1218:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->n = modulus;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:1219:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->e = exponent;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:1220:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->p = p;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:1221:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->q = q;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:1222:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->dmp1 = dp;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:1223:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->dmq1 = dq;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:1224:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->iqmp = inverseQ;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:1225:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->d = d;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE RsaWrap::CreatePublicKeyFromComponents(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/ursaNative.cc:1270:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->n = modulus;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc:1271:17: error: invalid use of incomplete type ‘RSA {aka struct rsa_st}’
obj->rsa->e = exponent;
^~
In file included from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/crypto.h:31:0,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/bio.h:20,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/asn1.h:16,
from /home/redrawlife/.node-gyp/10.2.1/include/node/openssl/rsa.h:16,
from ../src/ursaNative.h:13,
from ../src/ursaNative.cc:3:
/home/redrawlife/.node-gyp/10.2.1/include/node/openssl/ossl_typ.h:110:16: note: forward declaration of ‘RSA {aka struct rsa_st}’
typedef struct rsa_st RSA;
^~~~~~
../src/ursaNative.cc: At global scope:
../src/ursaNative.cc:100:36: warning: ‘Nan::NAN_METHOD_RETURN_TYPE bignumToBuffer(Nan::NAN_METHOD_ARGS_TYPE, BIGNUM*)’ defined but not used [-Wunused-function]
static Nan::NAN_METHOD_RETURN_TYPE bignumToBuffer(Nan::NAN_METHOD_ARGS_TYPE args,
^~~~~~~~~~~~~~
ursaNative.target.mk:97: recipe for target 'Release/obj.target/ursaNative/src/ursaNative.o' failed
make: *** [Release/obj.target/ursaNative/src/ursaNative.o] Error 1
make: Leaving directory '/home/redrawlife/.nvm/versions/node/v10.2.1/lib/node_modules/loopback-cli/node_modules/ursa/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/redrawlife/.nvm/versions/node/v10.2.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.15.0-22-generic
gyp ERR! command "/home/redrawlife/.nvm/versions/node/v10.2.1/bin/node" "/home/redrawlife/.nvm/versions/node/v10.2.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/redrawlife/.nvm/versions/node/v10.2.1/lib/node_modules/loopback-cli/node_modules/ursa
gyp ERR! node -v v10.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

[email protected] postinstall /home/redrawlife/.nvm/versions/node/v10.2.1/lib/node_modules/loopback-cli/node_modules/spawn-sync
node postinstall

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/loopback-cli/node_modules/ursa):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

node -e 'console.log(process.platform, process.arch, process.versions.node)'
linux x64 10.2.1

Add commands to generate Bluemix artifacts for deployment automation and service bindings

Bug or feature request

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

  1. Refine the sample app as the template for adding Bluemix flavor to LB
  2. Start with yeoman commands to generate manifest.yml
  • lb bluemix:manifest
  1. Generate .bluemix/pipeline.yml, toolchain.yml etc
  • CloudFoundry
  • IBM Container
  1. Deploy to Bluemix & Create ToolChain
  2. Discover/provision Bluemix services
  3. Map Bluemix DB services to LoopBack datasources
  4. More integration such as Auth, Monitoring, ...

Two possible modules:

Link to sample repo to reproduce issue (if bug)

Expected result

Actual result (if bug)

Additional information (Node.js version, LoopBack version, etc)

export-api-def fails with path not a string error

Moved from strongloop/generator-loopback#276
cc @qpresley

Description/Steps to reproduce

Steps to reproduce are very simple. Create a loopback app using the lb CLI, chose the empty server app. When it completes run lb export-api-def -o ./testApp.yaml and you will get the error. Here is the output of my local run

The API Connect team at IBM happily continues to develop,
support and maintain LoopBack, which is at the core of
API Connect. When your APIs need robust management and
security options, please check out http://ibm.biz/tryAPIC

Quentins-MBP:testApp qpresley$ lb export-api-def -o ./testApp.yaml
FILEPATH:  true
events.js:141
      throw er; // Unhandled 'error' event
      ^

TypeError: path must be a string
    at TypeError (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.writeFileSync (fs.js:1156:15)
    at module.exports.yeoman.Base.extend.generate (/Users/qpresley/.nvm/versions/node/v4.7.2/lib/node_modules/loopback-cli/node_modules/generator-loopback/export-api-def/index.js:45:10)
    at Object.<anonymous> (/Users/qpresley/.nvm/versions/node/v4.7.2/lib/node_modules/loopback-cli/node_modules/generator-loopback/node_modules/yeoman-generator/lib/base.js:431:23)
    at /Users/qpresley/.nvm/versions/node/v4.7.2/lib/node_modules/loopback-cli/node_modules/generator-loopback/node_modules/yeoman-generator/node_modules/run-async/index.js:25:25
    at /Users/qpresley/.nvm/versions/node/v4.7.2/lib/node_modules/loopback-cli/node_modules/generator-loopback/node_modules/yeoman-generator/node_modules/run-async/index.js:24:19
    at /Users/qpresley/.nvm/versions/node/v4.7.2/lib/node_modules/loopback-cli/node_modules/generator-loopback/node_modules/yeoman-generator/lib/base.js:432:9
    at processImmediate [as _immediateCallback] (timers.js:396:17)

Installing globally, with Yarn:: warning Error running install script for optional dependency: ...

Description/Steps to reproduce

Installing globally with yarn

yarn global add loopback-cli@latest

produces:

❯ yarn global add loopback-cli@latest
yarn global v0.27.5
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
warning loopback-cli > generator-loopback > loopback-workspace > loopback > [email protected]: All versions below 4.0.1 of
 Nodemailer are deprecated. See https://nodemailer.com/status/
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/2] ⠈ ursa: gyp
[-/2] ⠈ waiting...
[-/2] ⠈ waiting...
[-/2] ⠈ waiting...
warning Error running install script for optional dependency: "C:\\Users\\iachim\\AppData\\Local\\Yarn\\config\\global\\n
ode_modules\\ursa: Command failed.\nExit code: 1\nCommand: C:\\WINDOWS\\system32\\cmd.exe\nArguments: /d /s /c node-gyp r
ebuild\nDirectory: C:\\Users\\iachim\\AppData\\Local\\Yarn\\config\\global\\node_modules\\ursa\nOutput:\nC:\\Users\\iachi
m\\AppData\\Local\\Yarn\\config\\global\\node_modules\\ursa>if not defined npm_config_node_gyp (node \"C:\\Program Files\
\nodejs\\node_modules\\npm\\bin\\node-gyp-bin\\\\..\\..\\node_modules\\node-gyp\\bin\\node-gyp.js\" rebuild )  else (node
 \"\" rebuild ) \r\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | wi
n32 | x64\ngyp info spawn C:\\Python27\\python.EXE\ngyp info spawn args [ 'C:\\\\Program Files\\\\nodejs\\\\node_modules\
\\\npm\\\\node_modules\\\\node-gyp\\\\gyp\\\\gyp_main.py',\ngyp info spawn args   'binding.gyp',\ngyp info spawn args   '
-f',\ngyp info spawn args   'msvs',\ngyp info spawn args   '-G',\ngyp info spawn args   'msvs_version=auto',\ngyp info sp
awn args   '-I',\ngyp info spawn args   'C:\\\\Users\\\\iachim\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_mo
dules\\\\ursa\\\\build\\\\config.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   'C:\\\\Program Files\\\\nodej
s\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\addon.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args
'C:\\\\Users\\\\iachim\\\\.node-gyp\\\\7.10.1\\\\include\\\\node\\\\common.gypi',\ngyp info spawn args   '-Dlibrary=share
d_library',\ngyp info spawn args   '-Dvisibility=default',\ngyp info spawn args   '-Dnode_root_dir=C:\\\\Users\\\\iachim\
\\\.node-gyp\\\\7.10.1',\ngyp info spawn args   '-Dnode_gyp_dir=C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\n
ode_modules\\\\node-gyp',\ngyp info spawn args   '-Dnode_lib_file=node.lib',\ngyp info spawn args   '-Dmodule_root_dir=C:
\\\\Users\\\\iachim\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\ursa',\ngyp info spawn args   '--d
epth=.',\ngyp info spawn args   '--no-parallel',\ngyp info spawn args   '--generator-output',\ngyp info spawn args   'C:\
\\\Users\\\\iachim\\\\AppData\\\\Local\\\\Yarn\\\\config\\\\global\\\\node_modules\\\\ursa\\\\build',\ngyp info spawn arg
s   '-Goutput_dir=.' ]\ngyp info spawn C:\\Program Files (x86)\\MSBuild\\14.0\\bin\\msbuild.exe\ngyp info spawn args [ 'b
uild/binding.sln',\ngyp info spawn args   '/clp:Verbosity=minimal',\ngyp info spawn args   '/nologo',\ngyp info spawn arg
s   '/p:Configuration=Release;Platform=x64' ]\nBuilding the projects in this solution one at a time. To enable parallel b
uild, please add the \"/m\" switch.\r\n  ursaNative.cc\r\n  win_delay_load_hook.cc\r\n..\\src\\ursaNative.cc(157): warnin
g C4244: 'argument': conversion from 'ssize_t' to 'int', possible loss of data [C:\\Users\\iachim\\AppData\\Local\\Yarn\\
config\\global\\node_modules\\ursa\\build\\ursaNative.vcxproj]\r\n..\\src\\ursaNative.cc(172): warning C4244: 'argument':
 conversion from 'ssize_t' to 'int', possible loss of data [C:\\Users\\iachim\\AppData\\Local\\Yarn\\config\\global\\node
_modules\\ursa\\build\\ursaNative.vcxproj]\r\nLINK : fatal error LNK1181: cannot open input file 'C:\\OpenSSL-Win64\\lib\
\libeay32.lib' [C:\\Users\\iachim\\AppData\\Local\\Yarn\\config\\global\\node_modules\\ursa\\build\\ursaNative.vcxproj]\r
\ngyp ERR! build error \ngyp ERR! stack Error: `C:\\Program Files (x86)\\MSBuild\\14.0\\bin\\msbuild.exe` failed with exi
t code: 1\ngyp ERR! stack     at ChildProcess.onExit (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gy
p\\lib\\build.js:276:23)\ngyp ERR! stack     at emitTwo (events.js:106:13)\ngyp ERR! stack     at ChildProcess.emit (even
ts.js:194:7)\ngyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)\ngyp ERR! Syst
em Windows_NT 10.0.14393\ngyp ERR! command \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"C:\\\\Program Files\\\\nodejs\
success Installed "[email protected]" with binaries:
      - lb
warning No license field
Done in 22.81s.

Expected result

It installs with the usual warnings

❯ yarn global add loopback-cli@latest
yarn global v0.27.5
warning package.json: No license field
warning No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
      - lb
warning No license field
Done in ...

Additional information

❯ node -e 'console.log(process.platform, process.arch, process.versions.node, process.versions.yarn)'
win32 x64 7.10.1

❯ npm -v
4.2.0

❯ yarn --version
0.27.5

CLI prints "cf login" message even when don't use --bluemix

Bug or feature request

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

After updating loopback-cli, now when I do any of lb app, lb model, orlb datasource I get the info message:

Please use `cf login` to log into Bluemix first.

Even if I don't use --bluemix.

Also, the same thing happens with lb bluemix. For all these commands, it displays this message even if you are just getting CLI help with -h.
@hacksparrow @raymondfeng

Add a version number

  • Bug
  • [x ] Feature request

Description of feature (or steps to reproduce if bug)

Add a way to display the current version.

lb -v

Error in installation

Description/Steps to reproduce

Not able to install loopback-cli by using the command sudo npm i -g loopback-cli

Link to reproduction sandbox

sudo npm i -g loopback-cli

Expected result

Its not installing

Additional information

Terminal is going in a installation loop, following is the error

gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/loopback-cli/node_modules/ursa/.node-gyp/8.6.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/loopback-cli/node_modules/ursa/.node-gyp" gyp verb tmpdir == cwd automatically will remove dev files after to save disk space gyp verb command install [ '8.6.0' ] ^Cgyp verb install input version string "8.6.0" gyp verb install installing version: 8.6.0 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version not already installed, continuing with install 8.6.0 gyp verb ensuring nodedir is created /usr/local/lib/node_modules/loopback-cli/node_modules/ursa/.node-gyp/8.6.0

System
Mac OSX - 10.13.1
Node version - 8.6.0

Can't install loopback cli

Hi dear

I am new in loopback cli.
Now I am going to install cli of loopback but I got error and can't fix it.
Of course I searched google and stackoverflow but no answer there.
My os is win10
When install cli I got follow errors
http://prntscr.com/k7bhs1
Looking for your help.

Thanks

Loopback CLI crashing with type error

Description/Steps to reproduce

I'm trying to create a new model with the CLI.
The bug came up after I started creating a new LB app inside a directory that already contained an app. I exited out of the app creation process by pressing CTRL-C. After that, the cli keeps crashing no matter what I try to do.

Link to reproduction sandbox

CLI issue, no sandbox available.

Expected result

Model creation succeeds.

Additional information

Stacktrace:

(node:15216) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'type' of undefined
    at C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\objects\choices.js:16:13
    at Array.map (<anonymous>)
    at new module.exports (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\objects\choices.js:15:26)
    at Prompt.module.exports (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\prompts\base.js:43:24)
    at new Prompt (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\prompts\list.js:26:8)
    at module.exports.PromptUI.fetchAnswer (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\ui\prompt.js:77:16)
    at tryCatcher (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:63:31)
    at InnerObserver.Rx.FlatMapObservable.InnerObserver.next (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:2140:43)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.tryCatcher (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:63:31)
    at AutoDetachObserverPrototype.next (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:5883:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.next (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:3547:65)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.tryCatcher (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:63:31)
    at AutoDetachObserverPrototype.next (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:5883:51)
(node:15216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:15216) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


events.js:183
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'type' of undefined
    at C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\objects\choices.js:16:13
    at Array.map (<anonymous>)
    at new module.exports (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\objects\choices.js:15:26)
    at Prompt.module.exports (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\prompts\base.js:43:24)
    at new Prompt (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\prompts\list.js:26:8)
    at module.exports.PromptUI.fetchAnswer (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\inquirer\lib\ui\prompt.js:77:16)
    at tryCatcher (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:63:31)
    at InnerObserver.Rx.FlatMapObservable.InnerObserver.next (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:2140:43)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.tryCatcher (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:63:31)
    at AutoDetachObserverPrototype.next (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:5883:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.next (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:3547:65)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:1762:31)
    at InnerObserver.tryCatcher (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:63:31)
    at AutoDetachObserverPrototype.next (C:***\***\***\***\***\node_modules\loopback-cli\node_modules\rx\dist\rx.js:5883:51)

node -e 'console.log(process.platform, process.arch, process.versions.node)' output:
win32 x64 8.11.1

npm ls --prod --depth 0 | grep loopback output:

Problem at command prompt when create app loopback

Hello,
After typing "slc loopback" to start the scaffolding of my design, my keyboard locks up, does not type it anymore, it does not allow me to continue compiling the remaining fields, only takes the name and then does not type anything .

How can I fix it?

immagine

SOAP generator crashes if user hits ENTER when no operations are selected

$ lb -v
2.2.0 ([email protected] [email protected])

$ lb soap
? Enter the WSDL url or file path: http://www.webservicex.net/periodictable.asmx?WSDL
? Select the service: periodictable
? Select the binding: periodictableSoap
? Select operations to be generated: (Press <space> to select, <a> to toggle all, <i> to inverse selec
tion)
events.js:141
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'definitions' of undefined
    at getOperations (/usr/local/lib/node_modules/loopback-cli/node_modules/loopback-soap/lib/codegen/generator-soap.js:334:20)
...

Since you just hit ENTER at the other prompts to choose the default, it's easy for user to keep doing that and crash the CLI.

CLI should handle this and instead of crashing print message like:

Please select at least one operation.

It would also be nice to select the first operation by default so the user choose that by hitting ENTER.

@rashmihunt

loopback cli doesnt work globally

Description/Steps to reproduce

However when I try to run the command lb it says

The program 'lb' is currently not installed. You can install it by typing:
sudo apt install live-build

If i go to the shared library and run lb using ./lb it works, i am not sure if I shoud move the directories to /opt and then try, please help

Not able to install loopback-cli in ubuntu 17.10

Description/Steps to reproduce

Link to reproduction sandbox

Expected result

Additional information

version linux x64 9.5.0

9956 silly extract ajv@^5.1.0 extracted to /home/kailash/.npm-global/lib/node_modules/.staging/ajv-e4825714 (1062ms)
9957 silly extract [email protected] extracted to /home/kailash/.npm-global/lib/node_modules/.staging/lodash-89021040 (1172ms)
9958 silly extract lodash@^3.10.0 extracted to /home/kailash/.npm-global/lib/node_modules/.staging/lodash-1199bfc9 (1394ms)
9959 verbose stack Error [ERR_STREAM_WRITE_AFTER_END]: write after end
9959 verbose stack at writeAfterEnd (_stream_writable.js:237:12)
9959 verbose stack at PassThrough.Writable.write (_stream_writable.js:287:5)
9959 verbose stack at PassThrough.Writable.end (_stream_writable.js:573:10)
9959 verbose stack at ReadEntry.entry.on (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41)
9959 verbose stack at ReadEntry.emit (events.js:165:20)
9959 verbose stack at ReadEntry.emit (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
9959 verbose stack at ReadEntry.[maybeEmitEnd] (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:249:12)
9959 verbose stack at ReadEntry.end (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:162:27)
9959 verbose stack at Unpack.[consumeBody] (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13)
9959 verbose stack at Unpack.[consumeChunkSub] (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40)
9959 verbose stack at Unpack.[consumeChunk] (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/lib/parse.js:362:30)
9959 verbose stack at Unzip.(anonymous function).on.chunk (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59)
9959 verbose stack at Unzip.emit (events.js:160:13)
9959 verbose stack at Unzip.emit (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
9959 verbose stack at Unzip.write (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:99:17)
9959 verbose stack at Unzip.write (/home/kailash/.npm-global/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
9960 verbose cwd /home/kailash
9961 verbose Linux 4.13.0-38-generic
9962 verbose argv "/home/kailash/.npm-global/lib/node_modules/node/bin/node" "/home/kailash/.npm-global/bin/npm" "install" "-g" "loopback-cli"
9963 verbose node v9.5.0
9964 verbose npm v6.0.0
9965 error code ERR_STREAM_WRITE_AFTER_END
9966 error write after end
9967 verbose exit [ 1, true ]

loopback:export-api-def hangs

URL of the page

https://github.com/strongloop/loopback.io/blob/gh-pages/pages/en/lb2/API-definition-generator.md

Nature of the issue

Whenever im generating the definition, the cli hangs and never finish execution.
command: slc loopback:export-api-def --json -o client/models.json

File exported seems good.

Expected behavior

CLI should close after generating the export.

Actual behavior

CLI stay waiting. This happens when i use the -o option or not.

Suggested resolution

Check if task is finish?

NOTE: Moved from loopbackio/loopback.io#443 opened by @dvelasquez

How to install Angular SDK with new CLI

I don't believe this CLI package will install the lb-ng tool, as the strongloop package does.
So, do we simply tell people to do npm i loopback-sdk-angular or what? Will that even work?

@bajtos

lb export-api-def never returns in NodeJS command prompt

Description/Steps to reproduce

Running this command

lb export-api-def -o test.yml

never returns. The file is properly generated, but the command needs to be killed.

Link to reproduction sandbox

I'm not sur how to provide a reproduction sandbox. I'm running on Windows in NodeJS command prompt. Any environment with similar properties should reproduce the issue

$ node -v
v6.11.0
$ npm -v
3.10.10

Expected result

I expect the command to complete without hanging.

Additional information

$ node
> console.log(process.platform, process.arch, process.versions.node)
win32 x64 6.11.0

lb swagger using incorrect configuration directories

Description/Steps to reproduce

I've configured my application using the options passed to loopback-boot so I can separate my models from other pieces of the configuration. The server will start and find all of the configuration files necessary to run.

I also want to use a swagger file and lb swagger to generate the model configurations, but since the default configuration is different from what's passed to loopback-boot, I'm ending up with empty configuration files and mode configuration files in the wrong directories.

Expected result

I'd expect to be able to provide lb swagger with the same configuration directories that I can provide loopback-boot to ensure the models are put in the correct places.

Additional information

It does seem like lb swagger is finding some of the configuration files because the list of models (including ones that already exist in model-config.json) and the list of datasources are correct when prompted to select models and datasources.

output from commands:

darwin x64 8.4.0
├── [email protected]
├── [email protected]

lb --version is not in the CLI help

Bug or feature request

  • [ x] Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

When doing lb -h, you do not see the --version flag documented

Expected result

It should be.

Actual result (if bug)

It isn't.

Bootstrap elements via javascript

I have to make a responsive page where with js (without the use of libraries), i need to retrieve a list of hotels and in a panel i need to view the info of a single hotel.I used bootstrap to make the page resoponsive.

The first thing I did was create the index.html page of how it should be the finished page. Then I created it in the js file, bootstrap elements via javascript + json call.

The problem I have is that the page does not come out responsive, maybe i was wrong js code, i'm a neophyte in this language.

Some suggestions, thank you.

`'use strict';

// Use utils.js functions

const APIendpoint = "http://localhost:8765/api";

/*

  • Process the JSON response and creates in the DOM the list of Hotels presenting them as
  • buttons.
    */

function loadHotels () {

get(APIendpoint+"/hotels").then(function(response) {
    var element;
	var hotels = JSON.parse(response);

    for (var i = 0; i < hotels.length; i++) {
        element = createHTMLElement("button", hotels[i].name);
        element.className = "list-group-item list-group-item-action"; 
		injectHotel("hotels-list", element, hotels[i].id);
    }

}, function(error) {
    throw error;
})

}

/*

  • Creates the container and the image elements and returns the div created.
  • Params:
  • response: Receives a response JSON object with the hotel data.
    */

function generateHotelImage (response) {
var div = createHTMLElement("div");
div.className = "img-hotel col-xs-6 col-sm-4 col-md-4";

// We create the image that will be inside the div just created
var imageUrl = createHTMLElement("img");
imageUrl.src = response.imgUrl;

div.appendChild(imageUrl);

document.getElementById("hotel-info").appendChild(div);

}

/*

  • Creates name and rating elements and inserts them into the DOM.
  • Params:
  • response: Receives a response JSON object with the hotel data.
    */

function generateNameAndRating (response) {
var nameHotel = createHTMLElement("div");
nameHotel.className = "name-hotel col-xs-6 col-sm-8 col-md-8";

var nameAndRatingDiv = createHTMLElement("div");
nameAndRatingDiv.className = "hotel-name";

nameHotel.appendChild(nameAndRatingDiv);

// We generate the individual items
var name = createHTMLElement("p",response.name);

nameAndRatingDiv.appendChild(name);

var rating = createHTMLElement("div");
rating.className = "ratings-"+response.rating;

nameAndRatingDiv.appendChild(rating);

return nameHotel

}

/*

  • Creates the hotel information panel elements and inserts them into the DOM.

  • Params:

  • response: Receives a response JSON object with the hotel data.
    */
    /
    function generateHotelInfoPanel (response) {
    var hotelInfoDiv = createHTMLElement("div");
    hotelInfoDiv.className = "row";

    // We create the div that will contain name and rating of the hotel
    var nameAndRating = generateNameAndRating(response);

    hotelInfoDiv.appendChild(nameAndRating);

    // Now we generate the price div
    var priceDiv = createHTMLElement("div");
    priceDiv.className = "price-hotel";

    // We generate the price and text
    var price = createHTMLElement("p","£"+response.price.toFixed(2));

    var totalText = createHTMLElement("p","Total hotel stay");

    priceDiv.appendChild(price);
    insertAfter(totalText, price);

    hotelInfoDiv.appendChild(priceDiv);

    document.getElementById("hotel-info").appendChild(hotelInfoDiv);
    }

/*

  • Makes an HTTP Request to the server, loads and display the hotel on the HTML.

  • Params:

  • hotelId: the hotel identifier to search for on the server.
    */
    function displayHotel (hotelId) {

    get(APIendpoint+"/hotels/"+hotelId).then(function(response) {
    var json = JSON.parse(response);

         // Creating HTML elements that will be displayed
         generateHotelImage(json);
         generateHotelInfoPanel(json);
    
     }, function(error) {
         throw error;
     }
    

    )
    }`

index.html
`

<title>Assingment</title>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">

<!-- Custom CSS -->
<link rel="stylesheet" href="css/styles.css">
<section id="hotel">
    <div class="section-content">
        <div class="container">
          <!-- Hotels list -->
		  <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-4">
              <ul id="hotels-list" class="list-group">
				  
			  </ul>  
            </div>
		  
		  <!-- Hotel info -->
		  <div class="col-xs-12 col-sm-12 col-md-8">
              <div class="card">
                  <div class="card-block" id="hotel-info">
                   
                 </div>
			   </div>
            </div>
           </div>
        </div>
    </div> 
</section>

<!-- jQuery first, then Bootstrap JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="js/client.js"></script>
<script src="js/utils.js"></script>

styles.css
`/* STYLES.CSS */

html,
body {
height: 100%;
}

.section-content {
padding-top: 2rem;
}

.navbar-custom {
background-color: #EE55C0;
border-bottom: 2px solid #D4D1D1;
}

h1 {
font-size: 2rem;
font-weight: 700;
}

button.list-group-item {
color: #000;
font-weight: 600;
background: rgba(255, 255, 255, 1);
background: -moz-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(47%, rgba(246, 246, 246, 1)), color-stop(100%, rgba(237, 237, 237, 1)));
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
background: -o-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
background: -ms-linear-gradient(left, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
background: linear-gradient(to right, rgba(255, 255, 255, 1) 0%, rgba(246, 246, 246, 1) 47%, rgba(237, 237, 237, 1) 100%);
filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed', GradientType=1);
}

.list-group-item {
border: 1px solid #B5AEAE;
}

.list-group-item:first-child {
border-top-right-radius: 0rem;
border-top-left-radius: 0rem;
}

.list-group-item:last-child {
border-bottom-right-radius: 0rem;
border-bottom-left-radius: 0rem;
}

button:active,
button:focus,
button:hover {
outline:none !important;
cursor: pointer;
}

.card {
background-color: #F0EAEA;
border-radius: 0rem;
border: 0rem;
border-bottom: 2px solid #D4D1D1;
}

.price-hotel p:first-child {
color: #EE55C0;
font-size: 1.5rem;
}

.price-hotel p:nth-child(2) {
color: #777070;
font-size: 0.8rem;
font-weight: 700;
margin-top: -25px;
}

.price-hotel {
position: relative;
float: right;
top: 50px;
margin-left: 150px;
}

/* Sprite ratings */

.ratings-0, .ratings-1, .ratings-2, .ratings-3, .ratings-4, .ratings-5 {
background-image: url('../images/ratings.png');
background-repeat: no-repeat;
}

.ratings-0 {
height: 18px;
background-position: 0px 0px;
}

.ratings-1 {
height: 18px;
background-position: 0px -18px;
}

.ratings-2 {
height: 18px;
background-position: 0px -36px;
}

.ratings-3 {
height: 18px;
background-position: 0px -54px;
}

.ratings-4 {
height: 18px;
background-position: 0px -72px;
}

.ratings-5 {
height: 18px;
background-position: 0px -90px;
}

/********* Media query *********/

@media (max-width: 480px) {
.container {
width: 100%;
margin-top: -2rem;
padding: 0rem;
overflow-x: hidden;
}
.img-hotel img {
width: 130px;
height: 130px;
}
.price-hotel {
position: relative;
margin-top: -100px;
}
.hotel-name {
position: absolute;
margin-left: 140px;
top: -130px;
font-size: 1.1rem;
}
}
@media only screen and (min-width: 640px) and (max-width: 767px) {
.container {
width: 100%;
margin-top: -2rem;
padding: 0rem;
}
.hotel-name {
position: absolute;
margin-left: 40px;
font-size: 1.1rem;
}
.price-hotel {
margin-top: 60px;
margin-right: 50px;
}
}

@media only screen and (min-width: 768px) and (max-width: 991px) {
.hotel-name {
position: absolute;
margin-left: 40px;
font-size: 1.1rem;
}
.price-hotel {
padding-top: 50px;
}
}`

`

Error on installing

on :

npm install -g loopback-cli

Error:
LINK : fatal error LNK1181: cannot open input file 'C:\OpenSSL-Win64\lib\libeay32.lib' [C:\Users\USER\AppData\Roaming\npm\node_modul
es\loopback-cli\node_modules\ursa\build\ursaNative.vcxproj]

I used this command before with no issues but this start happening now ( I am trying to configure a new machine)

And reason or guide what I am missing?

Json file formatted as single line

Every time when i create model on datasource via cli all json files are formatted to a single line

This is very annoying and makes hard to work with model definitions.

tested on v5.0.0 and v4.2.1

example

{"db":{"name":"db","connector":"memory"},..}

instead of

{
  "db": {
    "name": "db",
    "connector": "memory"
  }
..
}

Unable to install loopback-cli

While running installation command : npm install -g loopback-cli

Ends with following error :

npm WARN deprecated [email protected]: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm WARN deprecated [email protected]: This project is unmaintained
npm WARN deprecated [email protected]: This project is unmaintained
npm ERR! Unexpected end of JSON input while parsing near '...dA5qu8i3su88JtUNyXRFL'

From Log file :

1767 http fetch GET 200 https://registry.npmjs.org/ignore 11ms (from cache)
1768 silly fetchPackageMetaData error for ignore@^3.3.5 Unexpected end of JSON input while parsing near '...dA5qu8i3su88JtUNyXRFL'
1769 silly pacote range manifest for dir-glob@^2.0.0 fetched in 14ms
1770 silly resolveWithNewModule [email protected] checking installable status
1771 silly pacote range manifest for fast-glob@^2.0.2 fetched in 15ms
1772 silly resolveWithNewModule [email protected] checking installable status
1773 silly pacote range manifest for slash@^1.0.0 fetched in 15ms
1774 silly resolveWithNewModule [email protected] checking installable status
1775 timing stage:rollbackFailedOptional Completed in 0ms
1776 timing stage:runTopLevelLifecycles Completed in 6622ms
1777 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...dA5qu8i3su88JtUNyXRFL'
1777 verbose stack at JSON.parse ()
1777 verbose stack at parseJson (C:\Users\nkanat\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
1777 verbose stack at consumeBody.call.then.buffer (C:\Users\nkanat\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50) @slnode Could you please check this ?

lb model --ls

Bug or feature request

[ ] Bug
[x] Feature request

Description of feature (or steps to reproduce if bug)

Could be handy to have new cli model option to list defined models in the project such as

lb model --ls

Expected result (maybe with build-in model inheritence) :

Account ➡ User
Receipe ➡ PersistedModel

lb <command | appName>

It would be very convenient to be able to do:

lb my-app

In lb <param>, we check if param is a lb command, if not, we assume it is the name of the app/dir.

@raymondfeng @bajtos thoughts?

Bug or feature request

  • Bug
  • Feature request

lb relations ignores models from paths other than common/models

Description/Steps to reproduce

According to the documentation, it should be possible to apply a folder-structure to the common-models folder by adding the corresponding paths to the model-config json. This seems to be working from a loopback point of view. However, as soon as I move my models into a subfolder, I no longer can use loopback-cli to i.e setup model-relations, as it cannot see anything except the common-models folder.

Reproduction:

  1. Move arbitrary model from common/model to common/model/test
  2. Update model-config.json by adding common/model/test to _meta:sources
  3. Run lb relation

No models are shown.

Expected result

Should show models from common/model/test folder

Additional information

darwin x64 8.1.3
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]

`lb` freeze at "Enter name of the directory to contain the project" question

Bug or feature request

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

I run lb but I only get as far as the "Enter name of the directory to contain the project" question, where I can't type anything in or exit via Ctrl-C.

Same behavior with administrative command prompt. Powershell or classic prompt doesn't affect result.

Tried re-installing loopback-cli (npm uninstall/install). Same.

Expected result

I should be able to enter the directory name for my new project and continue.

Actual result (if bug)

Prompt stuck, not accepting input. Nothing to do but shut-down the terminal window.

Additional information (Node.js version, LoopBack version, etc)

node.js: v8.1.0
npm.js: 5.0.3
loopback-cli (via lb -v): 2.5.1 ([email protected] [email protected])
Windows 10 Pro 64-bit (with Creators Update; fully updated/patched as of posting)

Acceptance Criteria

  • verify if the problem still exists
  • if problem still exists, put debug statements to identify the bottleneck
  • see if we can fix the bottleneck

`lb` command with no args should show usage/help menu

Most command line apps show usage/help menu when executing without options/args. For example:

$ brew

Example usage:
  brew search [TEXT|/REGEX/]
  brew (info|home|options) [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install -vd FORMULA

Developers:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
  https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md

Further help:
  man brew
  brew help [COMMAND]
  brew home

I find it weird that we don't default to the typical linux/unix conventions. Of course, this is probably a nit since the next typical thing anyone on command line would default to using is lb -h or lb --help. Might be more painful to force users to do lb app to create new apps.

@bajtos Thoughts?

Postgresql datasource prompt is confusing, after typing in the connection string I again get prompted for the host, etc.

Bug

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

This is probably a nice to have.

The datasource cli prompt requests a datasource URI and provides an example and then pauses, so presumably I should type in a datasource. Except when I do, it still prompts me to type in all the components. The wording hints at 'url to override', it would be useful to avoid having to retype all the parts of it if I actually want them to be the same as the url.

Expected result

demo@dev:~/backend$ lb datasource hello
Enter the data-source name: hello
? Select the connector for hello: PostgreSQL (supported by StrongLoop)
Connector-specific configuration:
? Connection String url to override other settings (eg: postgres://username:password@localhost/database, ENTER for prompt): postgres://username:password@localhost/hello

or, if I want to be prompted for the components:

demo@dev:~/backend$ lb datasource hello
Enter the data-source name: hello
? Select the connector for hello: PostgreSQL (supported by StrongLoop)
Connector-specific configuration:
? Connection String url to override other settings (eg: postgres://username:password@localhost/database, ENTER for prompt): 
? host: localhost
? port: 5432
? user: username
? password: ********
? database: hello

Actual result (if bug)

demo@dev:~/backend$ lb datasource hello
Enter the data-source name: hello
? Select the connector for hello: PostgreSQL (supported by StrongLoop)
Connector-specific configuration:
? Connection String url to override other settings (eg: postgres://username:password@localhost/database): postgres://username:password@localhost/hello
? host: localhost
? port: 5432
? user: username
? password: ********
? database: hello

Additional information (Node.js version, LoopBack version, etc)

Installed loopback as per https://loopback.io/doc/en/lb3/Installation.html
Node is 7.x on debian 8 in a virtualbox guest and loopback project using 3.x

CLI help for export-api-def command does not show --json option

Bug or feature request

  • Bug
  • Feature request

Description

CLI help lists --json option in an example, but not in list of Options. It should be added to the Options as well.

lb export-api-def -h
Usage:
  lb export-api-def [options]

Options:
  -h,   --help          # Print the generator's options and usage
        --skip-cache    # Do not remember prompt answers             Default: false
        --skip-install  # Do not automatically install dependencies  Default: false
  -o,   --output        # Name/Full path to the output file.

Description:
  Generate Swagger API definitions for LoopBack applications.

Example:

  lb export-api-def [--json]

  This will output the api definitions to stdout.
  Use option --json to display in JSON format, otherwise it defaults to YAML.

  lb export-api-def [--o outputFile]

  This will output the api definitions to the specified location. Based on the
  file extension, it will print to yaml or json format.

Suggested fix:

Add the following to the Options section:

--json           # Generate API definitions in JSON format instead of YAML

While we're at it, can we please fix these spelling mistakes / inconsistencies:

This will output the api definitions to stdout.
  Use option --json to display in JSON format, otherwise it defaults to YAML.

Should be

This will output the API definitions to stdout.
  Use option --json to display in JSON format, otherwise it defaults to YAML.

And

This will output the api definitions to the specified location. Based on the
  file extension, it will print to yaml or json format.

Should be

This will output the API definitions to the specified location. Based on the
  file extension, it will print to YAML or JSON format.

Make available LB versions configurable

Overview

As an API Connect user, I would like to provide a value to the LoopBack CLI tooling using an environment variable which will allow me to bypass the version selector that determines which major version of LoopBack I am using.

Acceptance Criteria

  • Modify the loopback-cli's generator steps so that they check for the LOOPBACK_VERSION environment variable

  • If the variable:

    • exists
    • is a valid non-negative integer
    • is one of the available options (2 or 3)
    • set that value to skip the version selector prompt
  • If the variable is not valid (but does exist)

    • emit a warning that the version variable's value is invalid
    • continue with prompting as normal
  • Add test coverage

  • Write JSDoc for the new environment variable

  • Document the new feature in loopback.io

  • Release to npmjs

  • Notify the API Connect team of the new environment variable change

=================================
Original Post:
For Velox, it is using loopback-cli directly. It would be good to have a way to configure what versions are available to users.

From the discussion thread with @raymondfeng and @kraman, one of the possibilities is to make it configurable through environment variable.

cc @raymondfeng

SyntaxError: Unexpected token = when running lb

Description/Steps to reproduce

  1. npm install -g loopback-cli
  2. lb

Link to reproduction sandbox

$ lb
/usr/local/lib/node_modules/loopback-cli/node_modules/object-assign-deep/objectAssignDeep.js:77
function executeDeepMerge (target, _objects = [], _options = {}) {
^

SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.module.exports.e.__esModule.default (/usr/local/lib/node_modules/loopback-cli/node_modules/swagger-client/dist/index.js:1:26579)
at t (/usr/local/lib/node_modules/loopback-cli/node_modules/swagger-client/dist/index.js:1:177)
at Object. (/usr/local/lib/node_modules/loopback-cli/node_modules/swagger-client/dist/index.js:1:12511)

Expected result

Present lb command

Additional information

node -e 'console.log(process.platform, process.arch, process.versions.node)'
linux x64 4.2.6
npm ls --prod --depth 0 | grep loopback
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]

Not able to create model's properties using loopback-cli

screenshot 2018-11-17 at 3 10 15 pm

loopback: 3.X
OS: macMojave 10.14.1
npm -v: 6.4.1
node -v: 8.12.0

Error thrown while creating model's properties:

(node:1219) UnhandledPromiseRejectionWarning: TypeError: this.invoke is not a function
at ModelGenerator. (/usr/local/lib/node_modules/loopback-cli/node_modules/generator-loopback/model/index.js:362:14)
at
at process._tickDomainCallback (internal/process/next_tick.js:229:7)

This happened while I following the instruction for creating model from the official website (https://loopback.io/doc/en/lb3/Create-a-simple-API.html).

Anyone have any ideas on how to fix this?

New remote method generator removing matching named methods in other models

Bug or feature request

  • Bug
  • Feature request

Repro steps of bug

  • Create a skeleton Loopback app.
  • Create two models using the generator.
  • Create a remote method in one of the models.
  • Create a remote method with the same name as the previous, but in the second model.
  • Observe that the first remote method created is removed

Expected result

AFAIK, remote methods with the same name but in different models (ie. resulting in different URL paths) are valid.

Actual result (if bug)

Looback remote method generator is removing a remote method from any model upon generating a second one with the same name.

Additional information (Node.js version, LoopBack version, etc)

Loopback: 2.0.0 ([email protected])
Node: v6.10.0

Update

This appears to also occur when performing any cli operation in a project with two remote methods with the same name (manually generated)

Indent size not respected from .editorconfig

  • x Feature request

We have a project that has a .editorconfig file with property indent_size = 4 however when using the CLI generated code reverts to spacing/indenting of 2. Can we set spacing/indenting somewhere?

Error: Cannot find module 'ieee754'

Error: Cannot find module 'ieee754'

at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\kd\AppData\Roaming\npm\node_modules\loopback-cli\node_modules\swagger-client\dist\index.js:7:11355)
at t (C:\Users\kd\AppData\Roaming\npm\node_modules\loopback-cli\node_modules\swagger-client\dist\index.js:1:177)
at Object. (C:\Users\kd\AppData\Roaming\npm\node_modules\loopback-cli\node_modules\swagger-client\dist\index.js:7:15)
at Object. (C:\Users\kd\AppData\Roaming\npm\node_modules\loopback-cli\node_modules\swagger-client\dist\index.js:7:11111)
at t (C:\Users\kd\AppData\Roaming\npm\node_modules\loopback-cli\node_modules\swagger-client\dist\index.js:1:177)
at Object. (C:\Users\kd\AppData\Roaming\npm\node_modules\loopback-cli\node_modules\swagger-client\dist\index.js:

Provide a "start" command

@lazaridis-com commented on Sun Feb 12 2017

The lb command line tool should have a start command.

This would simplify the usage, especially for newcomers (they don't know much about the underlying stack).

Additionally, it would be more consistent in general (one command-line tool, "lb").

Current Status

$ lb app todo
$ cd todo 
$ lb model
$ node .

With "start" Command

$ lb app todo
$ cd todo 
$ lb model
$ lb start

Unable to generate repository using lb4 command

Description/Steps to reproduce

113071-MBP15:reporting asand$ lb4 --version
@loopback/cli version: 1.0.1

@loopback/* dependencies:

  • @loopback/authentication: ^1.0.1
  • @loopback/boot: ^1.0.1
  • @loopback/build: ^1.0.0
  • @loopback/context: ^1.0.0
  • @loopback/core: ^1.0.0
  • @loopback/metadata: ^1.0.0
  • @loopback/openapi-spec-builder: ^1.0.0
  • @loopback/openapi-v3-types: ^1.0.0
  • @loopback/openapi-v3: ^1.0.1
  • @loopback/repository-json-schema: ^1.0.1
  • @loopback/repository: ^1.0.1
  • @loopback/rest: ^1.0.1
  • @loopback/testlab: ^1.0.0
  • @loopback/docs: ^1.0.1
  • @loopback/example-hello-world: ^1.0.1
  • @loopback/example-log-extension: ^1.0.1
  • @loopback/example-rpc-server: ^1.0.0
  • @loopback/example-todo: ^1.0.1
  • @loopback/example-soap-calculator: ^1.0.1
  • @loopback/service-proxy: ^1.0.0
  • @loopback/http-caching-proxy: ^1.0.0
  • @loopback/http-server: ^1.0.0
  • @loopback/example-todo-list: ^1.0.1
  • @loopback/dist-util: ^0.4.0
    113071-MBP15:reporting asand$ lb4 datasource
    ? Datasource name: oracle
    ? Select the connector for oracle: Oracle (supported by StrongLoop)
    ? Connection String tns (eg: DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MY_HOST)(PORT=MY_PORT))(CONNECT_DATA=(SERVER=DEDICATED)(SE
    RVICE_NAME=MY_DB))):
    ? host: <My_URL>
    ? port: 1521
    ? user: <My_USER>
    ? password: [hidden]
    ? database: demonlord
    create src/datasources/oracle.datasource.json
    create src/datasources/oracle.datasource.ts

[email protected] install /Users/asand/workspace/reporting/node_modules/oracledb
node package/oracledbinstall.js

oracledb Beginning installation
oracledb Verifying installation
oracledb Continuing installation
oracledb Oracledb downloaded
oracledb Verifying installation
oracledb Binary SHA matches SHA in SHASUMS256.txt
oracledb
oracledb ********************************************************************************
oracledb ** Node-oracledb 2.3.0 installation complete for Node.js 8.11.4 (darwin, x64)
oracledb **
oracledb ** To use the installed node-oracledb:
oracledb ** - You need to have the Oracle Instant Client Basic or Basic Light package in ~/lib or /usr/local/lib
oracledb ** Download from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
oracledb **
oracledb ** Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html
oracledb ********************************************************************************

npm WARN [email protected] No license field.

  • [email protected]
    added 2 packages in 7.38s
    [!] 1 vulnerability found [2755 packages audited]
    Severity: 1 Low
    Run npm audit for more detail

    update src/datasources/index.ts

Datasource oracle was created in src/datasources/

113071-MBP15:reporting asand$ lb4 model
? Model class name: ReportEngineJob
? Please select the model base class Entity
Let's add a property to ReportEngineJob
Enter an empty property name when done

? Enter the property name: id
? Property type: string
? Is id the ID property? Yes
? Is it required?: Yes
? Default value [leave blank for none]:

Let's add another property to ReportEngineJob
Enter an empty property name when done

? Enter the property name: status
? Property type: string
? Is it required?: Yes
? Default value [leave blank for none]:

Let's add another property to ReportEngineJob
Enter an empty property name when done

? Enter the property name: resourceId
? Property type: string
? Is it required?: Yes
? Default value [leave blank for none]:

Let's add another property to ReportEngineJob
Enter an empty property name when done

? Enter the property name: resourcePath
? Property type: string
? Is it required?: Yes
? Default value [leave blank for none]:

Let's add another property to ReportEngineJob
Enter an empty property name when done

? Enter the property name:
create src/models/report-engine-job.model.ts
update src/models/index.ts

Model ReportEngineJob was created in src/models/

113071-MBP15:reporting asand$ lb4 repository
? Please select the datasource OracleDatasource
? Select the model(s) you want to generate a repository
Generation is aborted: Error: You did not select a valid model

Link to reproduction sandbox

Expected result

Additional information

Any interest in a REPL/console command?

I published some time ago https://github.com/doublemarked/loopback-console, which is a Loopback-aware node REPL that does a few things,

  • Loads up a Loopback app discovered from the cwd
  • Binds the app and all its models into the repl's context
  • Auto-resolves promises

We've found it quite useful during development to quickly prototype things or poke around at the app, and at times to manipulate data in a production environment similar to an admin console.

Would there be interest in a PR to merge this functionality into loopback-cli? The loopback-console functions similarly to the cli, in that it operates on whatever loopback app it can find from the cwd.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.