-
Notifications
You must be signed in to change notification settings - Fork 71
Support custom connector #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9f18b31
to
aab38c7
Compare
@bajtos Please review, thanks:) |
@slnode test please |
var modelGen = givenDataSourceGenerator(); | ||
helpers.mockPrompt(modelGen, { | ||
name: 'test-custom', | ||
customConnector: 'loopback-component-storage', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a name that will never become a connector, e.g. async
or lodash
. I think the storage component is sort of connector-like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. "a name that will never become a connector" makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async
is already there, i use lodash
then
@jannyHou reviewed, PTAL |
LGTM 👏 Please rebase on top of the current master and squash the commits. |
6f74795
to
0d3ec2f
Compare
if (!pkg) return; | ||
} | ||
|
||
var npmModule = pkg.name || connector || this.connector; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bajtos When I check the code again, I think it should be
var npmModule = pkg.name || this.connector
instead of
var npmModule = pkg.name || connector || this.connector
The connector
is either undefined or an object, not a string. Thought?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The connector is either undefined or an object, not a string. Thought?
Ah, that's actually expected, see L200:
var connector = this.availableConnectors[this.connector];
I think it should be
var npmModule = pkg.name || this.connector;
Makes sense to me! 👍
0d3ec2f
to
28ad27a
Compare
@slnode test please |
Connect to strongloop/loopback#2265
Now when we choose a custom connector that not included in available connectors, it returns error.
This pr is created for supporting custom connector, and print a message to remind user manually add config then.