Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: package layout and content #231

Merged
merged 2 commits into from
Feb 5, 2021
Merged

fix: package layout and content #231

merged 2 commits into from
Feb 5, 2021

Conversation

akash1810
Copy link
Member

@akash1810 akash1810 commented Feb 4, 2021

What does this change?

Previously (in #223 and v0.32.0 of this library) we read the version number from package.json by reading from a specific file path. To do this we had to set resolveJsonModule to true.

This resulted in lib (the output directory for TypeScript and entry point of the library) going from:

lib
 |_index.js
 |_package.json

to:

lib
 |_src
 | |_index.js
 | |_package.json
 |_package.json

Note the extra src subdirectory. This impacts import statements. From:

import { GuAutoScalingGroup } from "@guardian/cdk/lib/constructs/autoscaling";

to:

import { GuAutoScalingGroup } from "@guardian/cdk/lib/src/constructs/autoscaling";

😷

Using read-pkg-up means we do not need to set resolveJsonModule and can keep the old lib structure and sane import paths.

The tests on read-pkg-up look sane, and setting cwd to __dirname should be safe. As in it should always resolve to this library's package.json when installed in other projects.

During this investigation, I noticed the contents of the tarball we publish is essentially the entire contents of the repository minus node_modules. That is it includes config files for TS, Jest, ESLint etc.

Set paths in package.json to only include lib in the tarball. Furthermore, remove __mock__ directories, as we do __snapshots__.

This results in the tarball including only 90 files vs the current 307. This can be demonstrated by running npm pack.

npm pack before (on main)
npm pack

> @guardian/[email protected] prepare /Users/akash_askoolum/code/cdk
> tsc

npm notice
npm notice 📦  @guardian/[email protected]
npm notice === Tarball Contents ===
npm notice 166B   .editorconfig
npm notice 51B    .eslintignore
npm notice 7B     .nvmrc
npm notice 24B    .prettierrc
npm notice 353B   script/build
npm notice 825B   script/check-aws-cdk
npm notice 418B   script/check-yarn-lock
npm notice 33B    CODEOWNERS
npm notice 48B    script/docs
npm notice 271B   script/lint
npm notice 255B   script/release
npm notice 279B   script/release-docs
npm notice 41B    script/setup
npm notice 46B    script/start
npm notice 480B   script/test
npm notice 133B   script/update-aws-cdk
npm notice 602B   cdk.iml
npm notice 528B   .eslintrc.js
npm notice 2.6kB  lib/constructs/cloudwatch/alarm.js
npm notice 2.6kB  lib/src/constructs/cloudwatch/alarm.js
npm notice 7.6kB  lib/constructs/autoscaling/asg.js
npm notice 7.6kB  lib/src/constructs/autoscaling/asg.js
npm notice 2.3kB  lib/constructs/iam/policies/assume-role.js
npm notice 2.4kB  lib/src/constructs/iam/policies/assume-role.js
npm notice 4.6kB  lib/constructs/iam/policies/base-policy.js
npm notice 4.6kB  lib/src/constructs/iam/policies/base-policy.js
npm notice 9.1kB  lib/constructs/loadbalancing/clb.js
npm notice 9.1kB  lib/src/constructs/loadbalancing/clb.js
npm notice 3.3kB  lib/constructs/iam/policies/describe-ec2.js
npm notice 3.3kB  lib/src/constructs/iam/policies/describe-ec2.js
npm notice 4.1kB  lib/constructs/iam/policies/dynamodb.js
npm notice 4.1kB  lib/src/constructs/iam/policies/dynamodb.js
npm notice 10.5kB lib/constructs/loadbalancing/elb.js
npm notice 10.5kB lib/src/constructs/loadbalancing/elb.js
npm notice 443B   lib/constructs/core/identity.js
npm notice 447B   lib/src/constructs/core/identity.js
npm notice 103B   eslint/index.js
npm notice 1.0kB  lib/constants/index.js
npm notice 952B   lib/constructs/autoscaling/index.js
npm notice 1.2kB  lib/constructs/cloudwatch/index.js
npm notice 1.1kB  lib/constructs/core/index.js
npm notice 1.1kB  lib/constructs/ec2/index.js
npm notice 1.0kB  lib/constructs/iam/index.js
npm notice 1.9kB  lib/constructs/iam/policies/index.js
npm notice 1.1kB  lib/constructs/iam/roles/index.js
npm notice 951B   lib/constructs/lambda/index.js
npm notice 1.0kB  lib/constructs/loadbalancing/index.js
npm notice 953B   lib/constructs/rds/index.js
npm notice 925B   lib/index.js
npm notice 1.1kB  lib/patterns/index.js
npm notice 1.1kB  lib/src/constants/index.js
npm notice 956B   lib/src/constructs/autoscaling/index.js
npm notice 1.2kB  lib/src/constructs/cloudwatch/index.js
npm notice 1.1kB  lib/src/constructs/core/index.js
npm notice 1.1kB  lib/src/constructs/ec2/index.js
npm notice 1.1kB  lib/src/constructs/iam/index.js
npm notice 1.9kB  lib/src/constructs/iam/policies/index.js
npm notice 1.1kB  lib/src/constructs/iam/roles/index.js
npm notice 955B   lib/src/constructs/lambda/index.js
npm notice 1.0kB  lib/src/constructs/loadbalancing/index.js
npm notice 957B   lib/src/constructs/rds/index.js
npm notice 929B   lib/src/index.js
npm notice 1.1kB  lib/src/patterns/index.js
npm notice 1.5kB  lib/src/utils/index.js
npm notice 1.5kB  lib/utils/index.js
npm notice 4.0kB  lib/constructs/iam/roles/instance-role.js
npm notice 4.0kB  lib/src/constructs/iam/roles/instance-role.js
npm notice 5.1kB  lib/constructs/rds/instance.js
npm notice 5.1kB  lib/src/constructs/rds/instance.js
npm notice 146B   jest.config.js
npm notice 43B    jest.setup.js
npm notice 5.2kB  lib/constructs/cloudwatch/lambda-alarms.js
npm notice 5.2kB  lib/src/constructs/cloudwatch/lambda-alarms.js
npm notice 8.1kB  lib/constructs/lambda/lambda.js
npm notice 8.1kB  lib/src/constructs/lambda/lambda.js
npm notice 1.6kB  lib/constants/library-info.js
npm notice 939B   lib/src/constants/__mocks__/library-info.js
npm notice 1.1kB  lib/src/constants/library-info.js
npm notice 3.5kB  lib/constructs/iam/policies/log-shipping.js
npm notice 3.5kB  lib/src/constructs/iam/policies/log-shipping.js
npm notice 431B   lib/constructs/cloudwatch/no-monitoring.js
npm notice 435B   lib/src/constructs/cloudwatch/no-monitoring.js
npm notice 3.4kB  lib/constructs/iam/policies/parameter-store-read.js
npm notice 3.4kB  lib/src/constructs/iam/policies/parameter-store-read.js
npm notice 11.8kB lib/constructs/core/parameters.js
npm notice 11.8kB lib/src/constructs/core/parameters.js
npm notice 1.6kB  lib/constants/regex-pattern.js
npm notice 1.6kB  lib/src/constants/regex-pattern.js
npm notice 2.0kB  lib/constructs/iam/roles/roles.js
npm notice 2.0kB  lib/src/constructs/iam/roles/roles.js
npm notice 3.7kB  lib/constructs/iam/policies/s3-get-object.js
npm notice 3.7kB  lib/src/constructs/iam/policies/s3-get-object.js
npm notice 2.8kB  lib/patterns/scheduled-lambda.js
npm notice 2.8kB  lib/src/patterns/scheduled-lambda.js
npm notice 7.4kB  lib/constructs/ec2/security-groups.js
npm notice 7.4kB  lib/src/constructs/ec2/security-groups.js
npm notice 3.0kB  lib/constructs/iam/policies/ses.js
npm notice 3.0kB  lib/src/constructs/iam/policies/ses.js
npm notice 9.1kB  lib/patterns/sns-lambda.js
npm notice 9.1kB  lib/src/patterns/sns-lambda.js
npm notice 1.7kB  lib/constructs/sns/sns-topic.js
npm notice 1.7kB  lib/src/constructs/sns/sns-topic.js
npm notice 4.4kB  lib/constructs/iam/policies/ssm.js
npm notice 4.4kB  lib/src/constructs/iam/policies/ssm.js
npm notice 8.0kB  lib/constructs/core/stack.js
npm notice 8.0kB  lib/src/constructs/core/stack.js
npm notice 1.2kB  lib/constants/stage.js
npm notice 1.2kB  lib/src/constants/stage.js
npm notice 547B   typedoc.js
npm notice 4.7kB  eslint/rules/valid-constructors.js
npm notice 7.9kB  lib/constructs/ec2/vpc.js
npm notice 7.9kB  lib/src/constructs/ec2/vpc.js
npm notice 87B    eslint/package.json
npm notice 2.3kB  lib/package.json
npm notice 2.1kB  package.json
npm notice 159B   .vscode/settings.json
npm notice 126B   tsconfig.eslint.json
npm notice 618B   tsconfig.json
npm notice 479B   docs/architecture-decision-records/000-template.md
npm notice 3.0kB  docs/architecture-decision-records/001-constructs-and-patterns.md
npm notice 2.4kB  docs/001-general-usage.md
npm notice 3.8kB  docs/architecture-decision-records/002-component-constuctors.md
npm notice 1.4kB  docs/002-starting-a-new-project.md
npm notice 4.9kB  docs/003-migrating-existing-stacks.md
npm notice 2.7kB  docs/architecture-decision-records/003-package-manager.md
npm notice 3.1kB  docs/architecture-decision-records/004-testing.md
npm notice 1.1kB  docs/004-tips-tricks-and-gotchas.md
npm notice 1.2kB  docs/005-default-parameter-store-locations.md
npm notice 2.9kB  docs/architecture-decision-records/005-package-structure.md
npm notice 1.3kB  .github/PULL_REQUEST_TEMPLATE.md
npm notice 339B   eslint/README.md
npm notice 4.9kB  README.md
npm notice 20.1kB src/constructs/iam/roles/__snapshots__/instance-role.test.ts.snap
npm notice 7.3kB  src/constructs/cloudwatch/__snapshots__/lambda-alarms.test.ts.snap
npm notice 26.6kB src/constructs/lambda/__snapshots__/lambda.test.ts.snap
npm notice 5.6kB  src/patterns/__snapshots__/scheduled-lambda.test.ts.snap
npm notice 3.1kB  src/constructs/iam/policies/__snapshots__/ses.test.ts.snap
npm notice 6.3kB  src/patterns/__snapshots__/sns-lambda.test.ts.snap
npm notice 51.3kB guardian-cdk-0.32.0.tgz
npm notice 340B   lib/constructs/cloudwatch/alarm.d.ts
npm notice 340B   lib/src/constructs/cloudwatch/alarm.d.ts
npm notice 2.1kB  src/constructs/cloudwatch/alarm.test.ts
npm notice 767B   src/constructs/cloudwatch/alarm.ts
npm notice 992B   lib/constructs/autoscaling/asg.d.ts
npm notice 992B   lib/src/constructs/autoscaling/asg.d.ts
npm notice 6.0kB  src/constructs/autoscaling/asg.test.ts
npm notice 2.7kB  src/constructs/autoscaling/asg.ts
npm notice 391B   lib/constructs/iam/policies/assume-role.d.ts
npm notice 391B   lib/src/constructs/iam/policies/assume-role.d.ts
npm notice 1.3kB  src/constructs/iam/policies/assume-role.test.ts
npm notice 673B   src/constructs/iam/policies/assume-role.ts
npm notice 450B   test/utils/attach-policy-to-test-role.ts
npm notice 874B   lib/constructs/iam/policies/base-policy.d.ts
npm notice 874B   lib/src/constructs/iam/policies/base-policy.d.ts
npm notice 1.4kB  src/constructs/iam/policies/base-policy.ts
npm notice 1.4kB  lib/constructs/loadbalancing/clb.d.ts
npm notice 1.4kB  lib/src/constructs/loadbalancing/clb.d.ts
npm notice 6.8kB  src/constructs/loadbalancing/clb.test.ts
npm notice 2.7kB  src/constructs/loadbalancing/clb.ts
npm notice 304B   lib/constructs/iam/policies/describe-ec2.d.ts
npm notice 304B   lib/src/constructs/iam/policies/describe-ec2.d.ts
npm notice 974B   src/constructs/iam/policies/describe-ec2.test.ts
npm notice 935B   src/constructs/iam/policies/describe-ec2.ts
npm notice 806B   lib/constructs/iam/policies/dynamodb.d.ts
npm notice 806B   lib/src/constructs/iam/policies/dynamodb.d.ts
npm notice 2.4kB  src/constructs/iam/policies/dynamodb.test.ts
npm notice 1.2kB  src/constructs/iam/policies/dynamodb.ts
npm notice 1.8kB  lib/constructs/loadbalancing/elb.d.ts
npm notice 1.8kB  lib/src/constructs/loadbalancing/elb.d.ts
npm notice 13.4kB src/constructs/loadbalancing/elb.test.ts
npm notice 3.3kB  src/constructs/loadbalancing/elb.ts
npm notice 85B    lib/constructs/core/identity.d.ts
npm notice 85B    lib/src/constructs/core/identity.d.ts
npm notice 79B    src/constructs/core/identity.ts
npm notice 58B    lib/constants/index.d.ts
npm notice 23B    lib/constructs/autoscaling/index.d.ts
npm notice 91B    lib/constructs/cloudwatch/index.d.ts
npm notice 55B    lib/constructs/core/index.d.ts
npm notice 58B    lib/constructs/ec2/index.d.ts
npm notice 53B    lib/constructs/iam/index.d.ts
npm notice 273B   lib/constructs/iam/policies/index.d.ts
npm notice 58B    lib/constructs/iam/roles/index.d.ts
npm notice 26B    lib/constructs/lambda/index.d.ts
npm notice 46B    lib/constructs/loadbalancing/index.d.ts
npm notice 28B    lib/constructs/rds/index.d.ts
npm notice 28B    lib/index.d.ts
npm notice 66B    lib/patterns/index.d.ts
npm notice 58B    lib/src/constants/index.d.ts
npm notice 23B    lib/src/constructs/autoscaling/index.d.ts
npm notice 91B    lib/src/constructs/cloudwatch/index.d.ts
npm notice 55B    lib/src/constructs/core/index.d.ts
npm notice 58B    lib/src/constructs/ec2/index.d.ts
npm notice 53B    lib/src/constructs/iam/index.d.ts
npm notice 273B   lib/src/constructs/iam/policies/index.d.ts
npm notice 58B    lib/src/constructs/iam/roles/index.d.ts
npm notice 26B    lib/src/constructs/lambda/index.d.ts
npm notice 46B    lib/src/constructs/loadbalancing/index.d.ts
npm notice 28B    lib/src/constructs/rds/index.d.ts
npm notice 28B    lib/src/index.d.ts
npm notice 66B    lib/src/patterns/index.d.ts
npm notice 154B   lib/src/utils/index.d.ts
npm notice 154B   lib/utils/index.d.ts
npm notice 776B   src/utils/index.test.ts
npm notice 58B    src/constants/index.ts
npm notice 23B    src/constructs/autoscaling/index.ts
npm notice 91B    src/constructs/cloudwatch/index.ts
npm notice 55B    src/constructs/core/index.ts
npm notice 58B    src/constructs/ec2/index.ts
npm notice 53B    src/constructs/iam/index.ts
npm notice 273B   src/constructs/iam/policies/index.ts
npm notice 58B    src/constructs/iam/roles/index.ts
npm notice 26B    src/constructs/lambda/index.ts
npm notice 46B    src/constructs/loadbalancing/index.ts
npm notice 28B    src/constructs/rds/index.ts
npm notice 28B    src/index.ts
npm notice 66B    src/patterns/index.ts
npm notice 318B   src/utils/index.ts
npm notice 114B   test/utils/index.ts
npm notice 390B   lib/constructs/iam/roles/instance-role.d.ts
npm notice 390B   lib/src/constructs/iam/roles/instance-role.d.ts
npm notice 1.5kB  src/constructs/iam/roles/instance-role.test.ts
npm notice 1.2kB  src/constructs/iam/roles/instance-role.ts
npm notice 492B   lib/constructs/rds/instance.d.ts
npm notice 492B   lib/src/constructs/rds/instance.d.ts
npm notice 5.8kB  src/constructs/rds/instance.test.ts
npm notice 1.6kB  src/constructs/rds/instance.ts
npm notice 804B   lib/constructs/cloudwatch/lambda-alarms.d.ts
npm notice 804B   lib/src/constructs/cloudwatch/lambda-alarms.d.ts
npm notice 3.1kB  src/constructs/cloudwatch/lambda-alarms.test.ts
npm notice 1.8kB  src/constructs/cloudwatch/lambda-alarms.ts
npm notice 897B   lib/constructs/lambda/lambda.d.ts
npm notice 897B   lib/src/constructs/lambda/lambda.d.ts
npm notice 6.2kB  src/constructs/lambda/lambda.test.ts
npm notice 2.5kB  src/constructs/lambda/lambda.ts
npm notice 135B   lib/constants/library-info.d.ts
npm notice 135B   lib/src/constants/__mocks__/library-info.d.ts
npm notice 135B   lib/src/constants/library-info.d.ts
npm notice 141B   src/constants/__mocks__/library-info.ts
npm notice 189B   src/constants/library-info.ts
npm notice 268B   lib/constructs/iam/policies/log-shipping.d.ts
npm notice 268B   lib/src/constructs/iam/policies/log-shipping.d.ts
npm notice 2.3kB  src/constructs/iam/policies/log-shipping.test.ts
npm notice 967B   src/constructs/iam/policies/log-shipping.ts
npm notice 58B    lib/constructs/cloudwatch/no-monitoring.d.ts
npm notice 58B    lib/src/constructs/cloudwatch/no-monitoring.d.ts
npm notice 56B    src/constructs/cloudwatch/no-monitoring.ts
npm notice 311B   lib/constructs/iam/policies/parameter-store-read.d.ts
npm notice 311B   lib/src/constructs/iam/policies/parameter-store-read.d.ts
npm notice 1.5kB  src/constructs/iam/policies/parameter-store-read.test.ts
npm notice 934B   src/constructs/iam/policies/parameter-store-read.ts
npm notice 1.8kB  lib/constructs/core/parameters.d.ts
npm notice 1.8kB  lib/src/constructs/core/parameters.d.ts
npm notice 7.0kB  src/constructs/core/parameters.test.ts
npm notice 3.3kB  src/constructs/core/parameters.ts
npm notice 104B   lib/constants/regex-pattern.d.ts
npm notice 104B   lib/src/constants/regex-pattern.d.ts
npm notice 1.2kB  src/constants/regex-pattern.test.ts
npm notice 389B   src/constants/regex-pattern.ts
npm notice 364B   lib/constructs/iam/roles/roles.d.ts
npm notice 364B   lib/src/constructs/iam/roles/roles.d.ts
npm notice 1.3kB  src/constructs/iam/roles/roles.test.ts
npm notice 563B   src/constructs/iam/roles/roles.ts
npm notice 562B   lib/constructs/iam/policies/s3-get-object.d.ts
npm notice 562B   lib/src/constructs/iam/policies/s3-get-object.d.ts
npm notice 2.8kB  src/constructs/iam/policies/s3-get-object.test.ts
npm notice 1.1kB  src/constructs/iam/policies/s3-get-object.ts
npm notice 778B   lib/patterns/scheduled-lambda.d.ts
npm notice 778B   lib/src/patterns/scheduled-lambda.d.ts
npm notice 1.7kB  src/patterns/scheduled-lambda.test.ts
npm notice 1.0kB  src/patterns/scheduled-lambda.ts
npm notice 5.5kB  src/constructs/ec2/security-group.test.ts
npm notice 990B   lib/constructs/ec2/security-groups.d.ts
npm notice 990B   lib/src/constructs/ec2/security-groups.d.ts
npm notice 2.2kB  src/constructs/ec2/security-groups.ts
npm notice 266B   lib/constructs/iam/policies/ses.d.ts
npm notice 266B   lib/src/constructs/iam/policies/ses.d.ts
npm notice 1.4kB  src/constructs/iam/policies/ses.test.ts
npm notice 863B   src/constructs/iam/policies/ses.ts
npm notice 336B   test/utils/simple-gu-stack.ts
npm notice 3.4kB  lib/patterns/sns-lambda.d.ts
npm notice 3.4kB  lib/src/patterns/sns-lambda.d.ts
npm notice 3.0kB  src/patterns/sns-lambda.test.ts
npm notice 4.4kB  src/patterns/sns-lambda.ts
npm notice 340B   lib/constructs/sns/sns-topic.d.ts
npm notice 340B   lib/src/constructs/sns/sns-topic.d.ts
npm notice 922B   src/constructs/sns/sns-topic.test.ts
npm notice 485B   src/constructs/sns/sns-topic.ts
npm notice 431B   lib/constructs/iam/policies/ssm.d.ts
npm notice 431B   lib/src/constructs/iam/policies/ssm.d.ts
npm notice 2.6kB  src/constructs/iam/policies/ssm.test.ts
npm notice 1.3kB  src/constructs/iam/policies/ssm.ts
npm notice 1.8kB  lib/constructs/core/stack.d.ts
npm notice 1.8kB  lib/src/constructs/core/stack.d.ts
npm notice 1.8kB  src/constructs/core/stack.test.ts
npm notice 2.8kB  src/constructs/core/stack.ts
npm notice 118B   lib/constants/stage.d.ts
npm notice 118B   lib/src/constants/stage.d.ts
npm notice 198B   src/constants/stage.ts
npm notice 175B   test/utils/synthed-stack.ts
npm notice 794B   lib/constructs/ec2/vpc.d.ts
npm notice 794B   lib/src/constructs/ec2/vpc.d.ts
npm notice 2.5kB  src/constructs/ec2/vpc.test.ts
npm notice 2.5kB  src/constructs/ec2/vpc.ts
npm notice 696B   .github/workflows/cd-docs.yaml
npm notice 1.1kB  .github/workflows/cd.yaml
npm notice 1.6kB  .github/workflows/ci.yaml
npm notice 463B   .github/dependabot.yml
npm notice === Tarball Details ===
npm notice name:          @guardian/cdk
npm notice version:       0.32.0
npm notice filename:      guardian-cdk-0.32.0.tgz
npm notice package size:  153.1 kB
npm notice unpacked size: 664.7 kB
npm notice shasum:        87e0bfe75e4672b4d4a27edd13a002469b1a1596
npm notice integrity:     sha512-VyWg+e1z34eVt[...]97920AMfb1BYg==
npm notice total files:   307
npm notice
guardian-cdk-0.32.0.tgz
npm pack after (on this branch)
npm pack

> @guardian/[email protected] prepare /Users/akash_askoolum/code/cdk
> tsc

npm notice
npm notice 📦  @guardian/[email protected]
npm notice === Tarball Contents ===
npm notice 2.6kB  lib/constructs/cloudwatch/alarm.js
npm notice 7.6kB  lib/constructs/autoscaling/asg.js
npm notice 2.3kB  lib/constructs/iam/policies/assume-role.js
npm notice 4.6kB  lib/constructs/iam/policies/base-policy.js
npm notice 9.1kB  lib/constructs/loadbalancing/clb.js
npm notice 3.3kB  lib/constructs/iam/policies/describe-ec2.js
npm notice 4.1kB  lib/constructs/iam/policies/dynamodb.js
npm notice 10.5kB lib/constructs/loadbalancing/elb.js
npm notice 443B   lib/constructs/core/identity.js
npm notice 1.0kB  lib/constants/index.js
npm notice 952B   lib/constructs/autoscaling/index.js
npm notice 1.2kB  lib/constructs/cloudwatch/index.js
npm notice 1.1kB  lib/constructs/core/index.js
npm notice 1.1kB  lib/constructs/ec2/index.js
npm notice 1.0kB  lib/constructs/iam/index.js
npm notice 1.9kB  lib/constructs/iam/policies/index.js
npm notice 1.1kB  lib/constructs/iam/roles/index.js
npm notice 951B   lib/constructs/lambda/index.js
npm notice 1.0kB  lib/constructs/loadbalancing/index.js
npm notice 953B   lib/constructs/rds/index.js
npm notice 925B   lib/index.js
npm notice 1.1kB  lib/patterns/index.js
npm notice 1.5kB  lib/utils/index.js
npm notice 4.0kB  lib/constructs/iam/roles/instance-role.js
npm notice 5.1kB  lib/constructs/rds/instance.js
npm notice 5.2kB  lib/constructs/cloudwatch/lambda-alarms.js
npm notice 8.1kB  lib/constructs/lambda/lambda.js
npm notice 1.6kB  lib/constants/library-info.js
npm notice 3.5kB  lib/constructs/iam/policies/log-shipping.js
npm notice 431B   lib/constructs/cloudwatch/no-monitoring.js
npm notice 3.4kB  lib/constructs/iam/policies/parameter-store-read.js
npm notice 11.8kB lib/constructs/core/parameters.js
npm notice 1.6kB  lib/constants/regex-pattern.js
npm notice 2.0kB  lib/constructs/iam/roles/roles.js
npm notice 3.7kB  lib/constructs/iam/policies/s3-get-object.js
npm notice 2.8kB  lib/patterns/scheduled-lambda.js
npm notice 7.4kB  lib/constructs/ec2/security-groups.js
npm notice 3.0kB  lib/constructs/iam/policies/ses.js
npm notice 9.1kB  lib/patterns/sns-lambda.js
npm notice 1.7kB  lib/constructs/sns/sns-topic.js
npm notice 4.4kB  lib/constructs/iam/policies/ssm.js
npm notice 8.0kB  lib/constructs/core/stack.js
npm notice 1.2kB  lib/constants/stage.js
npm notice 7.9kB  lib/constructs/ec2/vpc.js
npm notice 2.1kB  package.json
npm notice 4.9kB  README.md
npm notice 340B   lib/constructs/cloudwatch/alarm.d.ts
npm notice 992B   lib/constructs/autoscaling/asg.d.ts
npm notice 391B   lib/constructs/iam/policies/assume-role.d.ts
npm notice 874B   lib/constructs/iam/policies/base-policy.d.ts
npm notice 1.4kB  lib/constructs/loadbalancing/clb.d.ts
npm notice 304B   lib/constructs/iam/policies/describe-ec2.d.ts
npm notice 806B   lib/constructs/iam/policies/dynamodb.d.ts
npm notice 1.8kB  lib/constructs/loadbalancing/elb.d.ts
npm notice 85B    lib/constructs/core/identity.d.ts
npm notice 58B    lib/constants/index.d.ts
npm notice 23B    lib/constructs/autoscaling/index.d.ts
npm notice 91B    lib/constructs/cloudwatch/index.d.ts
npm notice 55B    lib/constructs/core/index.d.ts
npm notice 58B    lib/constructs/ec2/index.d.ts
npm notice 53B    lib/constructs/iam/index.d.ts
npm notice 273B   lib/constructs/iam/policies/index.d.ts
npm notice 58B    lib/constructs/iam/roles/index.d.ts
npm notice 26B    lib/constructs/lambda/index.d.ts
npm notice 46B    lib/constructs/loadbalancing/index.d.ts
npm notice 28B    lib/constructs/rds/index.d.ts
npm notice 28B    lib/index.d.ts
npm notice 66B    lib/patterns/index.d.ts
npm notice 154B   lib/utils/index.d.ts
npm notice 390B   lib/constructs/iam/roles/instance-role.d.ts
npm notice 492B   lib/constructs/rds/instance.d.ts
npm notice 804B   lib/constructs/cloudwatch/lambda-alarms.d.ts
npm notice 897B   lib/constructs/lambda/lambda.d.ts
npm notice 135B   lib/constants/library-info.d.ts
npm notice 268B   lib/constructs/iam/policies/log-shipping.d.ts
npm notice 58B    lib/constructs/cloudwatch/no-monitoring.d.ts
npm notice 311B   lib/constructs/iam/policies/parameter-store-read.d.ts
npm notice 1.8kB  lib/constructs/core/parameters.d.ts
npm notice 104B   lib/constants/regex-pattern.d.ts
npm notice 364B   lib/constructs/iam/roles/roles.d.ts
npm notice 562B   lib/constructs/iam/policies/s3-get-object.d.ts
npm notice 778B   lib/patterns/scheduled-lambda.d.ts
npm notice 990B   lib/constructs/ec2/security-groups.d.ts
npm notice 266B   lib/constructs/iam/policies/ses.d.ts
npm notice 3.4kB  lib/patterns/sns-lambda.d.ts
npm notice 340B   lib/constructs/sns/sns-topic.d.ts
npm notice 431B   lib/constructs/iam/policies/ssm.d.ts
npm notice 1.8kB  lib/constructs/core/stack.d.ts
npm notice 118B   lib/constants/stage.d.ts
npm notice 794B   lib/constructs/ec2/vpc.d.ts
npm notice === Tarball Details ===
npm notice name:          @guardian/cdk
npm notice version:       0.32.0
npm notice filename:      guardian-cdk-0.32.0.tgz
npm notice package size:  51.3 kB
npm notice unpacked size: 186.3 kB
npm notice shasum:        be2fe5e5d5afef9f089bf6011e2a89edbf1bf58c
npm notice integrity:     sha512-PXbmc3lCnApUN[...]87XxPfYJsJYfw==
npm notice total files:   90
npm notice
guardian-cdk-0.32.0.tgz

Does this change require changes to existing projects or CDK CLI?

No. Nothing is using v0.32.0. I tried to update deploy-tools-platform and then noticed the import paths changing, hence this PR.

How to test

Run npm pack?

How can we measure success?

We publish only the necessary files and get back to a sane path in import statements.

Have we considered potential risks?

n/a

Previously we read the version number from `package.json` by reading from a specific file path. To do this we had to set `resolveJsonModule` to `true`.

This resulted in `lib` going from:

```
lib
 |_index.js
 |_package.json
```

to:

```
lib
 |_src
 | |_index.js
 | |_package.json
 |_package.json
```

This impacts import statements. From:

```
import { GuAutoScalingGroup } from "@guardian/cdk/lib/constructs/autoscaling";
```

to:

```
import { GuAutoScalingGroup } from "@guardian/cdk/lib/src/constructs/autoscaling";
```

Using read-pkg-up means we do not need to set `resolveJsonModule` and can keep the old `lib` structure and sane import paths.
The tarball we publish is essentially the contents of the repository minus `node_modules`. That is it includes config files for TS, Jest, ESLint etc.

Set `paths` in `package.json` to only include `lib` in the tarball. Furthermore, remove `__mock__` directories, as we do `__snapshots__`.
@akash1810 akash1810 requested review from a team and sndrs February 4, 2021 21:56
Copy link
Member

@sndrs sndrs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lovely

@akash1810 akash1810 merged commit 462ac32 into main Feb 5, 2021
@akash1810 akash1810 deleted the aa-package-contents branch February 5, 2021 10:38
@akash1810 akash1810 added the needs-new-release Identifying significant changes to the library label Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-new-release Identifying significant changes to the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants