Skip to content

Commit

Permalink
chore: feedback
Browse files Browse the repository at this point in the history
Feedback

Signed-off-by: Yaapa Hage <[email protected]>
  • Loading branch information
Yaapa Hage committed Aug 27, 2020
1 parent e45f386 commit 7df1e9d
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 32 deletions.
61 changes: 37 additions & 24 deletions docs/site/Component.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,44 @@ app.component(AuthenticationComponent);
Here is a list of components officially created and maintained by the LoopBack
team.

- [@loopback/apiconnect](https://github.com/strongloop/loopback-next/tree/master/extensions/apiconnect) - An extension for IBM API Connect
- [@loopback/authentication](https://github.com/strongloop/loopback-next/tree/master/packages/authentication) - A LoopBack component for authentication support
- [@loopback/authentication-jwt](https://github.com/strongloop/loopback-next/tree/master/extensions/authentication-jwt) - Extension for the prototype of JWT
authentication
- [@loopback/authentication-passport](https://github.com/strongloop/loopback-next/tree/master/extensions/authentication-passport) - A package creating adapters between the
passport module and @loopback/authentication
- [@loopback/authorization](https://github.com/strongloop/loopback-next/tree/master/packages/authorization) - A LoopBack component for authorization support
- [@loopback/boot](https://github.com/strongloop/loopback-next/tree/master/packages/boot) - A collection of Booters for LoopBack 4 Applications
- [@loopback/booter-lb3app](https://github.com/strongloop/loopback-next/tree/master/packages/booter-lb3app) - A booter component for LoopBack 3 applications to
expose their REST API via LoopBack 4
- [@loopback/context-explorer](https://github.com/strongloop/loopback-next/tree/master/extensions/context-explorer) - Visualize context hierarchy, bindings,
configurations, and dependencies
- [@loopback/cron](https://github.com/strongloop/loopback-next/tree/master/extensions/cron) - Schedule tasks using cron-like syntax
- [@loopback/extension-health](https://github.com/strongloop/loopback-next/tree/master/extensions/health) - An extension exposes health check related
endpoints with LoopBack 4
- [@loopback/extension-logging](https://github.com/strongloop/loopback-next/tree/master/extensions/logging) - An extension exposes logging for Winston and
Fluentd with LoopBack 4
- [@loopback/extension-metrics](https://github.com/strongloop/loopback-next/tree/master/extensions/metrics) - An extension exposes metrics for Prometheus with
- [@loopback/apiconnect](https://github.com/strongloop/loopback-next/tree/master/extensions/apiconnect) -
An extension for integrating with
[IBM API Connect](https://www.ibm.com/cloud/api-connect)
- [@loopback/authentication](https://github.com/strongloop/loopback-next/tree/master/packages/authentication) -
A LoopBack component for authentication support
- [@loopback/authentication-jwt](https://github.com/strongloop/loopback-next/tree/master/extensions/authentication-jwt) -
Extension for JWT authentication
- [@loopback/authentication-passport](https://github.com/strongloop/loopback-next/tree/master/extensions/authentication-passport) -
A package creating adapters between the passport module and
@loopback/authentication
- [@loopback/authorization](https://github.com/strongloop/loopback-next/tree/master/packages/authorization) -
A LoopBack component for authorization support
- [@loopback/boot](https://github.com/strongloop/loopback-next/tree/master/packages/boot) -
A collection of Booters for LoopBack 4 Applications
- [@loopback/booter-lb3app](https://github.com/strongloop/loopback-next/tree/master/packages/booter-lb3app) -
A booter component for LoopBack 3 applications to expose their REST API via
LoopBack 4
- [@loopback/pooling](https://github.com/strongloop/loopback-next/tree/master/extensions/pooling) - Resource pooling service for LoopBack 4
- [@loopback/rest](https://github.com/strongloop/loopback-next/tree/master/packages/rest) - Expose controllers as REST endpoints and route REST API
requests to controller methods
- [@loopback/rest-crud](https://github.com/strongloop/loopback-next/tree/master/packages/rest-crud) - REST API controller implementing default CRUD semantics
- [@loopback/rest-explorer](https://github.com/strongloop/loopback-next/tree/master/packages/rest-explorer) - LoopBack's API Explorer
- [@loopback/typeorm](https://github.com/strongloop/loopback-next/tree/master/extensions/typeorm) - Adds support for TypeORM in LoopBack
- [@loopback/context-explorer](https://github.com/strongloop/loopback-next/tree/master/extensions/context-explorer) -
Visualize context hierarchy, bindings, configurations, and dependencies
- [@loopback/cron](https://github.com/strongloop/loopback-next/tree/master/extensions/cron) -
Schedule tasks using cron-like syntax
- [@loopback/extension-health](https://github.com/strongloop/loopback-next/tree/master/extensions/health) -
An extension exposes health check related endpoints with LoopBack 4
- [@loopback/extension-logging](https://github.com/strongloop/loopback-next/tree/master/extensions/logging) -
An extension exposes logging for Winston and Fluentd with LoopBack 4
- [@loopback/extension-metrics](https://github.com/strongloop/loopback-next/tree/master/extensions/metrics) -
An extension exposes metrics for Prometheus with LoopBack 4
- [@loopback/pooling](https://github.com/strongloop/loopback-next/tree/master/extensions/pooling) -
Resource pooling service for LoopBack 4
- [@loopback/rest](https://github.com/strongloop/loopback-next/tree/master/packages/rest) -
Expose controllers as REST endpoints and route REST API requests to controller
methods
- [@loopback/rest-crud](https://github.com/strongloop/loopback-next/tree/master/packages/rest-crud) -
REST API controller implementing default CRUD semantics
- [@loopback/rest-explorer](https://github.com/strongloop/loopback-next/tree/master/packages/rest-explorer) -
LoopBack's API Explorer
- [@loopback/typeorm](https://github.com/strongloop/loopback-next/tree/master/extensions/typeorm) -
Adds support for TypeORM in LoopBack

## Creating components

Expand Down
15 changes: 8 additions & 7 deletions packages/cli/generators/extension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ module.exports = class ExtensionGenerator extends ProjectGenerator {
}

scaffold() {
const titleCase =
this.projectInfo.name.charAt(0).toUpperCase() +
this.projectInfo.name.slice(1);
this.projectInfo.optionsInterface = `${titleCase}Options`;
this.projectInfo.bindingsNamespace = `${titleCase}Bindings`;
this.projectInfo.defaultOptions = `DEFAULT_${this.projectInfo.name.toUpperCase()}_OPTIONS`;

if (this.projectInfo) {
const titleCase =
this.projectInfo.name.charAt(0).toUpperCase() +
this.projectInfo.name.slice(1);
this.projectInfo.optionsInterface = `${titleCase}Options`;
this.projectInfo.bindingsNamespace = `${titleCase}Bindings`;
this.projectInfo.defaultOptions = `DEFAULT_${this.projectInfo.name.toUpperCase()}_OPTIONS`;
}
return super.scaffold();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ import {
import {<%= project.bindingsNamespace %>} from './keys'
import {<%= project.defaultOptions %>, <%= project.optionsInterface %>} from './types';

// Configure the binding for <%= project.componentName %>
@bind({tags: {[ContextTags.KEY]: <%= project.bindingsNamespace %>.COMPONENT}})
export class <%= project.componentName %> implements Component {
constructor(
@inject(CoreBindings.APPLICATION_INSTANCE)
private application: Application,
@config()
options: <%= project.optionsInterface %> = <%= project.defaultOptions %>,
private options: <%= project.optionsInterface %> = <%= project.defaultOptions %>,
) {}
}
8 changes: 8 additions & 0 deletions packages/cli/generators/extension/templates/src/types.ts.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
/**
* Interface defining the component's options object
*/
export interface <%= project.optionsInterface %> {
// Add the definitions here

}

/**
* Default options for the component
*/
export const <%= project.defaultOptions %>: <%= project.optionsInterface %> = {
// Specify the values here

};

0 comments on commit 7df1e9d

Please sign in to comment.