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

Fix gasket command location #627

Merged
merged 3 commits into from
Oct 5, 2023
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`

- Fix incorrect location of the command structure in the TypeScript definition

### 6.39.3

- Fix hook timing type ([#599])
Expand Down
9 changes: 5 additions & 4 deletions packages/gasket-engine/lib/engine.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ declare module '@gasket/engine' {

// This is the config
export interface GasketConfig {
command: {
id: string
}
root: string,
env: string
}
Expand Down Expand Up @@ -85,7 +82,11 @@ declare module '@gasket/engine' {
}): void;
}

export interface Gasket extends GasketEngine {}
export interface Gasket extends GasketEngine {
command: {
id: string
}
}

type PartialRecursive<T> =
T extends Object
Expand Down
15 changes: 15 additions & 0 deletions packages/gasket-typescript-tests/test/engine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,19 @@ describe('@gasket/engine', () => {
}
});
});

it('exposes the running command on the Gasket interface', () => {
const engine = new Gasket(
{ root: __dirname, env: 'test' },
{ resolveFrom: __dirname }
);

// Valid
engine.hook({
event: 'example',
handler(gasket) {
return gasket.command.id === 'start';
}
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('@gasket/plugin-metadata', () => {

it('adds a metadata property to Gasket', () => {
const gasket1: SlimGasket = {
command: { id: 'docs' },
metadata: {
app: {
name: 'example',
Expand Down Expand Up @@ -57,6 +58,7 @@ describe('@gasket/plugin-metadata', () => {
};

const gasket2: SlimGasket = {
command: { id: 'docs' },
metadata: {
app: {
name: 'example',
Expand Down
2 changes: 1 addition & 1 deletion packages/gasket-typescript-tests/test/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('@gasket/utils', function () {
const perform = false;

describe('applyConfigOverrides', function () {
const config: GasketConfig = { command: { id: 'debug' }, root: '/', env: 'debug' };
const config: GasketConfig = { root: '/', env: 'debug' };

it('has expected API', function () {
if (perform) {
Expand Down