Skip to content

Commit 28e5488

Browse files
Merge pull request #1674 from aligent/feature/DO-1867_update_claude_md_docs
DO-1867: refresh repo docs and adopt org-shared community files
2 parents abd2760 + 852ca0b commit 28e5488

5 files changed

Lines changed: 104 additions & 426 deletions

File tree

.github/pull_request_template.md

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

CLAUDE.md

Lines changed: 76 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -4,126 +4,115 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Repository Overview
66

7-
This is an Nx-based monorepo containing AWS CDK v2 construct packages. Each package provides reusable infrastructure components for common AWS patterns.
7+
Nx-based monorepo of independently versioned AWS CDK v2 construct packages published under the `@aligent/cdk-*` scope. Yarn 4 (Berry) workspaces, managed via Corepack. Node version is pinned in `.nvmrc` (currently v22.14.0).
8+
9+
Workspaces:
10+
- `packages/constructs/*` — one CDK construct per directory (e.g. `static-hosting`, `waf`, `prerender-fargate`)
11+
- `packages/cdk-aspects` — shared CDK aspects
812

913
## Key Commands
1014

11-
### Development
15+
### Setup and development
1216
```bash
13-
# Install dependencies
14-
npm ci
17+
# Install dependencies (matches CI)
18+
yarn install --frozen-lockfile
1519

16-
# Build a specific package
20+
# Build / test / lint a single package (use the project name from project.json, not the npm name)
1721
yarn nx build <package-name>
18-
19-
# Run tests for a package
2022
yarn nx test <package-name>
21-
22-
# Lint a package
2323
yarn nx lint <package-name>
2424

2525
# Run a single test file
2626
yarn nx test <package-name> --testFile=<test-file-name>
27+
28+
# Run tests across the whole monorepo
29+
yarn nx run-many -t test
2730
```
2831

29-
### Local Testing
32+
### Affected-only (mirrors CI)
33+
CI runs `nx affected` against `origin/main`. To reproduce locally:
3034
```bash
31-
# After building, pack the package
32-
cd dist/<package-name> && npm pack
35+
yarn nx affected:lint --base=origin/main
36+
yarn nx affected:build --base=origin/main
37+
yarn nx affected:test --base=origin/main
3338

34-
# Install in your target project
35-
npm i <path-to-tarball>
39+
# List affected @aligent/cdk-* packages — useful when adding a changeset
40+
yarn affected:packages
3641
```
3742

38-
### Publishing
43+
### Local consumption of a package
44+
Build target outputs in place (`outDir: "."`), not into `dist/`. To consume in another project:
3945
```bash
40-
# Publish with version and tag
41-
yarn nx publish <package-name> --ver=<version> --tag=<tag>
46+
yarn nx build <package-name>
47+
cd packages/constructs/<package-name> && npm pack
48+
# then in the target project: npm i <path-to-tarball>
4249
```
4350

44-
## Architecture
51+
### Releases (Changesets)
52+
This repo uses [Changesets](https://github.com/changesets/changesets); each package has an independent release cycle. Manual `npm publish` / `nx publish` is **not** the normal flow.
4553

46-
### Package Structure
47-
All packages follow this pattern:
48-
```
49-
packages/<package-name>/
50-
├── src/
51-
│ ├── index.ts # Main exports
52-
│ └── lib/
53-
│ ├── <construct>.ts # Main CDK construct
54-
│ └── handlers/ # Lambda function code
55-
├── package.json
56-
├── project.json # Nx configuration
57-
├── tsconfig.json
58-
├── jest.config.ts
59-
└── README.md
60-
```
54+
Every PR that modifies a published package must include a changeset file in `.changeset/`. On merge to `main`, the `changeset-release` workflow opens/updates a "Release: Version Packages" PR; merging that PR publishes to npm and creates GitHub releases.
6155

62-
### Construct Pattern
63-
Each package exports CDK Constructs that:
64-
- Extend the base `Construct` class from AWS CDK
65-
- Accept a typed props interface (e.g., `StaticHostingProps`)
66-
- Create and configure AWS resources
67-
- May include Lambda functions bundled with esbuild
68-
69-
### Key Architectural Decisions
70-
1. **Independent Packages**: Each construct is independently versioned and can be used standalone
71-
2. **Lambda Bundling**: Uses `@aligent/cdk-esbuild` for efficient Lambda deployment
72-
3. **Peer Dependencies**: All packages require `aws-cdk-lib` and `constructs` as peer dependencies
73-
4. **TypeScript**: Entire codebase uses TypeScript with strict mode enabled
74-
75-
### Package Dependencies
76-
- Packages can compose together (e.g., WAF + CloudFront)
77-
- Lambda functions use AWS SDK v3 clients
78-
- Build process uses Nx task orchestration with dependency graph
79-
80-
## Testing Approach
81-
- Jest with ts-jest for all packages
82-
- 80% code coverage threshold
83-
- Mock AWS services in tests
84-
- Test files follow `*.test.ts` pattern
56+
**Before writing a changeset, confirm with the user:**
57+
- which package(s) are affected
58+
- the bump type (`patch` for bug fixes / non-breaking tweaks, `minor` for backwards-compatible features, `major` for breaking changes)
59+
- the description
8560

86-
## Code Quality and Git Workflow
61+
Then either run `yarn changeset` (interactive) or create `.changeset/<descriptive-slug>.md` directly:
8762

88-
### Pre-commit Requirements
89-
**ALWAYS run linting before pushing code to git:**
90-
```bash
91-
# Run lint check for the package being modified
92-
yarn nx lint <package-name>
63+
```markdown
64+
---
65+
"@aligent/<package-name>": patch | minor | major
66+
---
9367

94-
# Fix any linting issues automatically when possible
95-
yarn nx lint <package-name> --fix
68+
Short description of the change.
9669
```
9770

98-
### Git Commit Process
99-
1. Make code changes
100-
2. **MANDATORY**: Run `yarn nx lint <package-name>` to check for linting issues
101-
3. Fix any linting errors or warnings
102-
4. Stage changes with `git add`
103-
5. Commit with descriptive message
104-
6. Push to remote
71+
Useful commands:
72+
```bash
73+
yarn changeset:status # see pending changesets
74+
yarn affected:packages # list affected @aligent/cdk-* packages — handy when picking targets
75+
```
10576

106-
**Never push code that fails linting checks** - this will cause GitHub Actions to fail and block the PR.
77+
## Architecture
10778

108-
### Changesets
79+
### Package layout
80+
```
81+
packages/constructs/<name>/
82+
├── index.ts # main exports
83+
├── lib/
84+
│ ├── <construct>.ts # CDK construct(s)
85+
│ └── handlers/ # Lambda source (excluded from tsc build; bundled via esbuild at synth time)
86+
├── project.json # Nx targets: build / lint / test / publish
87+
├── package.json # @aligent/cdk-<name>, peer-deps aws-cdk-lib + constructs
88+
├── tsconfig.json / tsconfig.app.json / tsconfig.spec.json
89+
├── jest.config.ts
90+
└── README.md
91+
```
92+
After `nx build`, compiled `index.js` / `index.d.ts` (and `lib/*.js`) sit next to the sources — that is what gets published.
10993

110-
This repo uses [Changesets](https://github.com/changesets/changesets) for versioning. Every PR that modifies a package must include a changeset file in `.changeset/`.
94+
### Construct pattern
95+
Each package exports CDK Constructs that extend `Construct`, accept a typed props interface, and create AWS resources. Lambda handlers under `lib/handlers/` are excluded from the package's `tsc` build and are bundled via `@aligent/cdk-esbuild` during CDK synth (using AWS SDK v3 clients).
11196

112-
Before writing a changeset, confirm with the user:
113-
- which package(s) are affected
114-
- the bump type (`patch`, `minor`, or `major`)
115-
- the description
97+
### Cross-package rules
98+
- `aws-cdk-lib` and `constructs` are **peer** dependencies in every package — do not add them as regular `dependencies`.
99+
- ESLint enforces Nx module boundaries; the only cross-package import explicitly allowed is `@aligent/cdk-esbuild` (see `.eslintrc.json`). New cross-package coupling needs an explicit allowlist entry.
100+
- `constructs` is pinned via a workspace-level `resolutions` entry in the root `package.json`.
116101

117-
Then create `.changeset/<descriptive-slug>.md`:
102+
## Testing
103+
- Jest + ts-jest, `*.test.ts` pattern, 80% coverage threshold per package.
104+
- Mock AWS SDK calls (e.g. `aws-sdk-client-mock`); do not hit real AWS.
118105

119-
```markdown
120-
---
121-
"@aligent/<package-name>": patch | minor | major
122-
---
106+
## Code Quality and Git Workflow
123107

124-
Short description of the change.
108+
### Pre-commit
109+
Always lint the affected package before pushing — CI runs `nx affected:lint` and will block the PR otherwise:
110+
```bash
111+
yarn nx lint <package-name>
112+
yarn nx lint <package-name> --fix # auto-fix where possible
125113
```
126114

127-
- `patch` — bug fixes, non-breaking tweaks
128-
- `minor` — new backwards-compatible features
129-
- `major` — breaking changes
115+
### PRs
116+
- One logical change per PR.
117+
- Include a changeset for any user-visible change to a published package (see [Releases (Changesets)](#releases-changesets) above).
118+
- The `check-readme` workflow flags missing README updates — keep the package README in sync with functional changes.

CODE_OF_CONDUCT.md

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

0 commit comments

Comments
 (0)