Skip to content

Commit

Permalink
feat: added support for Scaleway nodeTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderkooger committed Apr 18, 2023
1 parent c16529d commit d4a625b
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,21 +221,29 @@ export type GoogleNodeProviderRuntimeMatcher<Versions extends number> = {
[Version in Versions as `nodejs${Version}`]: `node${Version}`;
};

export type ScalewayNodeProviderRuntimeMatcher<Versions extends number> = {
[Version in Versions as `node${Version}`]: `node${Version}`;
};

export type AwsNodeMatcher = AwsNodeProviderRuntimeMatcher<12 | 14 | 16 | 18>;

export type AzureNodeMatcher = AzureNodeProviderRuntimeMatcher<12 | 14 | 16 | 18>;

export type GoogleNodeMatcher = GoogleNodeProviderRuntimeMatcher<12 | 14 | 16 | 18>;

export type NodeMatcher = AwsNodeMatcher & AzureNodeMatcher & GoogleNodeMatcher;
export type ScalewayNodeMatcher = ScalewayNodeProviderRuntimeMatcher<12 | 14 | 16 | 18>;

export type NodeMatcher = AwsNodeMatcher & AzureNodeMatcher & GoogleNodeMatcher & ScalewayNodeMatcher;

export type AwsNodeMatcherKey = keyof AwsNodeMatcher;

export type AzureNodeMatcherKey = keyof AzureNodeMatcher;

export type GoogleNodeMatcherKey = keyof GoogleNodeMatcher;

export type NodeMatcherKey = AwsNodeMatcherKey | AzureNodeMatcherKey | GoogleNodeMatcherKey;
export type ScalewayNodeMatcherKey = keyof ScalewayNodeMatcher;

export type NodeMatcherKey = AwsNodeMatcherKey | AzureNodeMatcherKey | GoogleNodeMatcherKey | ScalewayNodeMatcherKey;

const awsNodeMatcher: AwsNodeMatcher = {
'nodejs18.x': 'node18',
Expand All @@ -258,12 +266,25 @@ const googleNodeMatcher: GoogleNodeMatcher = {
nodejs12: 'node12',
};

const nodeMatcher: NodeMatcher = { ...googleNodeMatcher, ...awsNodeMatcher, ...azureNodeMatcher };
const scalewayNodeMatcher: ScalewayNodeMatcher = {
node18: 'node18',
node16: 'node16',
node14: 'node14',
node12: 'node12',
};

const nodeMatcher: NodeMatcher = {
...googleNodeMatcher,
...awsNodeMatcher,
...azureNodeMatcher,
...scalewayNodeMatcher,
};

export const providerRuntimeMatcher = Object.freeze<Record<string, NodeMatcher>>({
aws: awsNodeMatcher as NodeMatcher,
azure: azureNodeMatcher as NodeMatcher,
google: googleNodeMatcher as NodeMatcher,
scaleway: scalewayNodeMatcher as NodeMatcher,
});

export const isNodeMatcherKey = (input: unknown): input is NodeMatcherKey =>
Expand Down

0 comments on commit d4a625b

Please sign in to comment.