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

feat: Add exports for constructs #2483

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

feat: Add exports for constructs #2483

wants to merge 1 commit into from

Conversation

AshCorr
Copy link
Member

@AshCorr AshCorr commented Oct 18, 2024

What does this change?

Add explicit exports to our package.json

I always seem to have issues with Intellisense and @guardian/cdk, Intellisense seems to work fine with regular aws-cdk-lib constructs but it can almost never find @guardian/cdk exports. From asking about it sounds like I'm not the only user affected by this.

Furthermore Deno is able to compile and synth regular aws-cdk projects, but the moment we include @guardian/cdk it starts complaining about being unable to find imports for a lot of @guardian/cdk classes.

My suspicion is because @guardian/cdk exports each construct as its own module instead of exporting everything through the root index.ts file. aws-cdk-lib does this too but it explicitly specifies all its exports in its package.json

How to test

Copied the package.json to my node_modules folder.

Before:

image

After:

image

How can we measure success?

Have we considered potential risks?

Checklist

  • I have listed any breaking changes, along with a migration path 1
  • I have updated the documentation as required for the described changes 2

Footnotes

  1. Consider whether this is something that will mean changes to projects that have already been migrated, or to the CDK CLI tool. If changes are required, consider adding a checklist here and/or linking to related PRs.

  2. If you are adding a new construct or pattern, has new documentation been added? If you are amending defaults or changing behaviour, are the existing docs still valid?

Copy link

changeset-bot bot commented Oct 18, 2024

⚠️ No Changeset found

Latest commit: 5eb65fc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@AshCorr AshCorr force-pushed the ash/exports branch 2 times, most recently from 65dda86 to f0924e2 Compare October 18, 2024 10:12
Comment on lines +77 to +84
"./lib/constants/access": "./lib/constants/access.js",
"./lib/constants/context-keys": "./lib/constants/context-keys.js",
"./lib/constants/fastly-aws-account-ids": "./lib/constants/fastly-aws-account-ids.js",
"./lib/constants/library-info": "./lib/constants/library-info.js",
"./lib/constants/metadata-keys": "./lib/constants/metadata-keys.js",
"./lib/constants/regex-pattern": "./lib/constants/regex-pattern.js",
"./lib/constants/ssm-parameter-paths": "./lib/constants/ssm-parameter-paths.js",
"./lib/constants/tracking-tag": "./lib/constants/tracking-tag.js",
Copy link
Member Author

@AshCorr AshCorr Oct 18, 2024

Choose a reason for hiding this comment

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

Our modules aren't super consistent right now, sometimes they're a single file and sometimes they're a directory with an index.js.

I'd like to avoid a big refactor for the time being so I'll just make it work, but might be worth exploring in a future cleanup. Potentially refactor to be more like aws-cdk-lib by dropping all the lib/construct prefixes and moving all the constructs up to be submodules directly of @guardian/cdk:

@guardian/cdk -> Patterns
@guardian/cdk/(AWS Service) -> Constructs for (AWS Service)
@guardian/cdk/lib/util -> Utility functions
@guardian/cdk/lib/constants -> Constant
@guardian/cdk/lib/riff-raff -> Riff Raff YAML generator

@guardian/cdk/experimental/* - All of the above prefixed with experimental

Copy link
Contributor

This PR is stale because it has been open 30 days with no activity. Unless a comment is added or the “stale” label removed, this will be closed in 3 days

@github-actions github-actions bot added the Stale label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant