Skip to content

Monorepo and ESM #58

Description

@mwarman

Describe the task

1. Monorepo structure

Update the project to use a npm workspaces monorepo structure. The monorepo should consist of 2 workspaces:

  • packages/api - contains the AWS Lambda functions and all application source code
  • packages/infra - contains the AWS CDK infrastructure as code

As part of this change to a monorepo structure:

  • Common packages should be hosted to the root package.json
  • Common scripts, such as clean, build, or test should be defined in the root package.json and reference the packages with flags like --workspaces --if-present
  • A base TypeScript configuration should be defined in the project root tsconfig.base.json and extended in the workspaces with overrides as needed

2. Switch from CommonJS to ESM modules

Both the AWS CDK and AWS Lambda functions support ESM modules. Update the project holistically to use ESM.

As part of this change, switch all of the monorepo workspaces/packages from testing with Jest to using Vitest. Vitest is the preferred testing framework for ESM modules. Create a base Vitest configuration file in the project root (vitest.config.ts) and then extend the base configuration, if needed, in the workspaces using the mergeConfig Vitest function.

3. Documentation

Review and update the project documentation after completing the changes. The documentation should reflect the changes to the project structure, npm scripts, Vitest, and any other outdated documentation.

4. AGENTS.md

Create a best practices AGENTS.md file for this project. Use the current .github/copilot-instructions. as a reference. After creating the AGENTS.md, update the copilot instructions file to simply point to the AGENTS.md file.

Additional context

Add any other context about the task here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions