From 0e0ac32cb160f3a3184f2601face479905fc7d69 Mon Sep 17 00:00:00 2001 From: Yaapa Hage Date: Mon, 31 Aug 2020 18:53:59 +0530 Subject: [PATCH] chore: more feedback More feedback Signed-off-by: Yaapa Hage --- docs/site/Component.md | 6 ++++++ .../extension/templates/src/component.ts.ejs | 1 - .../project/templates/README.md.ejs | 19 +++++++++++++------ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/site/Component.md b/docs/site/Component.md index 6cddff88d1dd..48603945977d 100644 --- a/docs/site/Component.md +++ b/docs/site/Component.md @@ -136,6 +136,12 @@ These components add additional capabilities to LoopBack. - [@loopback/typeorm](https://github.com/strongloop/loopback-next/tree/master/extensions/typeorm) - Adds support for TypeORM in LoopBack +### Community extensions + +For a list of components created by community members, refer to +[Community extensions](https://loopback.io/doc/en/lb4/Community-extensions.html) +. + ## Creating components Please refer to [Creating components](Creating-components.md) for more diff --git a/packages/cli/generators/extension/templates/src/component.ts.ejs b/packages/cli/generators/extension/templates/src/component.ts.ejs index 5dad27db7b04..4497bcd97255 100644 --- a/packages/cli/generators/extension/templates/src/component.ts.ejs +++ b/packages/cli/generators/extension/templates/src/component.ts.ejs @@ -6,7 +6,6 @@ import { config, ContextTags, CoreBindings, - createBindingFromClass, inject, } from '@loopback/core'; import {<%= project.bindingsNamespace %>} from './keys' diff --git a/packages/cli/generators/project/templates/README.md.ejs b/packages/cli/generators/project/templates/README.md.ejs index 14c34d78637f..d5fdc3d0f0e4 100644 --- a/packages/cli/generators/project/templates/README.md.ejs +++ b/packages/cli/generators/project/templates/README.md.ejs @@ -16,10 +16,17 @@ Configure and load <%= project.componentName %> in the application constructor as shown below. ```ts -... -this.configure(<%= project.componentName %>.COMPONENT).to({ - // Put the configuration options here -}); -this.component(<%= project.componentName %>); -... +import {<%= project.componentName %>, <%= project.optionsInterface %>, <%= project.defaultOptions %>} from '<%= project.name %>'; +// ... +export class MyApplication extends BootMixin(ServiceMixin(RepositoryMixin(RestApplication))) { + constructor(options: ApplicationConfig = {}) { + const opts: <%= project.optionsInterface %> = <%= project.defaultOptions %>; + this.configure(<%= project.bindingsNamespace %>.COMPONENT).to(opts); + // Put the configuration options here + }); + this.component(<%= project.componentName %>); + // ... + } + // ... +} ```