diff --git a/docs/site/Component.md b/docs/site/Component.md index 17dcc9e11f85..6cddff88d1dd 100644 --- a/docs/site/Component.md +++ b/docs/site/Component.md @@ -88,16 +88,12 @@ 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 integrating with - [IBM API Connect](https://www.ibm.com/cloud/api-connect) +### Core components + +These components implement the primary LoopBack capabilities. + - [@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) - @@ -105,6 +101,26 @@ team. - [@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/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 + +### Extensions + +These components add additional capabilities to LoopBack. + +- [@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-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/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) - @@ -117,13 +133,6 @@ team. 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 diff --git a/docs/site/Extending-LoopBack-4.md b/docs/site/Extending-LoopBack-4.md index 20fa50112ac0..8700e290d8a4 100644 --- a/docs/site/Extending-LoopBack-4.md +++ b/docs/site/Extending-LoopBack-4.md @@ -189,24 +189,8 @@ An application-level component usually contributes: ### Learn from existing ones -- [loopback4-example-log-extension](https://github.com/strongloop/loopback-next/tree/master/examples/log-extension) -- [@loopback/apiconnect](https://github.com/strongloop/loopback-next/tree/master/extensions/apiconnect) -- [@loopback/authentication](https://github.com/strongloop/loopback-next/tree/master/packages/authentication) -- [@loopback/authentication-jwt](https://github.com/strongloop/loopback-next/tree/master/extensions/authentication-jwt) -- [@loopback/authentication-passport](https://github.com/strongloop/loopback-next/tree/master/extensions/authentication-passport) -- [@loopback/authorization](https://github.com/strongloop/loopback-next/tree/master/packages/authorization) -- [@loopback/boot](https://github.com/strongloop/loopback-next/tree/master/packages/boot) -- [@loopback/booter-lb3app](https://github.com/strongloop/loopback-next/tree/master/packages/booter-lb3app) -- [@loopback/context-explorer](https://github.com/strongloop/loopback-next/tree/master/extensions/context-explorer) -- [@loopback/cron](https://github.com/strongloop/loopback-next/tree/master/extensions/cron) -- [@loopback/extension-health](https://github.com/strongloop/loopback-next/tree/master/extensions/health) -- [@loopback/extension-logging](https://github.com/strongloop/loopback-next/tree/master/extensions/logging) -- [@loopback/extension-metrics](https://github.com/strongloop/loopback-next/tree/master/extensions/metrics) -- [@loopback/pooling](https://github.com/strongloop/loopback-next/tree/master/extensions/pooling) -- [@loopback/rest](https://github.com/strongloop/loopback-next/tree/master/packages/rest) -- [@loopback/rest-crud](https://github.com/strongloop/loopback-next/tree/master/packages/rest-crud) -- [@loopback/rest-explorer](https://github.com/strongloop/loopback-next/tree/master/packages/rest-explorer) -- [@loopback/typeorm](https://github.com/strongloop/loopback-next/tree/master/extensions/typeorm) +Refer to the list of [official components](./Component.md#Official-components) +for an idea about how different types of components are written. ### Create your own extension diff --git a/packages/cli/generators/extension/index.js b/packages/cli/generators/extension/index.js index e4cc91f8696d..32d00af14c0c 100644 --- a/packages/cli/generators/extension/index.js +++ b/packages/cli/generators/extension/index.js @@ -70,12 +70,12 @@ module.exports = class ExtensionGenerator extends ProjectGenerator { scaffold() { 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`; + this.projectInfo.optionsInterface = `${this.projectInfo.componentName}Options`; + this.projectInfo.bindingsNamespace = `${this.projectInfo.componentName}Bindings`; + const uppercaseUnderscore = this.projectInfo.name + .toUpperCase() + .replace(/\W/g, '_'); + this.projectInfo.defaultOptions = `DEFAULT_${uppercaseUnderscore}_OPTIONS`; } return super.scaffold(); } diff --git a/packages/cli/generators/project/templates/README.md.ejs b/packages/cli/generators/project/templates/README.md.ejs index e9228dfe116a..14c34d78637f 100644 --- a/packages/cli/generators/project/templates/README.md.ejs +++ b/packages/cli/generators/project/templates/README.md.ejs @@ -4,12 +4,22 @@ ## Installation -Describe the installation steps. +Install <%= project.componentName %> using `npm`; -## Basic Use +```sh +$ npm install <%= project.name %> +``` -Describe the usage. +## Basic Use -## License +Configure and load <%= project.componentName %> in the application constructor +as shown below. -Specify the license. +```ts +... +this.configure(<%= project.componentName %>.COMPONENT).to({ + // Put the configuration options here +}); +this.component(<%= project.componentName %>); +... +```