-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up the extension generator. Signed-off-by: Yaapa Hage <[email protected]>
- Loading branch information
Yaapa Hage
committed
Aug 20, 2020
1 parent
9b2a0c9
commit 3157719
Showing
4 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
14 changes: 9 additions & 5 deletions
14
packages/cli/generators/extension/templates/src/component.ts.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import {Component, ProviderMap} from '@loopback/core'; | ||
import {<%= project.name.charAt(0).toUpperCase() + project.name.slice(1) %>Bindings} from './keys' | ||
import {<%= project.name.toUpperCase() %>_OPTIONS} from './types'; | ||
|
||
@bind({tags: {[ContextTags.KEY]: {<%= project.name.charAt(0).toUpperCase() + project.name.slice(1) %>Bindings.COMPONENT}}) | ||
export class <%= project.componentName %> implements Component { | ||
constructor() {} | ||
|
||
providers?: ProviderMap = { | ||
}; | ||
|
||
constructor( | ||
@inject(CoreBindings.APPLICATION_INSTANCE) | ||
private application: Application, | ||
@config() | ||
options: Options = <%= project.name.toUpperCase() %>_OPTIONS, | ||
) {} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/cli/generators/extension/templates/src/keys.ts.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {BindingKey, CoreBindings} from '@loopback/core'; | ||
import {<%= project.componentName %>} from './component'; | ||
|
||
/** | ||
* Binding keys used by this component. | ||
*/ | ||
export namespace <%= project.name.charAt(0).toUpperCase() + project.name.slice(1) %>Bindings { | ||
export const COMPONENT = BindingKey.create<<%= project.componentName %>>( | ||
`${CoreBindings.COMPONENTS}.<%= project.componentName %>`, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export interface <%= project.name.charAt(0).toUpperCase() + project.name.slice(1) %>Options { | ||
|
||
} | ||
|
||
export const <%= project.name.toUpperCase() %>_OPTIONS: <%= project.name.charAt(0).toUpperCase() + project.name.slice(1) %>Options = { | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
# <%= project.name %> | ||
|
||
[![LoopBack](https://github.com/strongloop/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)[email protected])](http://loopback.io/) | ||
|
||
## Installation | ||
|
||
Describe the installation steps. | ||
|
||
## Basic Use | ||
|
||
Describe the usage. | ||
|
||
## License | ||
|
||
Specify the license. |