Skip to content

Commit

Permalink
chore: clean up extension generator
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/cli/generators/extension/templates/src/component.ts.ejs
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 packages/cli/generators/extension/templates/src/keys.ts.ejs
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 %>`,
);
}
7 changes: 7 additions & 0 deletions packages/cli/generators/extension/templates/src/types.ts.ejs
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 = {

};
12 changes: 12 additions & 0 deletions packages/cli/generators/project/templates/README.md.ejs
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.

0 comments on commit 3157719

Please sign in to comment.