@guardian/cdk 0.0.0-canary-20260805130549
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -0
- package/bin/gu-cdk +5 -0
- package/lib/aspects/cfn-include-reporter.d.ts +9 -0
- package/lib/aspects/cfn-include-reporter.d.ts.map +1 -0
- package/lib/aspects/cfn-include-reporter.js +18 -0
- package/lib/aspects/cfn-include-reporter.js.map +1 -0
- package/lib/aspects/cfn-parameter-reporter.d.ts +9 -0
- package/lib/aspects/cfn-parameter-reporter.d.ts.map +1 -0
- package/lib/aspects/cfn-parameter-reporter.js +21 -0
- package/lib/aspects/cfn-parameter-reporter.js.map +1 -0
- package/lib/aspects/metadata.d.ts +8 -0
- package/lib/aspects/metadata.d.ts.map +1 -0
- package/lib/aspects/metadata.js +28 -0
- package/lib/aspects/metadata.js.map +1 -0
- package/lib/bin/aws-credential-provider.d.ts +3 -0
- package/lib/bin/aws-credential-provider.d.ts.map +1 -0
- package/lib/bin/aws-credential-provider.js +9 -0
- package/lib/bin/aws-credential-provider.js.map +1 -0
- package/lib/bin/commands/account-readiness/index.d.ts +11 -0
- package/lib/bin/commands/account-readiness/index.d.ts.map +1 -0
- package/lib/bin/commands/account-readiness/index.js +26 -0
- package/lib/bin/commands/account-readiness/index.js.map +1 -0
- package/lib/bin/commands/account-readiness/ssm.d.ts +12 -0
- package/lib/bin/commands/account-readiness/ssm.d.ts.map +1 -0
- package/lib/bin/commands/account-readiness/ssm.js +76 -0
- package/lib/bin/commands/account-readiness/ssm.js.map +1 -0
- package/lib/bin/commands/aws-cdk-version.d.ts +3 -0
- package/lib/bin/commands/aws-cdk-version.d.ts.map +1 -0
- package/lib/bin/commands/aws-cdk-version.js +9 -0
- package/lib/bin/commands/aws-cdk-version.js.map +1 -0
- package/lib/bin/commands/new-project/index.d.ts +14 -0
- package/lib/bin/commands/new-project/index.d.ts.map +1 -0
- package/lib/bin/commands/new-project/index.js +134 -0
- package/lib/bin/commands/new-project/index.js.map +1 -0
- package/lib/bin/commands/new-project/template/.gitignore.template +11 -0
- package/lib/bin/commands/new-project/template/README.md +5 -0
- package/lib/bin/commands/new-project/template/bin/.ignore +2 -0
- package/lib/bin/commands/new-project/template/cdk.json +7 -0
- package/lib/bin/commands/new-project/template/eslint.config.mjs +6 -0
- package/lib/bin/commands/new-project/template/jest.setup.js +2 -0
- package/lib/bin/commands/new-project/template/tsconfig.json.template +12 -0
- package/lib/bin/commands/new-project/utils/app.d.ts +23 -0
- package/lib/bin/commands/new-project/utils/app.d.ts.map +1 -0
- package/lib/bin/commands/new-project/utils/app.js +36 -0
- package/lib/bin/commands/new-project/utils/app.js.map +1 -0
- package/lib/bin/commands/new-project/utils/imports.d.ts +11 -0
- package/lib/bin/commands/new-project/utils/imports.d.ts.map +1 -0
- package/lib/bin/commands/new-project/utils/imports.js +107 -0
- package/lib/bin/commands/new-project/utils/imports.js.map +1 -0
- package/lib/bin/commands/new-project/utils/init.d.ts +13 -0
- package/lib/bin/commands/new-project/utils/init.d.ts.map +1 -0
- package/lib/bin/commands/new-project/utils/init.js +113 -0
- package/lib/bin/commands/new-project/utils/init.js.map +1 -0
- package/lib/bin/commands/new-project/utils/snapshot.d.ts +21 -0
- package/lib/bin/commands/new-project/utils/snapshot.d.ts.map +1 -0
- package/lib/bin/commands/new-project/utils/snapshot.js +41 -0
- package/lib/bin/commands/new-project/utils/snapshot.js.map +1 -0
- package/lib/bin/commands/new-project/utils/stack.d.ts +21 -0
- package/lib/bin/commands/new-project/utils/stack.d.ts.map +1 -0
- package/lib/bin/commands/new-project/utils/stack.js +40 -0
- package/lib/bin/commands/new-project/utils/stack.js.map +1 -0
- package/lib/bin/commands/new-project/utils/utils.d.ts +12 -0
- package/lib/bin/commands/new-project/utils/utils.d.ts.map +1 -0
- package/lib/bin/commands/new-project/utils/utils.js +16 -0
- package/lib/bin/commands/new-project/utils/utils.js.map +1 -0
- package/lib/bin/index.d.ts +3 -0
- package/lib/bin/index.d.ts.map +1 -0
- package/lib/bin/index.js +124 -0
- package/lib/bin/index.js.map +1 -0
- package/lib/constants/__mocks__/library-info.d.ts +6 -0
- package/lib/constants/__mocks__/library-info.d.ts.map +1 -0
- package/lib/constants/__mocks__/library-info.js +11 -0
- package/lib/constants/__mocks__/library-info.js.map +1 -0
- package/lib/constants/__mocks__/tracking-tag.d.ts +5 -0
- package/lib/constants/__mocks__/tracking-tag.d.ts.map +1 -0
- package/lib/constants/__mocks__/tracking-tag.js +9 -0
- package/lib/constants/__mocks__/tracking-tag.js.map +1 -0
- package/lib/constants/access.d.ts +18 -0
- package/lib/constants/access.d.ts.map +1 -0
- package/lib/constants/access.js +22 -0
- package/lib/constants/access.js.map +1 -0
- package/lib/constants/context-keys.d.ts +7 -0
- package/lib/constants/context-keys.d.ts.map +1 -0
- package/lib/constants/context-keys.js +10 -0
- package/lib/constants/context-keys.js.map +1 -0
- package/lib/constants/fastly-aws-account-id.d.ts +8 -0
- package/lib/constants/fastly-aws-account-id.d.ts.map +1 -0
- package/lib/constants/fastly-aws-account-id.js +11 -0
- package/lib/constants/fastly-aws-account-id.js.map +1 -0
- package/lib/constants/index.d.ts +9 -0
- package/lib/constants/index.d.ts.map +1 -0
- package/lib/constants/index.js +25 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/constants/library-info.d.ts +28 -0
- package/lib/constants/library-info.d.ts.map +1 -0
- package/lib/constants/library-info.js +46 -0
- package/lib/constants/library-info.js.map +1 -0
- package/lib/constants/metadata-keys.d.ts +9 -0
- package/lib/constants/metadata-keys.d.ts.map +1 -0
- package/lib/constants/metadata-keys.js +12 -0
- package/lib/constants/metadata-keys.js.map +1 -0
- package/lib/constants/regex-pattern.d.ts +5 -0
- package/lib/constants/regex-pattern.d.ts.map +1 -0
- package/lib/constants/regex-pattern.js +11 -0
- package/lib/constants/regex-pattern.js.map +1 -0
- package/lib/constants/ssm-parameter-paths.d.ts +24 -0
- package/lib/constants/ssm-parameter-paths.d.ts.map +1 -0
- package/lib/constants/ssm-parameter-paths.js +56 -0
- package/lib/constants/ssm-parameter-paths.js.map +1 -0
- package/lib/constants/tracking-tag.d.ts +5 -0
- package/lib/constants/tracking-tag.d.ts.map +1 -0
- package/lib/constants/tracking-tag.js +10 -0
- package/lib/constants/tracking-tag.js.map +1 -0
- package/lib/constructs/acm/certificate.d.ts +24 -0
- package/lib/constructs/acm/certificate.d.ts.map +1 -0
- package/lib/constructs/acm/certificate.js +34 -0
- package/lib/constructs/acm/certificate.js.map +1 -0
- package/lib/constructs/acm/index.d.ts +2 -0
- package/lib/constructs/acm/index.d.ts.map +1 -0
- package/lib/constructs/acm/index.js +18 -0
- package/lib/constructs/acm/index.js.map +1 -0
- package/lib/constructs/autoscaling/asg.d.ts +75 -0
- package/lib/constructs/autoscaling/asg.d.ts.map +1 -0
- package/lib/constructs/autoscaling/asg.js +103 -0
- package/lib/constructs/autoscaling/asg.js.map +1 -0
- package/lib/constructs/autoscaling/index.d.ts +3 -0
- package/lib/constructs/autoscaling/index.d.ts.map +1 -0
- package/lib/constructs/autoscaling/index.js +19 -0
- package/lib/constructs/autoscaling/index.js.map +1 -0
- package/lib/constructs/autoscaling/user-data.d.ts +28 -0
- package/lib/constructs/autoscaling/user-data.d.ts.map +1 -0
- package/lib/constructs/autoscaling/user-data.js +66 -0
- package/lib/constructs/autoscaling/user-data.js.map +1 -0
- package/lib/constructs/cloudwatch/alarm.d.ts +35 -0
- package/lib/constructs/cloudwatch/alarm.d.ts.map +1 -0
- package/lib/constructs/cloudwatch/alarm.js +37 -0
- package/lib/constructs/cloudwatch/alarm.js.map +1 -0
- package/lib/constructs/cloudwatch/api-gateway-alarms.d.ts +17 -0
- package/lib/constructs/cloudwatch/api-gateway-alarms.d.ts.map +1 -0
- package/lib/constructs/cloudwatch/api-gateway-alarms.js +39 -0
- package/lib/constructs/cloudwatch/api-gateway-alarms.js.map +1 -0
- package/lib/constructs/cloudwatch/ec2-alarms.d.ts +36 -0
- package/lib/constructs/cloudwatch/ec2-alarms.d.ts.map +1 -0
- package/lib/constructs/cloudwatch/ec2-alarms.js +102 -0
- package/lib/constructs/cloudwatch/ec2-alarms.js.map +1 -0
- package/lib/constructs/cloudwatch/index.d.ts +5 -0
- package/lib/constructs/cloudwatch/index.d.ts.map +1 -0
- package/lib/constructs/cloudwatch/index.js +21 -0
- package/lib/constructs/cloudwatch/index.js.map +1 -0
- package/lib/constructs/cloudwatch/lambda-alarms.d.ts +43 -0
- package/lib/constructs/cloudwatch/lambda-alarms.d.ts.map +1 -0
- package/lib/constructs/cloudwatch/lambda-alarms.js +54 -0
- package/lib/constructs/cloudwatch/lambda-alarms.js.map +1 -0
- package/lib/constructs/cloudwatch/no-monitoring.d.ts +4 -0
- package/lib/constructs/cloudwatch/no-monitoring.d.ts.map +1 -0
- package/lib/constructs/cloudwatch/no-monitoring.js +3 -0
- package/lib/constructs/cloudwatch/no-monitoring.js.map +1 -0
- package/lib/constructs/core/identity.d.ts +16 -0
- package/lib/constructs/core/identity.d.ts.map +1 -0
- package/lib/constructs/core/identity.js +21 -0
- package/lib/constructs/core/identity.js.map +1 -0
- package/lib/constructs/core/index.d.ts +5 -0
- package/lib/constructs/core/index.d.ts.map +1 -0
- package/lib/constructs/core/index.js +21 -0
- package/lib/constructs/core/index.js.map +1 -0
- package/lib/constructs/core/migrating.d.ts +11 -0
- package/lib/constructs/core/migrating.d.ts.map +1 -0
- package/lib/constructs/core/migrating.js +3 -0
- package/lib/constructs/core/migrating.js.map +1 -0
- package/lib/constructs/core/parameters/acm.d.ts +7 -0
- package/lib/constructs/core/parameters/acm.d.ts.map +1 -0
- package/lib/constructs/core/parameters/acm.js +17 -0
- package/lib/constructs/core/parameters/acm.js.map +1 -0
- package/lib/constructs/core/parameters/anghammarad.d.ts +20 -0
- package/lib/constructs/core/parameters/anghammarad.d.ts.map +1 -0
- package/lib/constructs/core/parameters/anghammarad.js +35 -0
- package/lib/constructs/core/parameters/anghammarad.js.map +1 -0
- package/lib/constructs/core/parameters/base.d.ts +20 -0
- package/lib/constructs/core/parameters/base.d.ts.map +1 -0
- package/lib/constructs/core/parameters/base.js +33 -0
- package/lib/constructs/core/parameters/base.js.map +1 -0
- package/lib/constructs/core/parameters/ec2.d.ts +7 -0
- package/lib/constructs/core/parameters/ec2.d.ts.map +1 -0
- package/lib/constructs/core/parameters/ec2.js +16 -0
- package/lib/constructs/core/parameters/ec2.js.map +1 -0
- package/lib/constructs/core/parameters/fastly.d.ts +13 -0
- package/lib/constructs/core/parameters/fastly.d.ts.map +1 -0
- package/lib/constructs/core/parameters/fastly.js +28 -0
- package/lib/constructs/core/parameters/fastly.js.map +1 -0
- package/lib/constructs/core/parameters/index.d.ts +9 -0
- package/lib/constructs/core/parameters/index.d.ts.map +1 -0
- package/lib/constructs/core/parameters/index.js +25 -0
- package/lib/constructs/core/parameters/index.js.map +1 -0
- package/lib/constructs/core/parameters/log-shipping.d.ts +8 -0
- package/lib/constructs/core/parameters/log-shipping.d.ts.map +1 -0
- package/lib/constructs/core/parameters/log-shipping.js +23 -0
- package/lib/constructs/core/parameters/log-shipping.js.map +1 -0
- package/lib/constructs/core/parameters/s3.d.ts +25 -0
- package/lib/constructs/core/parameters/s3.d.ts.map +1 -0
- package/lib/constructs/core/parameters/s3.js +58 -0
- package/lib/constructs/core/parameters/s3.js.map +1 -0
- package/lib/constructs/core/parameters/vpc.d.ts +17 -0
- package/lib/constructs/core/parameters/vpc.d.ts.map +1 -0
- package/lib/constructs/core/parameters/vpc.js +35 -0
- package/lib/constructs/core/parameters/vpc.js.map +1 -0
- package/lib/constructs/core/stack.d.ts +166 -0
- package/lib/constructs/core/stack.d.ts.map +1 -0
- package/lib/constructs/core/stack.js +183 -0
- package/lib/constructs/core/stack.js.map +1 -0
- package/lib/constructs/dns/dns-records.d.ts +37 -0
- package/lib/constructs/dns/dns-records.d.ts.map +1 -0
- package/lib/constructs/dns/dns-records.js +75 -0
- package/lib/constructs/dns/dns-records.js.map +1 -0
- package/lib/constructs/dns/index.d.ts +2 -0
- package/lib/constructs/dns/index.d.ts.map +1 -0
- package/lib/constructs/dns/index.js +18 -0
- package/lib/constructs/dns/index.js.map +1 -0
- package/lib/constructs/dynamodb/dynamodb.d.ts +31 -0
- package/lib/constructs/dynamodb/dynamodb.d.ts.map +1 -0
- package/lib/constructs/dynamodb/dynamodb.js +18 -0
- package/lib/constructs/dynamodb/dynamodb.js.map +1 -0
- package/lib/constructs/dynamodb/index.d.ts +2 -0
- package/lib/constructs/dynamodb/index.d.ts.map +1 -0
- package/lib/constructs/dynamodb/index.js +18 -0
- package/lib/constructs/dynamodb/index.js.map +1 -0
- package/lib/constructs/ec2/index.d.ts +3 -0
- package/lib/constructs/ec2/index.d.ts.map +1 -0
- package/lib/constructs/ec2/index.js +19 -0
- package/lib/constructs/ec2/index.js.map +1 -0
- package/lib/constructs/ec2/security-groups/base.d.ts +60 -0
- package/lib/constructs/ec2/security-groups/base.d.ts.map +1 -0
- package/lib/constructs/ec2/security-groups/base.js +57 -0
- package/lib/constructs/ec2/security-groups/base.js.map +1 -0
- package/lib/constructs/ec2/security-groups/index.d.ts +2 -0
- package/lib/constructs/ec2/security-groups/index.d.ts.map +1 -0
- package/lib/constructs/ec2/security-groups/index.js +18 -0
- package/lib/constructs/ec2/security-groups/index.js.map +1 -0
- package/lib/constructs/ec2/vpc.d.ts +26 -0
- package/lib/constructs/ec2/vpc.d.ts.map +1 -0
- package/lib/constructs/ec2/vpc.js +76 -0
- package/lib/constructs/ec2/vpc.js.map +1 -0
- package/lib/constructs/ecs/ecs-task.d.ts +139 -0
- package/lib/constructs/ecs/ecs-task.d.ts.map +1 -0
- package/lib/constructs/ecs/ecs-task.js +169 -0
- package/lib/constructs/ecs/ecs-task.js.map +1 -0
- package/lib/constructs/ecs/index.d.ts +2 -0
- package/lib/constructs/ecs/index.d.ts.map +1 -0
- package/lib/constructs/ecs/index.js +18 -0
- package/lib/constructs/ecs/index.js.map +1 -0
- package/lib/constructs/iam/fastly-logs-iam.d.ts +38 -0
- package/lib/constructs/iam/fastly-logs-iam.d.ts.map +1 -0
- package/lib/constructs/iam/fastly-logs-iam.js +44 -0
- package/lib/constructs/iam/fastly-logs-iam.js.map +1 -0
- package/lib/constructs/iam/index.d.ts +4 -0
- package/lib/constructs/iam/index.d.ts.map +1 -0
- package/lib/constructs/iam/index.js +20 -0
- package/lib/constructs/iam/index.js.map +1 -0
- package/lib/constructs/iam/policies/anghammarad.d.ts +15 -0
- package/lib/constructs/iam/policies/anghammarad.d.ts.map +1 -0
- package/lib/constructs/iam/policies/anghammarad.js +30 -0
- package/lib/constructs/iam/policies/anghammarad.js.map +1 -0
- package/lib/constructs/iam/policies/assume-role.d.ts +10 -0
- package/lib/constructs/iam/policies/assume-role.d.ts.map +1 -0
- package/lib/constructs/iam/policies/assume-role.js +21 -0
- package/lib/constructs/iam/policies/assume-role.js.map +1 -0
- package/lib/constructs/iam/policies/base-policy.d.ts +20 -0
- package/lib/constructs/iam/policies/base-policy.d.ts.map +1 -0
- package/lib/constructs/iam/policies/base-policy.js +33 -0
- package/lib/constructs/iam/policies/base-policy.js.map +1 -0
- package/lib/constructs/iam/policies/cloudwatch.d.ts +14 -0
- package/lib/constructs/iam/policies/cloudwatch.d.ts.map +1 -0
- package/lib/constructs/iam/policies/cloudwatch.js +28 -0
- package/lib/constructs/iam/policies/cloudwatch.js.map +1 -0
- package/lib/constructs/iam/policies/describe-ec2.d.ts +8 -0
- package/lib/constructs/iam/policies/describe-ec2.d.ts.map +1 -0
- package/lib/constructs/iam/policies/describe-ec2.js +33 -0
- package/lib/constructs/iam/policies/describe-ec2.js.map +1 -0
- package/lib/constructs/iam/policies/dynamodb.d.ts +20 -0
- package/lib/constructs/iam/policies/dynamodb.d.ts.map +1 -0
- package/lib/constructs/iam/policies/dynamodb.js +32 -0
- package/lib/constructs/iam/policies/dynamodb.js.map +1 -0
- package/lib/constructs/iam/policies/index.d.ts +13 -0
- package/lib/constructs/iam/policies/index.d.ts.map +1 -0
- package/lib/constructs/iam/policies/index.js +29 -0
- package/lib/constructs/iam/policies/index.js.map +1 -0
- package/lib/constructs/iam/policies/kcl.d.ts +17 -0
- package/lib/constructs/iam/policies/kcl.d.ts.map +1 -0
- package/lib/constructs/iam/policies/kcl.js +60 -0
- package/lib/constructs/iam/policies/kcl.js.map +1 -0
- package/lib/constructs/iam/policies/log-shipping.d.ts +8 -0
- package/lib/constructs/iam/policies/log-shipping.d.ts.map +1 -0
- package/lib/constructs/iam/policies/log-shipping.js +24 -0
- package/lib/constructs/iam/policies/log-shipping.js.map +1 -0
- package/lib/constructs/iam/policies/parameter-store-read.d.ts +39 -0
- package/lib/constructs/iam/policies/parameter-store-read.d.ts.map +1 -0
- package/lib/constructs/iam/policies/parameter-store-read.js +73 -0
- package/lib/constructs/iam/policies/parameter-store-read.js.map +1 -0
- package/lib/constructs/iam/policies/s3-get-object.d.ts +57 -0
- package/lib/constructs/iam/policies/s3-get-object.d.ts.map +1 -0
- package/lib/constructs/iam/policies/s3-get-object.js +73 -0
- package/lib/constructs/iam/policies/s3-get-object.js.map +1 -0
- package/lib/constructs/iam/policies/s3-put-object.d.ts +11 -0
- package/lib/constructs/iam/policies/s3-put-object.d.ts.map +1 -0
- package/lib/constructs/iam/policies/s3-put-object.js +13 -0
- package/lib/constructs/iam/policies/s3-put-object.js.map +1 -0
- package/lib/constructs/iam/policies/ses.d.ts +15 -0
- package/lib/constructs/iam/policies/ses.d.ts.map +1 -0
- package/lib/constructs/iam/policies/ses.js +14 -0
- package/lib/constructs/iam/policies/ses.js.map +1 -0
- package/lib/constructs/iam/policies/ssm-ssh.d.ts +19 -0
- package/lib/constructs/iam/policies/ssm-ssh.d.ts.map +1 -0
- package/lib/constructs/iam/policies/ssm-ssh.js +49 -0
- package/lib/constructs/iam/policies/ssm-ssh.js.map +1 -0
- package/lib/constructs/iam/roles/github-actions.d.ts +41 -0
- package/lib/constructs/iam/roles/github-actions.d.ts.map +1 -0
- package/lib/constructs/iam/roles/github-actions.js +77 -0
- package/lib/constructs/iam/roles/github-actions.js.map +1 -0
- package/lib/constructs/iam/roles/index.d.ts +4 -0
- package/lib/constructs/iam/roles/index.d.ts.map +1 -0
- package/lib/constructs/iam/roles/index.js +20 -0
- package/lib/constructs/iam/roles/index.js.map +1 -0
- package/lib/constructs/iam/roles/instance-role.d.ts +38 -0
- package/lib/constructs/iam/roles/instance-role.d.ts.map +1 -0
- package/lib/constructs/iam/roles/instance-role.js +45 -0
- package/lib/constructs/iam/roles/instance-role.js.map +1 -0
- package/lib/constructs/iam/roles/roles.d.ts +8 -0
- package/lib/constructs/iam/roles/roles.d.ts.map +1 -0
- package/lib/constructs/iam/roles/roles.js +11 -0
- package/lib/constructs/iam/roles/roles.js.map +1 -0
- package/lib/constructs/kinesis/index.d.ts +2 -0
- package/lib/constructs/kinesis/index.d.ts.map +1 -0
- package/lib/constructs/kinesis/index.js +18 -0
- package/lib/constructs/kinesis/index.js.map +1 -0
- package/lib/constructs/kinesis/kinesis-stream.d.ts +14 -0
- package/lib/constructs/kinesis/kinesis-stream.d.ts.map +1 -0
- package/lib/constructs/kinesis/kinesis-stream.js +17 -0
- package/lib/constructs/kinesis/kinesis-stream.js.map +1 -0
- package/lib/constructs/lambda/index.d.ts +2 -0
- package/lib/constructs/lambda/index.d.ts.map +1 -0
- package/lib/constructs/lambda/index.js +18 -0
- package/lib/constructs/lambda/index.js.map +1 -0
- package/lib/constructs/lambda/lambda.d.ts +95 -0
- package/lib/constructs/lambda/lambda.d.ts.map +1 -0
- package/lib/constructs/lambda/lambda.js +115 -0
- package/lib/constructs/lambda/lambda.js.map +1 -0
- package/lib/constructs/loadbalancing/alb/application-listener.d.ts +49 -0
- package/lib/constructs/loadbalancing/alb/application-listener.d.ts.map +1 -0
- package/lib/constructs/loadbalancing/alb/application-listener.js +53 -0
- package/lib/constructs/loadbalancing/alb/application-listener.js.map +1 -0
- package/lib/constructs/loadbalancing/alb/application-load-balancer.d.ts +63 -0
- package/lib/constructs/loadbalancing/alb/application-load-balancer.d.ts.map +1 -0
- package/lib/constructs/loadbalancing/alb/application-load-balancer.js +70 -0
- package/lib/constructs/loadbalancing/alb/application-load-balancer.js.map +1 -0
- package/lib/constructs/loadbalancing/alb/application-target-group.d.ts +42 -0
- package/lib/constructs/loadbalancing/alb/application-target-group.d.ts.map +1 -0
- package/lib/constructs/loadbalancing/alb/application-target-group.js +64 -0
- package/lib/constructs/loadbalancing/alb/application-target-group.js.map +1 -0
- package/lib/constructs/loadbalancing/alb/index.d.ts +4 -0
- package/lib/constructs/loadbalancing/alb/index.d.ts.map +1 -0
- package/lib/constructs/loadbalancing/alb/index.js +20 -0
- package/lib/constructs/loadbalancing/alb/index.js.map +1 -0
- package/lib/constructs/loadbalancing/index.d.ts +2 -0
- package/lib/constructs/loadbalancing/index.d.ts.map +1 -0
- package/lib/constructs/loadbalancing/index.js +18 -0
- package/lib/constructs/loadbalancing/index.js.map +1 -0
- package/lib/constructs/rds/index.d.ts +2 -0
- package/lib/constructs/rds/index.d.ts.map +1 -0
- package/lib/constructs/rds/index.js +18 -0
- package/lib/constructs/rds/index.js.map +1 -0
- package/lib/constructs/rds/instance.d.ts +33 -0
- package/lib/constructs/rds/instance.d.ts.map +1 -0
- package/lib/constructs/rds/instance.js +27 -0
- package/lib/constructs/rds/instance.js.map +1 -0
- package/lib/constructs/root.d.ts +32 -0
- package/lib/constructs/root.d.ts.map +1 -0
- package/lib/constructs/root.js +46 -0
- package/lib/constructs/root.js.map +1 -0
- package/lib/constructs/s3/index.d.ts +18 -0
- package/lib/constructs/s3/index.d.ts.map +1 -0
- package/lib/constructs/s3/index.js +21 -0
- package/lib/constructs/s3/index.js.map +1 -0
- package/lib/constructs/ses/index.d.ts +35 -0
- package/lib/constructs/ses/index.d.ts.map +1 -0
- package/lib/constructs/ses/index.js +52 -0
- package/lib/constructs/ses/index.js.map +1 -0
- package/lib/constructs/vpc/index.d.ts +2 -0
- package/lib/constructs/vpc/index.d.ts.map +1 -0
- package/lib/constructs/vpc/index.js +18 -0
- package/lib/constructs/vpc/index.js.map +1 -0
- package/lib/constructs/vpc/vpc.d.ts +57 -0
- package/lib/constructs/vpc/vpc.d.ts.map +1 -0
- package/lib/constructs/vpc/vpc.js +91 -0
- package/lib/constructs/vpc/vpc.js.map +1 -0
- package/lib/experimental/constructs/iam/index.d.ts +2 -0
- package/lib/experimental/constructs/iam/index.d.ts.map +1 -0
- package/lib/experimental/constructs/iam/index.js +18 -0
- package/lib/experimental/constructs/iam/index.js.map +1 -0
- package/lib/experimental/constructs/iam/policies/developer-policy.d.ts +63 -0
- package/lib/experimental/constructs/iam/policies/developer-policy.d.ts.map +1 -0
- package/lib/experimental/constructs/iam/policies/developer-policy.js +150 -0
- package/lib/experimental/constructs/iam/policies/developer-policy.js.map +1 -0
- package/lib/experimental/constructs/iam/policies/index.d.ts +2 -0
- package/lib/experimental/constructs/iam/policies/index.d.ts.map +1 -0
- package/lib/experimental/constructs/iam/policies/index.js +18 -0
- package/lib/experimental/constructs/iam/policies/index.js.map +1 -0
- package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts +30 -0
- package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.d.ts.map +1 -0
- package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js +34 -0
- package/lib/experimental/constructs/iam/roles/fastly-kinesis-log.js.map +1 -0
- package/lib/experimental/constructs/iam/roles/index.d.ts +2 -0
- package/lib/experimental/constructs/iam/roles/index.d.ts.map +1 -0
- package/lib/experimental/constructs/iam/roles/index.js +18 -0
- package/lib/experimental/constructs/iam/roles/index.js.map +1 -0
- package/lib/experimental/constructs/policies/index.d.ts +2 -0
- package/lib/experimental/constructs/policies/index.d.ts.map +1 -0
- package/lib/experimental/constructs/policies/index.js +18 -0
- package/lib/experimental/constructs/policies/index.js.map +1 -0
- package/lib/experimental/constructs/policies/kinesis-put-records.d.ts +11 -0
- package/lib/experimental/constructs/policies/kinesis-put-records.d.ts.map +1 -0
- package/lib/experimental/constructs/policies/kinesis-put-records.js +12 -0
- package/lib/experimental/constructs/policies/kinesis-put-records.js.map +1 -0
- package/lib/experimental/constructs/riff-raff-deployment-id.d.ts +8 -0
- package/lib/experimental/constructs/riff-raff-deployment-id.d.ts.map +1 -0
- package/lib/experimental/constructs/riff-raff-deployment-id.js +21 -0
- package/lib/experimental/constructs/riff-raff-deployment-id.js.map +1 -0
- package/lib/experimental/patterns/ec2-app.d.ts +175 -0
- package/lib/experimental/patterns/ec2-app.d.ts.map +1 -0
- package/lib/experimental/patterns/ec2-app.js +412 -0
- package/lib/experimental/patterns/ec2-app.js.map +1 -0
- package/lib/experimental/patterns/gu-load-balanced-app.d.ts +360 -0
- package/lib/experimental/patterns/gu-load-balanced-app.d.ts.map +1 -0
- package/lib/experimental/patterns/gu-load-balanced-app.js +520 -0
- package/lib/experimental/patterns/gu-load-balanced-app.js.map +1 -0
- package/lib/experimental/patterns/index.d.ts +3 -0
- package/lib/experimental/patterns/index.d.ts.map +1 -0
- package/lib/experimental/patterns/index.js +19 -0
- package/lib/experimental/patterns/index.js.map +1 -0
- package/lib/experimental/patterns/kinesis-lambda.d.ts +75 -0
- package/lib/experimental/patterns/kinesis-lambda.d.ts.map +1 -0
- package/lib/experimental/patterns/kinesis-lambda.js +48 -0
- package/lib/experimental/patterns/kinesis-lambda.js.map +1 -0
- package/lib/experimental/patterns/sns-lambda.d.ts +62 -0
- package/lib/experimental/patterns/sns-lambda.d.ts.map +1 -0
- package/lib/experimental/patterns/sns-lambda.js +41 -0
- package/lib/experimental/patterns/sns-lambda.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/patterns/api-lambda.d.ts +61 -0
- package/lib/patterns/api-lambda.d.ts.map +1 -0
- package/lib/patterns/api-lambda.js +62 -0
- package/lib/patterns/api-lambda.js.map +1 -0
- package/lib/patterns/api-multiple-lambdas.d.ts +122 -0
- package/lib/patterns/api-multiple-lambdas.d.ts.map +1 -0
- package/lib/patterns/api-multiple-lambdas.js +93 -0
- package/lib/patterns/api-multiple-lambdas.js.map +1 -0
- package/lib/patterns/ec2-app/base.d.ts +325 -0
- package/lib/patterns/ec2-app/base.d.ts.map +1 -0
- package/lib/patterns/ec2-app/base.js +273 -0
- package/lib/patterns/ec2-app/base.js.map +1 -0
- package/lib/patterns/ec2-app/framework.d.ts +32 -0
- package/lib/patterns/ec2-app/framework.d.ts.map +1 -0
- package/lib/patterns/ec2-app/framework.js +46 -0
- package/lib/patterns/ec2-app/framework.js.map +1 -0
- package/lib/patterns/ec2-app/index.d.ts +3 -0
- package/lib/patterns/ec2-app/index.d.ts.map +1 -0
- package/lib/patterns/ec2-app/index.js +19 -0
- package/lib/patterns/ec2-app/index.js.map +1 -0
- package/lib/patterns/index.d.ts +6 -0
- package/lib/patterns/index.d.ts.map +1 -0
- package/lib/patterns/index.js +22 -0
- package/lib/patterns/index.js.map +1 -0
- package/lib/patterns/scheduled-ecs-task.d.ts +36 -0
- package/lib/patterns/scheduled-ecs-task.d.ts.map +1 -0
- package/lib/patterns/scheduled-ecs-task.js +30 -0
- package/lib/patterns/scheduled-ecs-task.js.map +1 -0
- package/lib/patterns/scheduled-lambda.d.ts +42 -0
- package/lib/patterns/scheduled-lambda.d.ts.map +1 -0
- package/lib/patterns/scheduled-lambda.js +33 -0
- package/lib/patterns/scheduled-lambda.js.map +1 -0
- package/lib/riff-raff-yaml-file/deployments/autoscaling.d.ts +5 -0
- package/lib/riff-raff-yaml-file/deployments/autoscaling.d.ts.map +1 -0
- package/lib/riff-raff-yaml-file/deployments/autoscaling.js +44 -0
- package/lib/riff-raff-yaml-file/deployments/autoscaling.js.map +1 -0
- package/lib/riff-raff-yaml-file/deployments/cloudformation.d.ts +7 -0
- package/lib/riff-raff-yaml-file/deployments/cloudformation.d.ts.map +1 -0
- package/lib/riff-raff-yaml-file/deployments/cloudformation.js +64 -0
- package/lib/riff-raff-yaml-file/deployments/cloudformation.js.map +1 -0
- package/lib/riff-raff-yaml-file/deployments/lambda.d.ts +5 -0
- package/lib/riff-raff-yaml-file/deployments/lambda.d.ts.map +1 -0
- package/lib/riff-raff-yaml-file/deployments/lambda.js +71 -0
- package/lib/riff-raff-yaml-file/deployments/lambda.js.map +1 -0
- package/lib/riff-raff-yaml-file/deployments/update-parameters.d.ts +3 -0
- package/lib/riff-raff-yaml-file/deployments/update-parameters.d.ts.map +1 -0
- package/lib/riff-raff-yaml-file/deployments/update-parameters.js +17 -0
- package/lib/riff-raff-yaml-file/deployments/update-parameters.js.map +1 -0
- package/lib/riff-raff-yaml-file/group-by.d.ts +8 -0
- package/lib/riff-raff-yaml-file/group-by.d.ts.map +1 -0
- package/lib/riff-raff-yaml-file/group-by.js +25 -0
- package/lib/riff-raff-yaml-file/group-by.js.map +1 -0
- package/lib/riff-raff-yaml-file/index.d.ts +71 -0
- package/lib/riff-raff-yaml-file/index.d.ts.map +1 -0
- package/lib/riff-raff-yaml-file/index.js +244 -0
- package/lib/riff-raff-yaml-file/index.js.map +1 -0
- package/lib/riff-raff-yaml-file/types.d.ts +35 -0
- package/lib/riff-raff-yaml-file/types.d.ts.map +1 -0
- package/lib/riff-raff-yaml-file/types.js +10 -0
- package/lib/riff-raff-yaml-file/types.js.map +1 -0
- package/lib/types/access.d.ts +66 -0
- package/lib/types/access.d.ts.map +1 -0
- package/lib/types/access.js +39 -0
- package/lib/types/access.js.map +1 -0
- package/lib/types/amigo.d.ts +17 -0
- package/lib/types/amigo.d.ts.map +1 -0
- package/lib/types/amigo.js +3 -0
- package/lib/types/amigo.js.map +1 -0
- package/lib/types/asg.d.ts +19 -0
- package/lib/types/asg.d.ts.map +1 -0
- package/lib/types/asg.js +3 -0
- package/lib/types/asg.js.map +1 -0
- package/lib/types/cli.d.ts +12 -0
- package/lib/types/cli.d.ts.map +1 -0
- package/lib/types/cli.js +3 -0
- package/lib/types/cli.js.map +1 -0
- package/lib/types/distributable.d.ts +19 -0
- package/lib/types/distributable.d.ts.map +1 -0
- package/lib/types/distributable.js +9 -0
- package/lib/types/distributable.js.map +1 -0
- package/lib/types/domain-names.d.ts +15 -0
- package/lib/types/domain-names.d.ts.map +1 -0
- package/lib/types/domain-names.js +3 -0
- package/lib/types/domain-names.js.map +1 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +21 -0
- package/lib/types/index.js.map +1 -0
- package/lib/utils/array.d.ts +7 -0
- package/lib/utils/array.d.ts.map +1 -0
- package/lib/utils/array.js +19 -0
- package/lib/utils/array.js.map +1 -0
- package/lib/utils/cli/vpc.d.ts +8 -0
- package/lib/utils/cli/vpc.d.ts.map +1 -0
- package/lib/utils/cli/vpc.js +74 -0
- package/lib/utils/cli/vpc.js.map +1 -0
- package/lib/utils/cognito/cognito.d.ts +2 -0
- package/lib/utils/cognito/cognito.d.ts.map +1 -0
- package/lib/utils/cognito/cognito.js +19 -0
- package/lib/utils/cognito/cognito.js.map +1 -0
- package/lib/utils/ec2/index.d.ts +2 -0
- package/lib/utils/ec2/index.d.ts.map +1 -0
- package/lib/utils/ec2/index.js +18 -0
- package/lib/utils/ec2/index.js.map +1 -0
- package/lib/utils/ec2/private-config.d.ts +11 -0
- package/lib/utils/ec2/private-config.d.ts.map +1 -0
- package/lib/utils/ec2/private-config.js +3 -0
- package/lib/utils/ec2/private-config.js.map +1 -0
- package/lib/utils/exec.d.ts +7 -0
- package/lib/utils/exec.d.ts.map +1 -0
- package/lib/utils/exec.js +46 -0
- package/lib/utils/exec.js.map +1 -0
- package/lib/utils/git.d.ts +3 -0
- package/lib/utils/git.d.ts.map +1 -0
- package/lib/utils/git.js +23 -0
- package/lib/utils/git.js.map +1 -0
- package/lib/utils/lambda/event-source.d.ts +52 -0
- package/lib/utils/lambda/event-source.d.ts.map +1 -0
- package/lib/utils/lambda/event-source.js +41 -0
- package/lib/utils/lambda/event-source.js.map +1 -0
- package/lib/utils/lambda/index.d.ts +2 -0
- package/lib/utils/lambda/index.d.ts.map +1 -0
- package/lib/utils/lambda/index.js +18 -0
- package/lib/utils/lambda/index.js.map +1 -0
- package/lib/utils/math.d.ts +2 -0
- package/lib/utils/math.d.ts.map +1 -0
- package/lib/utils/math.js +6 -0
- package/lib/utils/math.js.map +1 -0
- package/lib/utils/mixin/app-aware-construct.d.ts +11 -0
- package/lib/utils/mixin/app-aware-construct.d.ts.map +1 -0
- package/lib/utils/mixin/app-aware-construct.js +35 -0
- package/lib/utils/mixin/app-aware-construct.js.map +1 -0
- package/lib/utils/mixin/types.d.ts +2 -0
- package/lib/utils/mixin/types.d.ts.map +1 -0
- package/lib/utils/mixin/types.js +3 -0
- package/lib/utils/mixin/types.js.map +1 -0
- package/lib/utils/security-groups/helpers.d.ts +4 -0
- package/lib/utils/security-groups/helpers.d.ts.map +1 -0
- package/lib/utils/security-groups/helpers.js +15 -0
- package/lib/utils/security-groups/helpers.js.map +1 -0
- package/lib/utils/security-groups/index.d.ts +2 -0
- package/lib/utils/security-groups/index.d.ts.map +1 -0
- package/lib/utils/security-groups/index.js +18 -0
- package/lib/utils/security-groups/index.js.map +1 -0
- package/lib/utils/singleton.d.ts +40 -0
- package/lib/utils/singleton.d.ts.map +1 -0
- package/lib/utils/singleton.js +43 -0
- package/lib/utils/singleton.js.map +1 -0
- package/lib/utils/string.d.ts +3 -0
- package/lib/utils/string.d.ts.map +1 -0
- package/lib/utils/string.js +19 -0
- package/lib/utils/string.js.map +1 -0
- package/lib/utils/test/assertions.d.ts +24 -0
- package/lib/utils/test/assertions.d.ts.map +1 -0
- package/lib/utils/test/assertions.js +88 -0
- package/lib/utils/test/assertions.js.map +1 -0
- package/lib/utils/test/attach-policy-to-test-role.d.ts +4 -0
- package/lib/utils/test/attach-policy-to-test-role.d.ts.map +1 -0
- package/lib/utils/test/attach-policy-to-test-role.js +15 -0
- package/lib/utils/test/attach-policy-to-test-role.js.map +1 -0
- package/lib/utils/test/index.d.ts +5 -0
- package/lib/utils/test/index.d.ts.map +1 -0
- package/lib/utils/test/index.js +21 -0
- package/lib/utils/test/index.js.map +1 -0
- package/lib/utils/test/simple-gu-stack.d.ts +4 -0
- package/lib/utils/test/simple-gu-stack.d.ts.map +1 -0
- package/lib/utils/test/simple-gu-stack.js +13 -0
- package/lib/utils/test/simple-gu-stack.js.map +1 -0
- package/lib/utils/test/template.d.ts +12 -0
- package/lib/utils/test/template.d.ts.map +1 -0
- package/lib/utils/test/template.js +28 -0
- package/lib/utils/test/template.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CodeMaker } from "codemaker";
|
|
2
|
+
import type { Imports } from "./imports";
|
|
3
|
+
import type { Name } from "./utils";
|
|
4
|
+
interface AppBuilderProps {
|
|
5
|
+
imports: Imports;
|
|
6
|
+
appName: Name;
|
|
7
|
+
stack: Name;
|
|
8
|
+
stages: string[];
|
|
9
|
+
regions: string[];
|
|
10
|
+
outputFile: string;
|
|
11
|
+
outputDir: string;
|
|
12
|
+
comment?: string;
|
|
13
|
+
migrated?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class AppBuilder {
|
|
16
|
+
config: AppBuilderProps;
|
|
17
|
+
code: CodeMaker;
|
|
18
|
+
constructor(props: AppBuilderProps);
|
|
19
|
+
constructCdkFile(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare const constructApp: (props: AppBuilderProps) => Promise<void>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,UAAU,eAAe;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,UAAU;IACrB,MAAM,EAAE,eAAe,CAAC;IAExB,IAAI,EAAE,SAAS,CAAC;gBAEJ,KAAK,EAAE,eAAe;IAO5B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAyBxC;AAED,eAAO,MAAM,YAAY,GAAU,OAAO,eAAe,KAAG,OAAO,CAAC,IAAI,CAGvE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructApp = exports.AppBuilder = void 0;
|
|
4
|
+
const codemaker_1 = require("codemaker");
|
|
5
|
+
class AppBuilder {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.config = props;
|
|
8
|
+
this.code = new codemaker_1.CodeMaker({ indentationLevel: 2 });
|
|
9
|
+
this.code.closeBlockFormatter = (s) => s ?? "}";
|
|
10
|
+
}
|
|
11
|
+
async constructCdkFile() {
|
|
12
|
+
const { comment, outputFile, imports, appName, stack, outputDir, stages, regions } = this.config;
|
|
13
|
+
this.code.openFile(outputFile);
|
|
14
|
+
if (comment) {
|
|
15
|
+
this.code.line(comment);
|
|
16
|
+
this.code.line();
|
|
17
|
+
}
|
|
18
|
+
imports.render(this.code);
|
|
19
|
+
this.code.line("const app = new GuRoot();");
|
|
20
|
+
stages.forEach((stage) => {
|
|
21
|
+
regions.forEach((region) => {
|
|
22
|
+
const regionNoHyphen = region.replace("-", "");
|
|
23
|
+
this.code.line(`new ${appName.pascal}(app, "${appName.pascal}-${regionNoHyphen}-${stage}", { stack: "${stack.kebab}", stage: "${stage}", env: { region: "${region}" } });`);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
this.code.closeFile(outputFile);
|
|
27
|
+
await this.code.save(outputDir);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.AppBuilder = AppBuilder;
|
|
31
|
+
const constructApp = async (props) => {
|
|
32
|
+
const builder = new AppBuilder(props);
|
|
33
|
+
await builder.constructCdkFile();
|
|
34
|
+
};
|
|
35
|
+
exports.constructApp = constructApp;
|
|
36
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/app.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAgBtC,MAAa,UAAU;IAKrB,YAAY,KAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,IAAI,GAAG,IAAI,qBAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAEjG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAE5C,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzB,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,CACZ,OAAO,OAAO,CAAC,MAAM,UAAU,OAAO,CAAC,MAAM,IAAI,cAAc,IAAI,KAAK,gBAAgB,KAAK,CAAC,KAAK,cAAc,KAAK,sBAAsB,MAAM,SAAS,CAC5J,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAChC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;CACF;AArCD,gCAqCC;AAEM,MAAM,YAAY,GAAG,KAAK,EAAE,KAAsB,EAAiB,EAAE;IAC1E,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,YAAY,gBAGvB","sourcesContent":["import { CodeMaker } from \"codemaker\";\nimport type { Imports } from \"./imports\";\nimport type { Name } from \"./utils\";\n\ninterface AppBuilderProps {\n imports: Imports;\n appName: Name;\n stack: Name;\n stages: string[];\n regions: string[];\n outputFile: string;\n outputDir: string;\n comment?: string;\n migrated?: boolean;\n}\n\nexport class AppBuilder {\n config: AppBuilderProps;\n\n code: CodeMaker;\n\n constructor(props: AppBuilderProps) {\n this.config = props;\n\n this.code = new CodeMaker({ indentationLevel: 2 });\n this.code.closeBlockFormatter = (s?: string): string => s ?? \"}\";\n }\n\n async constructCdkFile(): Promise<void> {\n const { comment, outputFile, imports, appName, stack, outputDir, stages, regions } = this.config;\n\n this.code.openFile(outputFile);\n if (comment) {\n this.code.line(comment);\n this.code.line();\n }\n\n imports.render(this.code);\n\n this.code.line(\"const app = new GuRoot();\");\n\n stages.forEach((stage) => {\n regions.forEach((region) => {\n const regionNoHyphen = region.replace(\"-\", \"\");\n this.code.line(\n `new ${appName.pascal}(app, \"${appName.pascal}-${regionNoHyphen}-${stage}\", { stack: \"${stack.kebab}\", stage: \"${stage}\", env: { region: \"${region}\" } });`,\n );\n });\n });\n\n this.code.closeFile(outputFile);\n await this.code.save(outputDir);\n }\n}\n\nexport const constructApp = async (props: AppBuilderProps): Promise<void> => {\n const builder = new AppBuilder(props);\n await builder.constructCdkFile();\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CodeMaker } from "codemaker";
|
|
2
|
+
import type { Name } from "./utils";
|
|
3
|
+
export declare class Imports {
|
|
4
|
+
private readonly imports;
|
|
5
|
+
private constructor();
|
|
6
|
+
static newStackImports(addCfnIncludeImports: boolean): Imports;
|
|
7
|
+
static newAppImports({ kebab, pascal }: Name): Imports;
|
|
8
|
+
static newTestImports({ kebab, pascal }: Name): Imports;
|
|
9
|
+
render(code: CodeMaker): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/imports.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAQpC,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IAEjD,OAAO;WAIO,eAAe,CAAC,oBAAoB,EAAE,OAAO,GAAG,OAAO;WAuBvD,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,GAAG,OAAO;WAkB/C,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,GAAG,OAAO;IAiB9D,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;CAqC9B"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Imports = void 0;
|
|
4
|
+
const node_module_1 = require("node:module");
|
|
5
|
+
class Imports {
|
|
6
|
+
constructor(imports) {
|
|
7
|
+
this.imports = imports;
|
|
8
|
+
}
|
|
9
|
+
static newStackImports(addCfnIncludeImports) {
|
|
10
|
+
return new Imports({
|
|
11
|
+
...(addCfnIncludeImports && {
|
|
12
|
+
path: {
|
|
13
|
+
types: [],
|
|
14
|
+
components: ["join"],
|
|
15
|
+
},
|
|
16
|
+
"aws-cdk-lib/cloudformation-include": {
|
|
17
|
+
types: [],
|
|
18
|
+
components: ["CfnInclude"],
|
|
19
|
+
},
|
|
20
|
+
}),
|
|
21
|
+
"aws-cdk-lib": {
|
|
22
|
+
types: ["App"],
|
|
23
|
+
components: [],
|
|
24
|
+
},
|
|
25
|
+
"@guardian/cdk/lib/constructs/core": {
|
|
26
|
+
types: ["GuStackProps"],
|
|
27
|
+
components: ["GuStack"],
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
static newAppImports({ kebab, pascal }) {
|
|
32
|
+
return new Imports({
|
|
33
|
+
"source-map-support/register": {
|
|
34
|
+
basic: true,
|
|
35
|
+
types: [],
|
|
36
|
+
components: [],
|
|
37
|
+
},
|
|
38
|
+
"@guardian/cdk/lib/constructs/root": {
|
|
39
|
+
types: [],
|
|
40
|
+
components: ["GuRoot"],
|
|
41
|
+
},
|
|
42
|
+
[`../lib/${kebab}`]: {
|
|
43
|
+
types: [],
|
|
44
|
+
components: [pascal],
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
static newTestImports({ kebab, pascal }) {
|
|
49
|
+
return new Imports({
|
|
50
|
+
"aws-cdk-lib": {
|
|
51
|
+
types: [],
|
|
52
|
+
components: ["App"],
|
|
53
|
+
},
|
|
54
|
+
"aws-cdk-lib/assertions": {
|
|
55
|
+
types: [],
|
|
56
|
+
components: ["Template"],
|
|
57
|
+
},
|
|
58
|
+
[`./${kebab}`]: {
|
|
59
|
+
types: [],
|
|
60
|
+
components: [pascal],
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
render(code) {
|
|
65
|
+
Object.entries(this.imports)
|
|
66
|
+
// Render "basic" imports before any others, still in alphabetical order
|
|
67
|
+
// Render Node built-in imports before third-party imports (to satisfy `import/order`)
|
|
68
|
+
// Render relative imports after absolute imports
|
|
69
|
+
.sort(([aKey, aImports], [bKey, bImports]) => {
|
|
70
|
+
if (aImports.basic && !bImports.basic) {
|
|
71
|
+
return -1;
|
|
72
|
+
}
|
|
73
|
+
else if (bImports.basic && !aImports.basic) {
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
else if ((0, node_module_1.isBuiltin)(aKey) && !(0, node_module_1.isBuiltin)(bKey)) {
|
|
77
|
+
return -1;
|
|
78
|
+
}
|
|
79
|
+
else if ((0, node_module_1.isBuiltin)(bKey) && !(0, node_module_1.isBuiltin)(aKey)) {
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
else if (aKey.startsWith(".") && !bKey.startsWith(".")) {
|
|
83
|
+
return 1;
|
|
84
|
+
}
|
|
85
|
+
else if (bKey.startsWith(".") && !aKey.startsWith(".")) {
|
|
86
|
+
return -1;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return aKey.localeCompare(bKey);
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
.forEach(([lib, imports]) => {
|
|
93
|
+
if (imports.basic) {
|
|
94
|
+
code.line(`import "${lib}";`);
|
|
95
|
+
}
|
|
96
|
+
if (imports.types.length) {
|
|
97
|
+
code.line(`import type { ${imports.types.sort().join(", ")} } from "${lib}";`);
|
|
98
|
+
}
|
|
99
|
+
if (imports.components.length) {
|
|
100
|
+
code.line(`import { ${imports.components.sort().join(", ")} } from "${lib}";`);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
code.line();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.Imports = Imports;
|
|
107
|
+
//# sourceMappingURL=imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/imports.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAUxC,MAAa,OAAO;IAGlB,YAAoB,OAA+B;QACjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,eAAe,CAAC,oBAA6B;QACzD,OAAO,IAAI,OAAO,CAAC;YACjB,GAAG,CAAC,oBAAoB,IAAI;gBAC1B,IAAI,EAAE;oBACJ,KAAK,EAAE,EAAE;oBACT,UAAU,EAAE,CAAC,MAAM,CAAC;iBACrB;gBACD,oCAAoC,EAAE;oBACpC,KAAK,EAAE,EAAE;oBACT,UAAU,EAAE,CAAC,YAAY,CAAC;iBAC3B;aACF,CAAC;YACF,aAAa,EAAE;gBACb,KAAK,EAAE,CAAC,KAAK,CAAC;gBACd,UAAU,EAAE,EAAE;aACf;YACD,mCAAmC,EAAE;gBACnC,KAAK,EAAE,CAAC,cAAc,CAAC;gBACvB,UAAU,EAAE,CAAC,SAAS,CAAC;aACxB;SACF,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAQ;QACjD,OAAO,IAAI,OAAO,CAAC;YACjB,6BAA6B,EAAE;gBAC7B,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,EAAE;gBACT,UAAU,EAAE,EAAE;aACf;YACD,mCAAmC,EAAE;gBACnC,KAAK,EAAE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AAI,CAAC,IAAA,uBAAS,EAAC,IAAI,CAAC,EAAE,CAAC;gBAC/C,OAAO,CAAC,CAAC;YACX,CAAC;iBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzD,OAAO,CAAC,CAAC;YACX,CAAC;iBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzD,OAAO,CAAC,CAAC,CAAC;YACZ,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,CAAC;aACD,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE;YAC1B,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBAClB,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;YAChC,CAAC;YAED,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBACzB,IAAI,CAAC,IAAI,CAAC,iBAAiB,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;YACjF,CAAC;YAED,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC9B,IAAI,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;YACjF,CAAC;QACH,CAAC,CAAC,CAAC;QACL,IAAI,CAAC,IAAI,EAAE,CAAC;IACd,CAAC;CACF;AAtGD,0BAsGC","sourcesContent":["import { isBuiltin } from \"node:module\";\nimport type { CodeMaker } from \"codemaker\";\nimport type { Name } from \"./utils\";\n\ninterface Import {\n types: string[];\n components: string[];\n basic?: boolean;\n}\n\nexport class Imports {\n private readonly imports: Record<string, Import>;\n\n private constructor(imports: Record<string, Import>) {\n this.imports = imports;\n }\n\n public static newStackImports(addCfnIncludeImports: boolean): Imports {\n return new Imports({\n ...(addCfnIncludeImports && {\n path: {\n types: [],\n components: [\"join\"],\n },\n \"aws-cdk-lib/cloudformation-include\": {\n types: [],\n components: [\"CfnInclude\"],\n },\n }),\n \"aws-cdk-lib\": {\n types: [\"App\"],\n components: [],\n },\n \"@guardian/cdk/lib/constructs/core\": {\n types: [\"GuStackProps\"],\n components: [\"GuStack\"],\n },\n });\n }\n\n public static newAppImports({ kebab, pascal }: Name): Imports {\n return new Imports({\n \"source-map-support/register\": {\n basic: true,\n types: [],\n components: [],\n },\n \"@guardian/cdk/lib/constructs/root\": {\n types: [],\n components: [\"GuRoot\"],\n },\n [`../lib/${kebab}`]: {\n types: [],\n components: [pascal],\n },\n });\n }\n\n public static newTestImports({ kebab, pascal }: Name): Imports {\n return new Imports({\n \"aws-cdk-lib\": {\n types: [],\n components: [\"App\"],\n },\n \"aws-cdk-lib/assertions\": {\n types: [],\n components: [\"Template\"],\n },\n [`./${kebab}`]: {\n types: [],\n components: [pascal],\n },\n });\n }\n\n render(code: CodeMaker): void {\n Object.entries(this.imports)\n // Render \"basic\" imports before any others, still in alphabetical order\n // Render Node built-in imports before third-party imports (to satisfy `import/order`)\n // Render relative imports after absolute imports\n .sort(([aKey, aImports], [bKey, bImports]) => {\n if (aImports.basic && !bImports.basic) {\n return -1;\n } else if (bImports.basic && !aImports.basic) {\n return 1;\n } else if (isBuiltin(aKey) && !isBuiltin(bKey)) {\n return -1;\n } else if (isBuiltin(bKey) && !isBuiltin(aKey)) {\n return 1;\n } else if (aKey.startsWith(\".\") && !bKey.startsWith(\".\")) {\n return 1;\n } else if (bKey.startsWith(\".\") && !aKey.startsWith(\".\")) {\n return -1;\n } else {\n return aKey.localeCompare(bKey);\n }\n })\n .forEach(([lib, imports]) => {\n if (imports.basic) {\n code.line(`import \"${lib}\";`);\n }\n\n if (imports.types.length) {\n code.line(`import type { ${imports.types.sort().join(\", \")} } from \"${lib}\";`);\n }\n\n if (imports.components.length) {\n code.line(`import { ${imports.components.sort().join(\", \")} } from \"${lib}\";`);\n }\n });\n code.line();\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface InitConfig {
|
|
2
|
+
outputDir: string;
|
|
3
|
+
}
|
|
4
|
+
export declare class ProjectBuilder {
|
|
5
|
+
templateDir: string;
|
|
6
|
+
config: InitConfig;
|
|
7
|
+
static validateConfig: (config: InitConfig) => void;
|
|
8
|
+
constructor(config: InitConfig);
|
|
9
|
+
buildDirectory(): void;
|
|
10
|
+
copyFiles(sourcePath: string, targetPath: string): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const buildDirectory: (config: InitConfig) => void;
|
|
13
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/init.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,qBAAa,cAAc;IACzB,WAAW,SAA8B;IACzC,MAAM,EAAE,UAAU,CAAC;IAEnB,MAAM,CAAC,cAAc,GAAI,QAAQ,UAAU,KAAG,IAAI,CAKhD;gBAEU,MAAM,EAAE,UAAU;IAI9B,cAAc,IAAI,IAAI;IAkBtB,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;CAmBxD;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,KAAG,IAGnD,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildDirectory = exports.ProjectBuilder = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const constants_1 = require("../../../../constants");
|
|
7
|
+
// TODO: Add project name flag
|
|
8
|
+
class ProjectBuilder {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.templateDir = `${__dirname}/../template`;
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
buildDirectory() {
|
|
14
|
+
ProjectBuilder.validateConfig(this.config);
|
|
15
|
+
if (!(0, fs_1.existsSync)(this.config.outputDir)) {
|
|
16
|
+
console.log(`Creating ${this.config.outputDir}`);
|
|
17
|
+
(0, fs_1.mkdirSync)(this.config.outputDir);
|
|
18
|
+
}
|
|
19
|
+
console.log("Creating package.json");
|
|
20
|
+
createPackageJson(this.config.outputDir);
|
|
21
|
+
console.log("Copying template files");
|
|
22
|
+
// TODO: Replace any params in files with .template extensions
|
|
23
|
+
this.copyFiles(this.templateDir, this.config.outputDir);
|
|
24
|
+
console.log("Success!");
|
|
25
|
+
}
|
|
26
|
+
copyFiles(sourcePath, targetPath) {
|
|
27
|
+
for (const file of (0, fs_1.readdirSync)(sourcePath)) {
|
|
28
|
+
const path = (0, path_1.join)(sourcePath, file);
|
|
29
|
+
if (path.endsWith(".ignore")) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
else if ((0, fs_1.lstatSync)(path).isDirectory()) {
|
|
33
|
+
const nestedTargetPath = (0, path_1.join)(targetPath, file);
|
|
34
|
+
if (!(0, fs_1.existsSync)(nestedTargetPath)) {
|
|
35
|
+
(0, fs_1.mkdirSync)(nestedTargetPath);
|
|
36
|
+
}
|
|
37
|
+
this.copyFiles(path, nestedTargetPath);
|
|
38
|
+
}
|
|
39
|
+
else if (path.endsWith(".template")) {
|
|
40
|
+
(0, fs_1.copyFileSync)(path, (0, path_1.join)(targetPath, file.replace(".template", "")));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
(0, fs_1.copyFileSync)(path, (0, path_1.join)(targetPath, file));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ProjectBuilder = ProjectBuilder;
|
|
49
|
+
ProjectBuilder.validateConfig = (config) => {
|
|
50
|
+
const path = config.outputDir;
|
|
51
|
+
if ((0, fs_1.existsSync)(path) && (0, fs_1.readdirSync)(path).length > 0) {
|
|
52
|
+
throw new Error(`Directory ${path} is not empty`);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const buildDirectory = (config) => {
|
|
56
|
+
const builder = new ProjectBuilder(config);
|
|
57
|
+
builder.buildDirectory();
|
|
58
|
+
};
|
|
59
|
+
exports.buildDirectory = buildDirectory;
|
|
60
|
+
function createPackageJson(outputDirectory) {
|
|
61
|
+
const { NODE_ENV, CI } = process.env;
|
|
62
|
+
const isTest = NODE_ENV?.toUpperCase() === "TEST" || CI?.toUpperCase() === "TRUE";
|
|
63
|
+
const coreDeps = [
|
|
64
|
+
"@guardian/eslint-config",
|
|
65
|
+
"@guardian/tsconfig",
|
|
66
|
+
"@types/jest",
|
|
67
|
+
"@types/node",
|
|
68
|
+
"eslint",
|
|
69
|
+
"jest",
|
|
70
|
+
"prettier",
|
|
71
|
+
"ts-jest",
|
|
72
|
+
"ts-node",
|
|
73
|
+
"typescript",
|
|
74
|
+
].reduce((acc, depName) => ({ ...acc, [depName]: (0, constants_1.getDevDependency)(depName) }), {});
|
|
75
|
+
const cdkDeps = {
|
|
76
|
+
"@guardian/cdk": isTest ? `file:../guardian-cdk-${constants_1.LibraryInfo.VERSION}.tgz` : constants_1.LibraryInfo.VERSION,
|
|
77
|
+
"aws-cdk": constants_1.LibraryInfo.AWS_CDK_VERSION,
|
|
78
|
+
"aws-cdk-lib": constants_1.LibraryInfo.AWS_CDK_LIB_VERSION,
|
|
79
|
+
constructs: constants_1.LibraryInfo.CONSTRUCTS_VERSION,
|
|
80
|
+
};
|
|
81
|
+
const customDeps = {
|
|
82
|
+
"source-map-support": "^0.5.20",
|
|
83
|
+
"@guardian/prettier": "5.0.0",
|
|
84
|
+
};
|
|
85
|
+
const allDeps = { ...coreDeps, ...cdkDeps, ...customDeps };
|
|
86
|
+
const devDependencies = Object.keys(allDeps)
|
|
87
|
+
.sort()
|
|
88
|
+
.reduce((acc, depName) => ({ ...acc, [depName]: allDeps[depName] }), {});
|
|
89
|
+
const contents = {
|
|
90
|
+
name: "cdk",
|
|
91
|
+
version: "0.0.0",
|
|
92
|
+
private: true,
|
|
93
|
+
scripts: {
|
|
94
|
+
test: "jest",
|
|
95
|
+
"test-update": "jest -u",
|
|
96
|
+
format: 'prettier --write "{lib,bin}/**/*.ts"',
|
|
97
|
+
lint: "eslint lib/** bin/** --no-error-on-unmatched-pattern",
|
|
98
|
+
synth: "cdk synth --path-metadata false --version-reporting false",
|
|
99
|
+
diff: "cdk diff --path-metadata false --version-reporting false",
|
|
100
|
+
},
|
|
101
|
+
devDependencies,
|
|
102
|
+
prettier: "@guardian/prettier",
|
|
103
|
+
jest: {
|
|
104
|
+
testMatch: ["<rootDir>/lib/**/*.test.ts"],
|
|
105
|
+
transform: {
|
|
106
|
+
"^.+\\.tsx?$": "ts-jest",
|
|
107
|
+
},
|
|
108
|
+
setupFilesAfterEnv: ["./jest.setup.js"],
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
(0, fs_1.writeFileSync)(`${outputDirectory}/package.json`, JSON.stringify(contents, null, 2));
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/init.ts"],"names":[],"mappings":";;;AAAA,2BAAgG;AAChG,+BAA4B;AAC5B,qDAAsE;AAMtE,8BAA8B;AAC9B,MAAa,cAAc;IAWzB,YAAY,MAAkB;QAV9B,gBAAW,GAAG,GAAG,SAAS,cAAc,CAAC;QAWvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC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eAAe;QAEf,QAAQ,EAAE,oBAAoB;QAE9B,IAAI,EAAE;YACJ,SAAS,EAAE,CAAC,4BAA4B,CAAC;YACzC,SAAS,EAAE;gBACT,aAAa,EAAE,SAAS;aACzB;YACD,kBAAkB,EAAE,CAAC,iBAAiB,CAAC;SACxC;KACF,CAAC;IACF,IAAA,kBAAa,EAAC,GAAG,eAAe,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC","sourcesContent":["import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, writeFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { getDevDependency, LibraryInfo } from \"../../../../constants\";\n\nexport interface InitConfig {\n outputDir: string;\n}\n\n// TODO: Add project name flag\nexport class ProjectBuilder {\n templateDir = `${__dirname}/../template`;\n config: InitConfig;\n\n static validateConfig = (config: InitConfig): void => {\n const path = config.outputDir;\n if (existsSync(path) && readdirSync(path).length > 0) {\n throw new Error(`Directory ${path} is not empty`);\n }\n };\n\n constructor(config: InitConfig) {\n this.config = config;\n }\n\n buildDirectory(): void {\n ProjectBuilder.validateConfig(this.config);\n\n if (!existsSync(this.config.outputDir)) {\n console.log(`Creating ${this.config.outputDir}`);\n mkdirSync(this.config.outputDir);\n }\n\n console.log(\"Creating package.json\");\n createPackageJson(this.config.outputDir);\n\n console.log(\"Copying template files\");\n // TODO: Replace any params in files with .template extensions\n this.copyFiles(this.templateDir, this.config.outputDir);\n\n console.log(\"Success!\");\n }\n\n copyFiles(sourcePath: string, targetPath: string): void {\n for (const file of readdirSync(sourcePath)) {\n const path = join(sourcePath, file);\n\n if (path.endsWith(\".ignore\")) {\n continue;\n } else if (lstatSync(path).isDirectory()) {\n const nestedTargetPath = join(targetPath, file);\n if (!existsSync(nestedTargetPath)) {\n mkdirSync(nestedTargetPath);\n }\n this.copyFiles(path, nestedTargetPath);\n } else if (path.endsWith(\".template\")) {\n copyFileSync(path, join(targetPath, file.replace(\".template\", \"\")));\n } else {\n copyFileSync(path, join(targetPath, file));\n }\n }\n }\n}\n\nexport const buildDirectory = (config: InitConfig): void => {\n const builder = new ProjectBuilder(config);\n builder.buildDirectory();\n};\n\nfunction createPackageJson(outputDirectory: string): void {\n const { NODE_ENV, CI } = process.env;\n const isTest = NODE_ENV?.toUpperCase() === \"TEST\" || CI?.toUpperCase() === \"TRUE\";\n\n const coreDeps: Record<string, string> = [\n \"@guardian/eslint-config\",\n \"@guardian/tsconfig\",\n \"@types/jest\",\n \"@types/node\",\n \"eslint\",\n \"jest\",\n \"prettier\",\n \"ts-jest\",\n \"ts-node\",\n \"typescript\",\n ].reduce((acc, depName) => ({ ...acc, [depName]: getDevDependency(depName)! }), {});\n\n const cdkDeps: Record<string, string> = {\n \"@guardian/cdk\": isTest ? `file:../guardian-cdk-${LibraryInfo.VERSION}.tgz` : LibraryInfo.VERSION,\n \"aws-cdk\": LibraryInfo.AWS_CDK_VERSION,\n \"aws-cdk-lib\": LibraryInfo.AWS_CDK_LIB_VERSION,\n constructs: LibraryInfo.CONSTRUCTS_VERSION,\n };\n\n const customDeps = {\n \"source-map-support\": \"^0.5.20\",\n \"@guardian/prettier\": \"5.0.0\",\n };\n\n const allDeps: Record<string, string> = { ...coreDeps, ...cdkDeps, ...customDeps };\n\n const devDependencies: Record<string, string> = Object.keys(allDeps)\n .sort()\n .reduce((acc, depName) => ({ ...acc, [depName]: allDeps[depName] }), {});\n\n const contents = {\n name: \"cdk\",\n version: \"0.0.0\",\n private: true,\n scripts: {\n test: \"jest\",\n \"test-update\": \"jest -u\",\n format: 'prettier --write \"{lib,bin}/**/*.ts\"',\n lint: \"eslint lib/** bin/** --no-error-on-unmatched-pattern\",\n synth: \"cdk synth --path-metadata false --version-reporting false\",\n diff: \"cdk diff --path-metadata false --version-reporting false\",\n },\n devDependencies,\n\n prettier: \"@guardian/prettier\",\n\n jest: {\n testMatch: [\"<rootDir>/lib/**/*.test.ts\"],\n transform: {\n \"^.+\\\\.tsx?$\": \"ts-jest\",\n },\n setupFilesAfterEnv: [\"./jest.setup.js\"],\n },\n };\n writeFileSync(`${outputDirectory}/package.json`, JSON.stringify(contents, null, 2));\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CodeMaker } from "codemaker";
|
|
2
|
+
import type { Imports } from "./imports";
|
|
3
|
+
import type { Name } from "./utils";
|
|
4
|
+
export interface TestBuilderProps {
|
|
5
|
+
imports: Imports;
|
|
6
|
+
appName: Name;
|
|
7
|
+
stackName: Name;
|
|
8
|
+
outputFile: string;
|
|
9
|
+
outputDir: string;
|
|
10
|
+
comment?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class TestBuilder {
|
|
13
|
+
config: TestBuilderProps;
|
|
14
|
+
imports: Imports;
|
|
15
|
+
code: CodeMaker;
|
|
16
|
+
constructor(props: TestBuilderProps);
|
|
17
|
+
constructCdkFile(): Promise<void>;
|
|
18
|
+
addTest(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare const constructTest: (props: TestBuilderProps) => Promise<void>;
|
|
21
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,WAAW;IACtB,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IAEjB,IAAI,EAAE,SAAS,CAAC;gBAEJ,KAAK,EAAE,gBAAgB;IAQ7B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAevC,OAAO,IAAI,IAAI;CAiBhB;AAED,eAAO,MAAM,aAAa,GAAU,OAAO,gBAAgB,KAAG,OAAO,CAAC,IAAI,CAGzE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructTest = exports.TestBuilder = void 0;
|
|
4
|
+
const codemaker_1 = require("codemaker");
|
|
5
|
+
class TestBuilder {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.config = props;
|
|
8
|
+
this.imports = props.imports;
|
|
9
|
+
this.code = new codemaker_1.CodeMaker({ indentationLevel: 2 });
|
|
10
|
+
this.code.closeBlockFormatter = (s) => s ?? "}";
|
|
11
|
+
}
|
|
12
|
+
async constructCdkFile() {
|
|
13
|
+
this.code.openFile(this.config.outputFile);
|
|
14
|
+
if (this.config.comment) {
|
|
15
|
+
this.code.line(this.config.comment);
|
|
16
|
+
this.code.line();
|
|
17
|
+
}
|
|
18
|
+
this.config.imports.render(this.code);
|
|
19
|
+
this.addTest();
|
|
20
|
+
this.code.closeFile(this.config.outputFile);
|
|
21
|
+
await this.code.save(this.config.outputDir);
|
|
22
|
+
}
|
|
23
|
+
addTest() {
|
|
24
|
+
const { appName, stackName } = this.config;
|
|
25
|
+
this.code.openBlock(`describe("The ${appName.pascal} stack", () =>`);
|
|
26
|
+
this.code.openBlock(`it("matches the snapshot", () =>`);
|
|
27
|
+
this.code.line("const app = new App();");
|
|
28
|
+
this.code.line(`const stack = new ${appName.pascal}(app, "${appName.pascal}", { stack: "${stackName.kebab}", stage: "TEST" });`);
|
|
29
|
+
this.code.line(`const template = Template.fromStack(stack);`);
|
|
30
|
+
this.code.line(`expect(template.toJSON()).toMatchSnapshot();`);
|
|
31
|
+
this.code.closeBlock("});");
|
|
32
|
+
this.code.closeBlock("});");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.TestBuilder = TestBuilder;
|
|
36
|
+
const constructTest = async (props) => {
|
|
37
|
+
const builder = new TestBuilder(props);
|
|
38
|
+
await builder.constructCdkFile();
|
|
39
|
+
};
|
|
40
|
+
exports.constructTest = constructTest;
|
|
41
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/snapshot.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAatC,MAAa,WAAW;IAMtB,YAAY,KAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAE7B,IAAI,CAAC,IAAI,GAAG,IAAI,qBAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,EAAE,CAAC;QAEf,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO;QACL,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAE3C,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,OAAO,CAAC,MAAM,gBAAgB,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;QAExD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,IAAI,CACZ,qBAAqB,OAAO,CAAC,MAAM,UAAU,OAAO,CAAC,MAAM,gBAAgB,SAAS,CAAC,KAAK,sBAAsB,CACjH,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QAE/D,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AA9CD,kCA8CC;AAEM,MAAM,aAAa,GAAG,KAAK,EAAE,KAAuB,EAAiB,EAAE;IAC5E,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB","sourcesContent":["import { CodeMaker } from \"codemaker\";\nimport type { Imports } from \"./imports\";\nimport type { Name } from \"./utils\";\n\nexport interface TestBuilderProps {\n imports: Imports;\n appName: Name;\n stackName: Name;\n outputFile: string;\n outputDir: string;\n comment?: string;\n}\n\nexport class TestBuilder {\n config: TestBuilderProps;\n imports: Imports;\n\n code: CodeMaker;\n\n constructor(props: TestBuilderProps) {\n this.config = props;\n this.imports = props.imports;\n\n this.code = new CodeMaker({ indentationLevel: 2 });\n this.code.closeBlockFormatter = (s?: string): string => s ?? \"}\";\n }\n\n async constructCdkFile(): Promise<void> {\n this.code.openFile(this.config.outputFile);\n if (this.config.comment) {\n this.code.line(this.config.comment);\n this.code.line();\n }\n\n this.config.imports.render(this.code);\n\n this.addTest();\n\n this.code.closeFile(this.config.outputFile);\n await this.code.save(this.config.outputDir);\n }\n\n addTest(): void {\n const { appName, stackName } = this.config;\n\n this.code.openBlock(`describe(\"The ${appName.pascal} stack\", () =>`);\n this.code.openBlock(`it(\"matches the snapshot\", () =>`);\n\n this.code.line(\"const app = new App();\");\n this.code.line(\n `const stack = new ${appName.pascal}(app, \"${appName.pascal}\", { stack: \"${stackName.kebab}\", stage: \"TEST\" });`,\n );\n\n this.code.line(`const template = Template.fromStack(stack);`);\n this.code.line(`expect(template.toJSON()).toMatchSnapshot();`);\n\n this.code.closeBlock(\"});\");\n this.code.closeBlock(\"});\");\n }\n}\n\nexport const constructTest = async (props: TestBuilderProps): Promise<void> => {\n const builder = new TestBuilder(props);\n await builder.constructCdkFile();\n};\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CodeMaker } from "codemaker";
|
|
2
|
+
import type { Imports } from "./imports";
|
|
3
|
+
import type { Name } from "./utils";
|
|
4
|
+
interface StackBuilderProps {
|
|
5
|
+
imports: Imports;
|
|
6
|
+
appName: Name;
|
|
7
|
+
outputFile: string;
|
|
8
|
+
outputDir: string;
|
|
9
|
+
comment?: string;
|
|
10
|
+
yamlTemplateLocation?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class StackBuilder {
|
|
13
|
+
config: StackBuilderProps;
|
|
14
|
+
imports: Imports;
|
|
15
|
+
code: CodeMaker;
|
|
16
|
+
constructor(props: StackBuilderProps);
|
|
17
|
+
constructCdkFile(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare const constructStack: (props: StackBuilderProps) => Promise<void>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,qBAAa,YAAY;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IAEjB,IAAI,EAAE,SAAS,CAAC;gBAEJ,KAAK,EAAE,iBAAiB;IAQ9B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CA2BxC;AAED,eAAO,MAAM,cAAc,GAAU,OAAO,iBAAiB,KAAG,OAAO,CAAC,IAAI,CAG3E,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructStack = exports.StackBuilder = void 0;
|
|
4
|
+
const codemaker_1 = require("codemaker");
|
|
5
|
+
class StackBuilder {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.config = props;
|
|
8
|
+
this.imports = props.imports;
|
|
9
|
+
this.code = new codemaker_1.CodeMaker({ indentationLevel: 2 });
|
|
10
|
+
this.code.closeBlockFormatter = (s) => s ?? "}";
|
|
11
|
+
}
|
|
12
|
+
async constructCdkFile() {
|
|
13
|
+
this.code.openFile(this.config.outputFile);
|
|
14
|
+
if (this.config.comment) {
|
|
15
|
+
this.code.line(this.config.comment);
|
|
16
|
+
this.code.line();
|
|
17
|
+
}
|
|
18
|
+
this.config.imports.render(this.code);
|
|
19
|
+
this.code.openBlock(`export class ${this.config.appName.pascal} extends GuStack`);
|
|
20
|
+
this.code.openBlock(`constructor(scope: App, id: string, props: GuStackProps)`);
|
|
21
|
+
this.code.line("super(scope, id, props);");
|
|
22
|
+
if (this.config.yamlTemplateLocation) {
|
|
23
|
+
this.code.line(`const yamlTemplateFilePath = join(__dirname, "../..", "${this.config.yamlTemplateLocation}");`);
|
|
24
|
+
this.code.openBlock(`new CfnInclude(this, "YamlTemplate",`);
|
|
25
|
+
this.code.line(`templateFile: yamlTemplateFilePath,`);
|
|
26
|
+
this.code.closeBlock("});");
|
|
27
|
+
}
|
|
28
|
+
this.code.closeBlock();
|
|
29
|
+
this.code.closeBlock();
|
|
30
|
+
this.code.closeFile(this.config.outputFile);
|
|
31
|
+
await this.code.save(this.config.outputDir);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.StackBuilder = StackBuilder;
|
|
35
|
+
const constructStack = async (props) => {
|
|
36
|
+
const builder = new StackBuilder(props);
|
|
37
|
+
await builder.constructCdkFile();
|
|
38
|
+
};
|
|
39
|
+
exports.constructStack = constructStack;
|
|
40
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/stack.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAatC,MAAa,YAAY;IAMvB,YAAY,KAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OA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AAC,UAAU,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QAEvB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;CACF;AAzCD,oCAyCC;AAEM,MAAM,cAAc,GAAG,KAAK,EAAE,KAAwB,EAAiB,EAAE;IAC9E,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB","sourcesContent":["import { CodeMaker } from \"codemaker\";\nimport type { Imports } from \"./imports\";\nimport type { Name } from \"./utils\";\n\ninterface StackBuilderProps {\n imports: Imports;\n appName: Name;\n outputFile: string;\n outputDir: string;\n comment?: string;\n yamlTemplateLocation?: string;\n}\n\nexport class StackBuilder {\n config: StackBuilderProps;\n imports: Imports;\n\n code: CodeMaker;\n\n constructor(props: StackBuilderProps) {\n this.config = props;\n this.imports = props.imports;\n\n this.code = new CodeMaker({ indentationLevel: 2 });\n this.code.closeBlockFormatter = (s?: string): string => s ?? \"}\";\n }\n\n async constructCdkFile(): Promise<void> {\n this.code.openFile(this.config.outputFile);\n if (this.config.comment) {\n this.code.line(this.config.comment);\n this.code.line();\n }\n\n this.config.imports.render(this.code);\n\n this.code.openBlock(`export class ${this.config.appName.pascal} extends GuStack`);\n this.code.openBlock(`constructor(scope: App, id: string, props: GuStackProps)`);\n this.code.line(\"super(scope, id, props);\");\n\n if (this.config.yamlTemplateLocation) {\n this.code.line(`const yamlTemplateFilePath = join(__dirname, \"../..\", \"${this.config.yamlTemplateLocation}\");`);\n\n this.code.openBlock(`new CfnInclude(this, \"YamlTemplate\",`);\n this.code.line(`templateFile: yamlTemplateFilePath,`);\n this.code.closeBlock(\"});\");\n }\n\n this.code.closeBlock();\n this.code.closeBlock();\n\n this.code.closeFile(this.config.outputFile);\n await this.code.save(this.config.outputDir);\n }\n}\n\nexport const constructStack = async (props: StackBuilderProps): Promise<void> => {\n const builder = new StackBuilder(props);\n await builder.constructCdkFile();\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PackageManager } from "../index";
|
|
2
|
+
export interface Name {
|
|
3
|
+
kebab: string;
|
|
4
|
+
pascal: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function getCommands(packageManager: PackageManager, cwd: string): {
|
|
7
|
+
installDependencies: () => Promise<string>;
|
|
8
|
+
lint: () => Promise<string>;
|
|
9
|
+
synth: () => Promise<string>;
|
|
10
|
+
test: () => Promise<string>;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAMD,wBAAgB,WAAW,CACzB,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,MAAM,GACV;IACD,mBAAmB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B,CAOA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCommands = getCommands;
|
|
4
|
+
const exec_1 = require("../../../../utils/exec");
|
|
5
|
+
async function runTask(packageManager, cwd, args) {
|
|
6
|
+
return await (0, exec_1.execute)(packageManager, args, { cwd });
|
|
7
|
+
}
|
|
8
|
+
function getCommands(packageManager, cwd) {
|
|
9
|
+
return {
|
|
10
|
+
installDependencies: () => runTask(packageManager, cwd, ["install"]),
|
|
11
|
+
lint: () => runTask(packageManager, cwd, ["run", "lint"]),
|
|
12
|
+
test: () => runTask(packageManager, cwd, ["test", "--", "-u"]),
|
|
13
|
+
synth: () => runTask(packageManager, cwd, ["run", "synth"]),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/bin/commands/new-project/utils/utils.ts"],"names":[],"mappings":";;AAYA,kCAeC;AA3BD,iDAAiD;AAQjD,KAAK,UAAU,OAAO,CAAC,cAA8B,EAAE,GAAW,EAAE,IAAc;IAChF,OAAO,MAAM,IAAA,cAAO,EAAC,cAAc,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,WAAW,CACzB,cAA8B,EAC9B,GAAW;IAOX,OAAO;QACL,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACpE,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9D,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAC5D,CAAC;AACJ,CAAC","sourcesContent":["import { execute } from \"../../../../utils/exec\";\nimport type { PackageManager } from \"../index\";\n\nexport interface Name {\n kebab: string;\n pascal: string;\n}\n\nasync function runTask(packageManager: PackageManager, cwd: string, args: string[]): Promise<string> {\n return await execute(packageManager, args, { cwd });\n}\n\nexport function getCommands(\n packageManager: PackageManager,\n cwd: string,\n): {\n installDependencies: () => Promise<string>;\n lint: () => Promise<string>;\n synth: () => Promise<string>;\n test: () => Promise<string>;\n} {\n return {\n installDependencies: () => runTask(packageManager, cwd, [\"install\"]),\n lint: () => runTask(packageManager, cwd, [\"run\", \"lint\"]),\n test: () => runTask(packageManager, cwd, [\"test\", \"--\", \"-u\"]),\n synth: () => runTask(packageManager, cwd, [\"run\", \"synth\"]),\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":""}
|