Skip to content

Commit

Permalink
fix(types): add plugins to environments (#638)
Browse files Browse the repository at this point in the history
* fix(types): add plugins to environments

* fix: test if it allows environments to contain plugins

(cherry picked from commit aef0b9c)
  • Loading branch information
radulle authored and agerard-godaddy committed Jan 24, 2024
1 parent 70f2261 commit 0dc2e7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
14 changes: 8 additions & 6 deletions packages/gasket-engine/lib/engine.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,18 @@ declare module '@gasket/engine' {
? { [K in keyof T]?: PartialRecursive<T[K]> } | undefined
: T | undefined

export type GasketConfigFile = Omit<GasketConfig, 'root' | 'env' | 'command'> & {
root?: string,
env?: string,

type Plugins = {
plugins?: {
presets?: Array<string>;
add?: Array<string | Plugin>;
remove?: Array<string>;
},
};
};

export type GasketConfigFile = Omit<GasketConfig, 'root' | 'env' | 'command'> & Plugins & {
root?: string,
env?: string,

environments?: Record<string, PartialRecursive<GasketConfig>>
environments?: Record<string, PartialRecursive<GasketConfig & Plugins>>
}
}
7 changes: 6 additions & 1 deletion packages/gasket-typescript-tests/test/engine.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Gasket, { MaybeAsync, Plugin } from '@gasket/engine';
import Gasket from '@gasket/engine';
import type { GasketConfigFile, MaybeAsync, Plugin } from '@gasket/engine';

declare module '@gasket/engine' {
interface HookExecTypes {
Expand Down Expand Up @@ -89,4 +90,8 @@ describe('@gasket/engine', () => {
}
});
});

it('allows environments to contain plugins', () => {
const config: GasketConfigFile = { environments: { dev: { plugins: { add: ['plugin-name'] } } } };
});
});

0 comments on commit 0dc2e7a

Please sign in to comment.