Skip to content

Commit 338d4c2

Browse files
authored
chore: make @aws-cdk/yargs-gen a devDependency (#32096)
`yargs-gen` used to be a runtime dependency. The only reason seemed to be that there was a factory class for `DynamicResult` types in `yargs-gen`, called `DynamicValue`. In this PR, move the factory to the only location where it is used in the CLI itself, and turn the `import` of `yargs-gen` into an `import type`, which does not imply any runtime dependency. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 5bc0662 commit 338d4c2

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

packages/aws-cdk/lib/config.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CliConfig, DynamicValue } from '@aws-cdk/yargs-gen';
1+
import type { CliConfig, DynamicResult } from '@aws-cdk/yargs-gen';
22
import { StackActivityProgress } from './api/util/cloudformation/stack-activity-monitor';
33
import { RequireApproval } from './diff';
44

@@ -417,3 +417,26 @@ export function makeConfig(): CliConfig {
417417
},
418418
};
419419
}
420+
421+
/**
422+
* Informs the code library, `@aws-cdk/yargs-gen`, that
423+
* this value references an entity not defined in this configuration file.
424+
*/
425+
export class DynamicValue {
426+
/**
427+
* Instructs `yargs-gen` to retrieve this value from the parameter with passed name.
428+
*/
429+
public static fromParameter(parameterName: string): DynamicResult {
430+
return {
431+
dynamicType: 'parameter',
432+
dynamicValue: parameterName,
433+
};
434+
}
435+
436+
public static fromInline(f: () => any): DynamicResult {
437+
return {
438+
dynamicType: 'function',
439+
dynamicValue: f,
440+
};
441+
}
442+
}

packages/aws-cdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"devDependencies": {
7171
"@aws-cdk/cdk-build-tools": "0.0.0",
7272
"@aws-cdk/pkglint": "0.0.0",
73+
"@aws-cdk/yargs-gen": "0.0.0",
7374
"@octokit/rest": "^18.12.0",
7475
"@types/archiver": "^5.3.4",
7576
"@types/fs-extra": "^9.0.13",
@@ -105,7 +106,6 @@
105106
"@aws-cdk/cloudformation-diff": "0.0.0",
106107
"@aws-cdk/cx-api": "0.0.0",
107108
"@aws-cdk/region-info": "0.0.0",
108-
"@aws-cdk/yargs-gen": "0.0.0",
109109
"@aws-sdk/client-appsync": "3.632.0",
110110
"@aws-sdk/client-cloudformation": "3.632.0",
111111
"@aws-sdk/client-cloudwatch-logs": "3.632.0",

tools/@aws-cdk/yargs-gen/lib/yargs-types.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,3 @@ export interface DynamicResult {
5555
dynamicType: 'parameter' | 'function';
5656
dynamicValue: string | (() => any);
5757
}
58-
59-
/**
60-
* Informs the code library, `@aws-cdk/yargs-gen`, that
61-
* this value references an entity not defined in this configuration file.
62-
*/
63-
export class DynamicValue {
64-
/**
65-
* Instructs `yargs-gen` to retrieve this value from the parameter with passed name.
66-
*/
67-
public static fromParameter(parameterName: string): DynamicResult {
68-
return {
69-
dynamicType: 'parameter',
70-
dynamicValue: parameterName,
71-
};
72-
}
73-
74-
public static fromInline(f: () => any): DynamicResult {
75-
return {
76-
dynamicType: 'function',
77-
dynamicValue: f,
78-
};
79-
}
80-
}

0 commit comments

Comments
 (0)