Skip to content

Add StaticSiteConstruct for comprehensive static website hosting#9

Merged
ncipollina merged 5 commits into
mainfrom
feature/static-site-construct
Jul 8, 2025
Merged

Add StaticSiteConstruct for comprehensive static website hosting#9
ncipollina merged 5 commits into
mainfrom
feature/static-site-construct

Conversation

@ncipollina

Copy link
Copy Markdown
Contributor

Summary

• Add StaticSiteConstruct with S3, CloudFront, SSL, Route53, and asset deployment
• Support optional API proxying through CloudFront behaviors for /api/* paths
• Include alternate domain configuration for multi-domain sites
• Add comprehensive testing infrastructure with AutoFixture and CDK assertions
• Include fluent builders for common scenarios (blog, docs, SPA)
• Add XML documentation for all public APIs
• Update README.md and CLAUDE.md with complete documentation and examples

Test Plan

  • Add missing unit tests for WithAlternateDomain and WithAlternateDomains methods
  • Verify all existing tests pass with new StaticSiteConstruct
  • Test AutoFixture customizations for realistic test data
  • Verify CDK assertion helpers work correctly with generated CloudFormation templates
  • Test scenario-based builders (ForBlog, ForDocumentation, ForSinglePageApp)
  • Verify asset path resolution and test asset management
  • Test both API proxy enabled and disabled scenarios
  • Test multiple alternate domain configurations

🤖 Generated with Claude Code

• Add StaticSiteConstruct with S3, CloudFront, SSL, Route53, and asset deployment
• Support optional API proxying through CloudFront behaviors for /api/* paths
• Include alternate domain configuration for multi-domain sites
• Add comprehensive testing infrastructure with AutoFixture and CDK assertions
• Include fluent builders for common scenarios (blog, docs, SPA)
• Add XML documentation for all public APIs
• Update README.md and CLAUDE.md with complete documentation and examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ncipollina
ncipollina requested a review from Copilot July 7, 2025 20:02

This comment was marked as outdated.

• Replace unused app variables with _ discard pattern
• Replace unused construct variables with _ discard pattern
• Apply linter formatting fix for array initialization syntax
• Maintain construct instantiation for test side effects

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ncipollina
ncipollina requested a review from Copilot July 8, 2025 12:40

This comment was marked as outdated.

ncipollina and others added 2 commits July 8, 2025 08:48
• Fix README documentation: script.js → app.js, add about.html
• Add comprehensive unit tests for StaticSiteConstructCustomization
• Verify parameterized behavior for includeApiDomain and includeAlternateDomains
• Test CdkTestHelper.CreateStaticSitePropsBuilder() with defaults and custom paths
• Ensure testing infrastructure works correctly with AutoFixture

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
• Add PropsBuilder_ShouldConfigureSnapStart test for EnableSnapStart = true
• Add PropsBuilder_ShouldDisableSnapStart test for EnableSnapStart = false
• Verify WithSnapStart method works correctly in both enabled and disabled states
• Complete test coverage for LambdaFunctionConstructPropsBuilder

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ncipollina
ncipollina requested a review from Copilot July 8, 2025 12:51

This comment was marked as outdated.

• Change default _assetPath from "./test-static-site" to CdkTestHelper.GetTestAssetPath("TestAssets/static-site")
• Ensure default path matches actual test asset directory structure
• Prevent test failures when using builder directly without explicit asset path
• Maintain consistency with actual test asset organization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@ncipollina
ncipollina requested a review from Copilot July 8, 2025 12:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new StaticSiteConstruct to provide end-to-end static website hosting on S3, CloudFront, SSL certificates, Route53, and optional API proxying. It also introduces comprehensive testing support (builders, assertions, custom AutoFixture customizations), sample static-site test assets, and updates documentation.

  • Introduce StaticSiteConstruct implementation with S3 bucket, CloudFront, certificate, DNS, and deployments
  • Add test support: StaticSiteConstructPropsBuilder, StaticSiteConstructAssertions, AutoFixture customizations/attributes, and sample test assets
  • Update README and CLAUDE guidance with usage examples and test instructions

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/LayeredCraft.Cdk.Constructs.Tests/Testing/TestingHelpersTests.cs Add tests for StaticSiteConstructCustomization and builder defaults
test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Customizations/StaticSiteConstructCustomization.cs New AutoFixture customization for StaticSiteConstructProps
test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Attributes/StaticSiteConstructAutoDataAttribute.cs New [StaticSiteConstructAutoData] attribute
test/LayeredCraft.Cdk.Constructs.Tests/TestAssets/static-site/* Add sample static-site assets (HTML, CSS, JS)
test/LayeredCraft.Cdk.Constructs.Tests/LayeredCraft.Cdk.Constructs.Tests.csproj Include static-site assets in test project output
test/LayeredCraft.Cdk.Constructs.Tests/Constructs/StaticSiteConstructTests.cs Add unit tests covering StaticSiteConstruct scenarios
src/LayeredCraft.Cdk.Constructs/Testing/StaticSiteConstructPropsBuilder.cs Add fluent builder for static-site props
src/LayeredCraft.Cdk.Constructs/Testing/StaticSiteConstructAssertions.cs Add CDK assertion helpers for static-site constructs
src/LayeredCraft.Cdk.Constructs/Testing/CdkTestHelper.cs Extend CdkTestHelper with CreateStaticSitePropsBuilder
src/LayeredCraft.Cdk.Constructs/Models/StaticSiteConstructProps.cs Add IStaticSiteConstructProps and StaticSiteConstructProps record
src/LayeredCraft.Cdk.Constructs/Constructs/StaticSiteConstruct.cs Implement the new StaticSiteConstruct class
README.md Document static-site construct usage and testing
CLAUDE.md Update guidance for static-site construct features
Comments suppressed due to low confidence (2)

test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Customizations/StaticSiteConstructCustomization.cs:9

  • [nitpick] Add <param> XML documentation for includeApiDomain and includeAlternateDomains parameters to clarify their purpose.
public class StaticSiteConstructCustomization(bool includeApiDomain = true, bool includeAlternateDomains = true)

test/LayeredCraft.Cdk.Constructs.Tests/Testing/TestingHelpersTests.cs:1

  • The test uses Path.IsPathRooted(...) but System.IO is not imported. Add using System.IO; at the top of the file.
using Amazon.CDK.Assertions;

@ncipollina
ncipollina merged commit 5e68a79 into main Jul 8, 2025
1 check passed
@ncipollina
ncipollina deleted the feature/static-site-construct branch July 8, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants