Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin dependencies #497

Merged
merged 3 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/gasket-engine/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# `@gasket/engine`

- Add missing dependencies property on the `Plugin` type

### 6.34.4

- Upgrade eslint-plugin-unicorn v43 ([#436])
Expand Down
1 change: 1 addition & 0 deletions packages/gasket-engine/lib/engine.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ declare module '@gasket/engine' {

export type Plugin = {
name: string;
dependencies?: Array<string>;
hooks: {
[K in HookId]?: Hook<K>;
};
Expand Down
16 changes: 14 additions & 2 deletions packages/gasket-typescript-tests/test/engine.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Gasket, { MaybeAsync } from '@gasket/engine';
import Gasket, { MaybeAsync, Plugin } from '@gasket/engine';

declare module '@gasket/engine' {
interface HookExecTypes {
Expand All @@ -15,7 +15,7 @@ describe('@gasket/engine', () => {
);
});

it('should', async function () {
it('should infer the types of lifecycle parameters', async function () {
const gasket = new Gasket(
{ root: __dirname, env: 'test' },
{ resolveFrom: __dirname }
Expand All @@ -30,4 +30,16 @@ describe('@gasket/engine', () => {
handler('a string', 123, true);
});
});

it('defines the structure of a Gasket plugin', () => {
const myPlugin: Plugin = {
name: 'my-plugin',
dependencies: ['foo', 'bar'],
hooks: {
example(gasket, a, b, c) {
return true;
}
}
};
});
});