Skip to content

Commit

Permalink
feat: add plugin id, addl plugin management methods (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
theogravity committed May 4, 2024
1 parent a32ad3e commit c583c94
Show file tree
Hide file tree
Showing 10 changed files with 289 additions and 185 deletions.
11 changes: 11 additions & 0 deletions .changeset/fast-moons-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"loglayer": minor
---

Adds an optional `id` field to plugins and the ability to manage plugins.

The following methods have been added:

- `LogLayer#removePlugin(id: string)`
- `LogLayer#enablePlugin(id: string)`
- `LogLayer#disablePlugin(id: string)`
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

### Major Changes

- [#13](https://github.com/theogravity/loglayer/pull/13) [`d1a8cc2`](https://github.com/theogravity/loglayer/commit/d1a8cc21e4191547e839d334c9386e25f0410235) Thanks [@theogravity](https://github.com/theogravity)! - - Removes hooks and adds a plugin system where you can
define multiple hooks to run instead.
- [#13](https://github.com/theogravity/loglayer/pull/13) [`d1a8cc2`](https://github.com/theogravity/loglayer/commit/d1a8cc21e4191547e839d334c9386e25f0410235) Thanks [@theogravity](https://github.com/theogravity)! - - Removes hooks and adds a plugin system where you can define multiple hooks to run instead.

- Adds esm and cjs builds to the package

Expand All @@ -22,10 +21,10 @@

Your 3.x definition may look like this:

```
```typescript
{
hooks: {
onBeforeDataOut: (data) => {
onBeforeDataOut: ({ data }) => {
// do something with data
return data;
},
Expand Down Expand Up @@ -59,6 +58,8 @@
- Replace `hooks` with `plugins`
- For your existing hooks, move them into the `plugins` array where each entry is an object with the hook definition

See `README.md` for more details.

## 3.1.0

- Added new configuration option `muteContext` and `muteMetadata` to disable context and metadata logging.
Expand Down
38 changes: 10 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
# Contributing

- Make sure you have appropriate unit tests that cover your feature
- Make sure coverage % is maintained

# Changelog

If a git commit message looks like this:

```text
This is my commit subject
This is my commit body
```

Then the changelog will be stamped in the following fashion on merge:

```text
## <version> - <date>
**Contributor:** <author>
- <git subject>
<git body>
```

# Merging

Once merged, the CI will auto-publish to npm and the changelog will be updated.
- Commit messages should follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
* The commit message should be in the format `<type>(<scope>): <description>`. The `scope` is optional. The description must be lowercased.
- This project uses [changeset](https://github.com/changesets/changesets) for managing releases. Use the `add-changeset` command to add a changeset for your changes.
* Fixes should be added to the `patch` category.
* New features should be added to the `minor` category.
* Breaking changes should be added to the `major` category.
- Make sure to add tests for any code written. They are written using [vitest](https://vitest.dev/). The tests should pass before submitting a PR.
- Make sure to run the linter before submitting a PR. The linter is run using the `lint` command. It uses
[biome.js](https://biomejs.dev/) for linting.
- The PR must pass the CI checks before it can be merged. This means it should pass linting and tests.
Loading

0 comments on commit c583c94

Please sign in to comment.