Skip to content

Clean up extension template and docs #5336

@bajtos

Description

@bajtos

This is a follow-up for #5337 and #5122

The documentation for component authors (e.g. Creating components) and the template used by lb4 extension are outdated. We learned a lot since those artifacts were written and introduced new conventions and features, e.g. @config decorator. It's time to modernize both the CLI template and the docs to the latest and greatest.

Acceptance criteria

CLI templates

Update the template used by lb4 extension to follow the current style as seen e.g. in extensions/metrics

  • inject the target app and component config to the component class
  • add a new file src/keys.ts exporting {ComponentName}Keys.COMPONENT binding key
  • decorate the component class with @bind(),
  • include generic Basic Use instructions in the scaffolded README file

Nice to have:

  • use the component name in the file names to disambiguate them from similar files in other extensions, e.g. src/{name}.keys.ts and src/{name}.component.ts

Docs

Revisit the documentation, make it consistent with the current style for writing extensions and the CLI template.

  • Creating components
    • Rework "Configuring components" at the end to explain how to receive and provide component config via @config and
      this.configure() API
    • Review the content - are the advices and code snippets still current and consistent with recommendations we are giving elsewhere? Are we missing any major information? (It's probably best to open follow-up stories to make non-trivial docs updates.)
  • Extending LoopBack 4,
    • "Learn from existing ones" - can we add more of our existing components to the list?
    • Review the content - are the advices and code snippets still current and consistent with recommendations we are giving elsewhere? Are we missing any major information? (It's probably best to open follow-up stories to make non-trivial docs updates.)
  • Using components
    • Update the list of components to include all extensions developed in loopback-next monorepo (look for components both in extensions and packages)
  • Components

Nice to have:

  • Review the content in the pages above and in the component migration guide (https://loopback.io/doc/en/lb4/migration-extensions.html and sub-pages). Some content may be duplicated (sometimes inconsistently), some content may belong to a different place. Decide what to do (if anything) and either make the changes right away or create follow-up issues.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions