Skip to content

Commit 2093af0

Browse files
mrgraingithub-actions
andauthored
refactor(toolkit-lib): move code from tmp-toolkit-helpers (#424)
Move all code and tests from `tmp-toolkit-helpers` to `toolkit-lib`. Remove the now empty package. Made necessary changes to imports, config and tests. No functional code changes! --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license --------- Signed-off-by: github-actions <[email protected]> Co-authored-by: github-actions <[email protected]>
1 parent f12ec97 commit 2093af0

File tree

337 files changed

+556
-2466
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+556
-2466
lines changed

.projenrc.ts

Lines changed: 15 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ function transitiveFeaturesAndFixes(thisPkg: string, depPkgs: string[]) {
178178
function transitiveToolkitPackages(thisPkg: string) {
179179
const toolkitPackages = [
180180
'aws-cdk',
181-
'@aws-cdk/tmp-toolkit-helpers',
182181
'@aws-cdk/cloud-assembly-schema',
183182
'@aws-cdk/cloudformation-diff',
184183
'@aws-cdk/toolkit-lib',
@@ -705,135 +704,6 @@ cdkAssets.eslint?.addRules({ 'jest/no-export': ['off'] });
705704

706705
//////////////////////////////////////////////////////////////////////
707706

708-
const tmpToolkitHelpers = configureProject(
709-
new yarn.TypeScriptWorkspace({
710-
...genericCdkProps({
711-
private: true,
712-
}),
713-
parent: repo,
714-
name: '@aws-cdk/tmp-toolkit-helpers',
715-
description: 'A temporary package to hold code shared between aws-cdk and @aws-cdk/toolkit-lib',
716-
devDeps: [
717-
'@types/archiver',
718-
'@types/semver',
719-
'aws-sdk-client-mock',
720-
'aws-sdk-client-mock-jest',
721-
'fast-check',
722-
'nock',
723-
'@smithy/util-stream',
724-
'xml-js',
725-
],
726-
deps: [
727-
cloudAssemblySchema.name,
728-
cloudFormationDiff,
729-
cxApi,
730-
`@aws-sdk/client-appsync@${CLI_SDK_V3_RANGE}`,
731-
`@aws-sdk/client-cloudcontrol@${CLI_SDK_V3_RANGE}`,
732-
`@aws-sdk/client-cloudformation@${CLI_SDK_V3_RANGE}`,
733-
`@aws-sdk/client-cloudwatch-logs@${CLI_SDK_V3_RANGE}`,
734-
`@aws-sdk/client-codebuild@${CLI_SDK_V3_RANGE}`,
735-
`@aws-sdk/client-ec2@${CLI_SDK_V3_RANGE}`,
736-
`@aws-sdk/client-ecr@${CLI_SDK_V3_RANGE}`,
737-
`@aws-sdk/client-ecs@${CLI_SDK_V3_RANGE}`,
738-
`@aws-sdk/client-elastic-load-balancing-v2@${CLI_SDK_V3_RANGE}`,
739-
`@aws-sdk/client-iam@${CLI_SDK_V3_RANGE}`,
740-
`@aws-sdk/client-kms@${CLI_SDK_V3_RANGE}`,
741-
`@aws-sdk/client-lambda@${CLI_SDK_V3_RANGE}`,
742-
`@aws-sdk/client-route-53@${CLI_SDK_V3_RANGE}`,
743-
`@aws-sdk/client-s3@${CLI_SDK_V3_RANGE}`,
744-
`@aws-sdk/client-secrets-manager@${CLI_SDK_V3_RANGE}`,
745-
`@aws-sdk/client-sfn@${CLI_SDK_V3_RANGE}`,
746-
`@aws-sdk/client-ssm@${CLI_SDK_V3_RANGE}`,
747-
`@aws-sdk/client-sts@${CLI_SDK_V3_RANGE}`,
748-
`@aws-sdk/credential-providers@${CLI_SDK_V3_RANGE}`,
749-
`@aws-sdk/lib-storage@${CLI_SDK_V3_RANGE}`,
750-
`@aws-sdk/ec2-metadata-service@${CLI_SDK_V3_RANGE}`,
751-
'@smithy/middleware-endpoint',
752-
'@smithy/node-http-handler',
753-
'@smithy/property-provider',
754-
'@smithy/shared-ini-file-loader',
755-
'@smithy/types',
756-
'@smithy/util-retry',
757-
'@smithy/util-waiter',
758-
cdkAssets,
759-
'archiver',
760-
'chalk@4',
761-
'fs-extra@^9',
762-
'glob',
763-
'minimatch',
764-
'p-limit@^3',
765-
'promptly', // @todo remove this should only be in CLI
766-
'proxy-agent', // @todo remove this should only be in CLI
767-
'semver',
768-
'uuid',
769-
'wrap-ansi@^7', // Last non-ESM version
770-
'yaml@^1',
771-
],
772-
773-
tsconfig: {
774-
compilerOptions: {
775-
...defaultTsOptions,
776-
target: 'es2022',
777-
lib: ['es2022', 'esnext.disposable', 'dom'],
778-
module: 'NodeNext',
779-
780-
// Temporarily, because it makes it impossible for us to use @internal functions
781-
// from other packages. Annoyingly, VSCode won't show an error if you use @internal
782-
// because it looks at the .ts, but the compilation will fail because it will use
783-
// the .d.ts.
784-
stripInternal: false,
785-
},
786-
},
787-
788-
jestOptions: jestOptionsForProject({
789-
jestConfig: {
790-
coverageThreshold: {
791-
// We want to improve our test coverage
792-
// DO NOT LOWER THESE VALUES!
793-
// If you need to break glass, open an issue to re-up the values with additional test coverage
794-
statements: 70,
795-
branches: 70,
796-
functions: 70,
797-
lines: 70,
798-
},
799-
// We have many tests here that commonly time out
800-
testTimeout: 30_000,
801-
testEnvironment: './test/_helpers/jest-bufferedconsole.ts',
802-
setupFilesAfterEnv: ['<rootDir>/test/_helpers/jest-setup-after-env.ts'],
803-
},
804-
}),
805-
}),
806-
);
807-
808-
new TypecheckTests(tmpToolkitHelpers);
809-
810-
// Prevent imports of private API surface
811-
tmpToolkitHelpers.package.addField('exports', {
812-
'.': './lib/index.js',
813-
'./package.json': './package.json',
814-
'./api': './lib/api/index.js',
815-
'./util': './lib/util/index.js',
816-
});
817-
818-
tmpToolkitHelpers.eslint?.addRules({
819-
'@cdklabs/no-throw-default-error': 'error',
820-
});
821-
tmpToolkitHelpers.eslint?.addOverride({
822-
files: ['./test/**'],
823-
rules: {
824-
'@cdklabs/no-throw-default-error': 'off',
825-
},
826-
});
827-
828-
tmpToolkitHelpers.gitignore.addPatterns('test/**/*.map');
829-
830-
tmpToolkitHelpers.npmignore?.addPatterns(
831-
'!lib/api/bootstrap/bootstrap-template.yaml',
832-
);
833-
tmpToolkitHelpers.postCompileTask.exec('mkdir -p ./lib/api/bootstrap/ && cp ../../aws-cdk/lib/api/bootstrap/bootstrap-template.yaml ./lib/api/bootstrap/');
834-
835-
//////////////////////////////////////////////////////////////////////
836-
837707
const TOOLKIT_LIB_EXCLUDE_PATTERNS = [
838708
'lib/init-templates/*/typescript/*/*.template.ts',
839709
];
@@ -914,12 +784,12 @@ const toolkitLib = configureProject(
914784
'@smithy/types',
915785
'@types/fs-extra',
916786
'@types/split2',
917-
tmpToolkitHelpers,
918787
'aws-cdk-lib',
919788
'aws-sdk-client-mock',
920789
'aws-sdk-client-mock-jest',
921790
'[email protected]', // use this specific version because newer versions are much slower. This is a temporary arrangement we hope to remove soon anyway.
922791
'esbuild',
792+
'fast-check',
923793
'typedoc',
924794
'@microsoft/api-extractor',
925795
],
@@ -936,10 +806,10 @@ const toolkitLib = configureProject(
936806
jestConfig: {
937807
coverageThreshold: {
938808
// this is very sad but we will get better
939-
statements: 85,
940-
branches: 76,
941-
functions: 77,
942-
lines: 85,
809+
statements: 60,
810+
branches: 70,
811+
functions: 55,
812+
lines: 60,
943813
},
944814
testEnvironment: './test/_helpers/jest-bufferedconsole.ts',
945815
setupFilesAfterEnv: ['<rootDir>/test/_helpers/jest-setup-after-env.ts'],
@@ -1021,13 +891,6 @@ new pj.JsonFile(toolkitLib, 'api-extractor.json', {
1021891
// Eslint rules
1022892
toolkitLib.eslint?.addRules({
1023893
'@cdklabs/no-throw-default-error': 'error',
1024-
'import/no-restricted-paths': ['error', {
1025-
zones: [{
1026-
target: './',
1027-
from: '../tmp-toolkit-helpers',
1028-
message: 'All `@aws-cdk/tmp-toolkit-helpers` code must be used via lib/api/shared-*.ts',
1029-
}],
1030-
}],
1031894
});
1032895
toolkitLib.eslint?.addOverride({
1033896
files: ['./test/**'],
@@ -1142,7 +1005,6 @@ const cli = configureProject(
11421005
nodeBundle,
11431006
yargsGen,
11441007
cliPluginContract,
1145-
tmpToolkitHelpers,
11461008
toolkitLib,
11471009
'@octokit/rest',
11481010
'@types/archiver',
@@ -1241,6 +1103,15 @@ const cli = configureProject(
12411103
skipLibCheck: true,
12421104
},
12431105
},
1106+
tsconfigDev: {
1107+
compilerOptions: {
1108+
...defaultTsOptions,
1109+
lib: ['es2019', 'esnext.disposable', 'es2022.error'],
1110+
esModuleInterop: false,
1111+
skipLibCheck: true,
1112+
},
1113+
1114+
},
12441115
eslintOptions: {
12451116
dirs: ['lib'],
12461117
ignorePatterns: ['*.template.ts', '*.d.ts', 'test/**/*.ts'],
@@ -1356,7 +1227,7 @@ cli.gitignore.addPatterns('build-info.json');
13561227
const cliPackageJson = `${cli.workspaceDirectory}/package.json`;
13571228

13581229
cli.preCompileTask.prependExec('./generate.sh');
1359-
cli.preCompileTask.prependExec('ts-node --prefer-ts-exts scripts/user-input-gen.ts');
1230+
cli.preCompileTask.prependExec('ts-node -P tsconfig.dev.json --prefer-ts-exts scripts/user-input-gen.ts');
13601231

13611232
const includeCliResourcesCommands = [
13621233
'cp $(node -p \'require.resolve("cdk-from-cfn/index_bg.wasm")\') ./lib/',

aws-cdk-cli.code-workspace

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/cli-lib-alpha/.projen/tasks.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/integ-runner/.projen/tasks.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/tmp-toolkit-helpers/.eslintrc.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)