-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: add greeter extension to illustrate extension point/extension pattern #2249
Conversation
@raymondfeng Good to have an example repository for extension. What's the difference between this example repo and the log extension in https://github.com/strongloop/loopback-next/tree/master/examples/log-extension? |
fc53201
to
53ae291
Compare
167668d
to
a0f6b74
Compare
+1, I'd like to better understand the differences too. |
Also IIUC, this pull request contains commits from other pull requests, for example #2122. Am I assuming correctly that you will rebase those commit away once the other PRs are landed? |
7c5e45a
to
a4c9ffb
Compare
Yes. The PR is against |
The log-extension focuses on demonstrating the common LB4 constructs for extensions, such as decorators, mixins, providers, and components. The greeter-extension is dedicated to the extension point/extension pattern. It illustrates how to solve the common extensibility issue by implementing the pattern on top of LB4 constructs. See README for more details. |
765f316
to
b25d990
Compare
a4c9ffb
to
25ad6d9
Compare
b25d990
to
b9518c1
Compare
44742f9
to
b75bc99
Compare
01866ed
to
878e523
Compare
878e523
to
d738173
Compare
accacaf
to
112dea3
Compare
3ea2f02
to
180ccb9
Compare
112dea3
to
8c8585e
Compare
e5d289c
to
f81045f
Compare
2901953
to
a1cc599
Compare
I am ok to allow users to combine the responsibility of two into one class, if they wish so. However, I am arguing that such design
|
a1cc599
to
7da6ce6
Compare
7da6ce6
to
eb71d82
Compare
@bajtos PTAL |
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 patch is starting to look very reasonable 👍
Please get at least one more (preferably 2-3) people from @strongloop/loopback-maintainers to review this proposal too.
examples/greeter-extension/src/__tests__/greeter-extension.acceptance.ts
Outdated
Show resolved
Hide resolved
eb71d82
to
988dbb6
Compare
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.
I think as far as I understand, this looks good to me, besides some minor comments. Is this example also going to be added to the docs/cli?
examples/greeter-extension/src/__tests__/greeter-extension.acceptance.ts
Show resolved
Hide resolved
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 signature of registering an extension point and extensions LGTM 👏
I left a few questions.
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.
Great stuff!
The only thing to fix would be the test case 'supports options for the extension point' where there is usage of chalk to test an extension point option is in place. I have a comment which explains the problem.
988dbb6
to
34f15c0
Compare
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.
Thanks for clarifying all the questions! LGTM.
34f15c0
to
242407c
Compare
242407c
to
25b6cd6
Compare
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 example illustrates how to implement extension point/extenion pattern in LoopBack 4 to provide great extensibility.
25b6cd6
to
95b676c
Compare
The PR adds an example project to demonstrate how to implement extensibility using the extension point/extension pattern on top of LoopBack 4's IoC and DI foundation.
See https://github.com/strongloop/loopback-next/blob/greeter-extension/examples/greeter-extension/README.md.
Checklist
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated