@jaypie/mcp 0.8.46 → 0.8.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/suites/docs/index.js +1 -1
- package/package.json +1 -1
- package/release-notes/fabricator/0.3.2.md +28 -0
- package/release-notes/mcp/0.8.47.md +12 -0
- package/release-notes/mcp/0.8.48.md +10 -0
- package/skills/agents.md +1 -1
- package/skills/cdk.md +2 -1
- package/skills/dns.md +2 -1
- package/skills/fabricator.md +76 -0
- package/skills/infrastructure.md +2 -1
- package/skills/skills.md +1 -1
- package/skills/web.md +205 -0
|
@@ -9,7 +9,7 @@ import { gt } from 'semver';
|
|
|
9
9
|
/**
|
|
10
10
|
* Docs Suite - Documentation services (skill, version, release_notes)
|
|
11
11
|
*/
|
|
12
|
-
const BUILD_VERSION_STRING = "@jaypie/mcp@0.8.
|
|
12
|
+
const BUILD_VERSION_STRING = "@jaypie/mcp@0.8.48#ce72b43d"
|
|
13
13
|
;
|
|
14
14
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
15
15
|
const __dirname$1 = path.dirname(__filename$1);
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: 0.3.2
|
|
3
|
+
date: 2026-04-24
|
|
4
|
+
summary: Adds fab.corpus() for seeded corpus text generation
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Changes
|
|
8
|
+
|
|
9
|
+
- New `fab.corpus(words?, options?)` method on `Fabricator` for generating deterministic prose fixtures.
|
|
10
|
+
- Default 108 words; pass a number for any other size.
|
|
11
|
+
- Custom corpus support: pass `corpus` (raw text) or `words` (explicit weights). Custom and default English pools blend 50/50 by default; tune with `blend` or skip defaults with `replaceDefaults: true`.
|
|
12
|
+
- Custom token functions via `functions` option — each function receives the fabricator and emits one token per draw, with weight subtracted from the main word stream. Useful for UUIDs, dollar amounts, emails, and other non-word-shaped tokens. Shorthand `[fn, weight]` for one function, `[[fn1, w1], [fn2, w2]]` for many.
|
|
13
|
+
- Full passthrough of typo rate, phonotactic rate, sentence/punctuation density, and a `chars` escape hatch for char-length output.
|
|
14
|
+
- `CorpusOptions`, `CorpusTokenFunction`, and `CorpusFunctionEntry` types exported from `@jaypie/fabricator`.
|
|
15
|
+
|
|
16
|
+
## Determinism contract
|
|
17
|
+
|
|
18
|
+
- Each call advances the fabricator's faker state, so successive calls with the same params return different output (`fab.corpus(100) !== fab.corpus(100)`).
|
|
19
|
+
- Replaying from a fresh `fabricator(seed)` reproduces the same sequence.
|
|
20
|
+
- Word count and options are folded into the per-call seed, so different params produce independent streams — `corpus(100)` and `corpus(101)` are not off-by-one variants of each other.
|
|
21
|
+
|
|
22
|
+
## Why
|
|
23
|
+
|
|
24
|
+
Test fixtures and seeded benchmarks frequently want bulk prose with stable, reproducible content. `lorem` is too uniform; ad-hoc generators are non-deterministic. `corpus()` fills that gap with a single ergonomic call that respects the fabricator's seeding contract.
|
|
25
|
+
|
|
26
|
+
## Implementation note
|
|
27
|
+
|
|
28
|
+
Generator internals (`babble`, `phonotactic`, English word/typo data, `Rng`) live in `src/corpus/` as a private vendored module. They are not exported — only the `corpus()` method and `CorpusOptions` type.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: 0.8.47
|
|
3
|
+
date: 2026-04-22
|
|
4
|
+
summary: Add web skill covering JaypieWebDeploymentBucket, JaypieStaticWebBucket, and related CloudFront/S3 web hosting patterns
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Changes
|
|
8
|
+
|
|
9
|
+
- Added `skill("web")` covering static site hosting with `@jaypie/constructs`: `JaypieWebDeploymentBucket`, `JaypieStaticWebBucket`, and pointers to `JaypieDistribution` for dynamic origins
|
|
10
|
+
- Documented the OIDC deploy role flow, CfnOutputs consumed by CI/CD (`DestinationBucketName`, `DestinationBucketDeployRoleArn`, `DistributionId`, `CertificateArn`), and production caching behavior
|
|
11
|
+
- Registered `web` under the infrastructure category in `skill("skills")`, `skill("agents")`, and `skill("infrastructure")`
|
|
12
|
+
- Cross-linked from `skill("cdk")` (added to See Also) and `skill("dns")` (added to related + See Also)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: 0.8.48
|
|
3
|
+
date: 2026-04-24
|
|
4
|
+
summary: Update fabricator skill with corpus() coverage
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Changes
|
|
8
|
+
|
|
9
|
+
- Added a Corpus section to `skill("fabricator")` covering `fab.corpus()`: signatures, determinism contract (advance per call, replay across runs, params-folded-into-seed), custom corpus blending (`corpus`, `words`, `blend`, `replaceDefaults`), and custom token functions (`functions` shorthand and array forms).
|
|
10
|
+
- Documented the full `CorpusOptions` shape and `CorpusTokenFunction` type.
|
package/skills/agents.md
CHANGED
|
@@ -34,7 +34,7 @@ Complete stack styles, techniques, and traditions.
|
|
|
34
34
|
|
|
35
35
|
Contents: index, releasenotes
|
|
36
36
|
Development: apikey, documentation, errors, llm, logs, mocks, monorepo, repokit, style, subpackages, tests, tools
|
|
37
|
-
Infrastructure: apigateway, aws, cdk, cicd, datadog, dns, dynamodb, express, lambda, migrations, secrets, sqs, streaming, variables, websockets
|
|
37
|
+
Infrastructure: apigateway, aws, cdk, cicd, datadog, dns, dynamodb, express, lambda, migrations, secrets, sqs, streaming, variables, web, websockets
|
|
38
38
|
Patterns: api, fabric, handlers, models, services, vocabulary
|
|
39
39
|
Recipes: recipe-api-server
|
|
40
40
|
Meta: issues, jaypie, mcp, skills
|
package/skills/cdk.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: CDK constructs and deployment patterns
|
|
3
|
-
related: apikey, aws, cicd, dynamodb, express, lambda, migrations, secrets, streaming, websockets
|
|
3
|
+
related: apikey, aws, cicd, dynamodb, express, lambda, migrations, secrets, streaming, web, websockets
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# CDK Constructs
|
|
@@ -422,4 +422,5 @@ new JaypieOrganizationTrail(this, "OrgTrail", {
|
|
|
422
422
|
- **`skill("secrets")`** - Secret management with JaypieEnvSecret
|
|
423
423
|
- **`skill("streaming")`** - JaypieDistribution and JaypieNextJs streaming configuration
|
|
424
424
|
- **`skill("variables")`** - Environment variables reference
|
|
425
|
+
- **`skill("web")`** - JaypieWebDeploymentBucket and JaypieStaticWebBucket for static sites
|
|
425
426
|
- **`skill("websockets")`** - JaypieWebSocket and JaypieWebSocketTable constructs
|
package/skills/dns.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: DNS and domain configuration
|
|
3
|
-
related: cdk,
|
|
3
|
+
related: aws, cdk, web
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# DNS Configuration
|
|
@@ -135,4 +135,5 @@ openssl s_client -connect app.example.com:443 -servername app.example.com
|
|
|
135
135
|
## See Also
|
|
136
136
|
|
|
137
137
|
- **`skill("cdk")`** - CDK constructs including JaypieDistribution and JaypieNextJs
|
|
138
|
+
- **`skill("web")`** - Static site hosting with JaypieWebDeploymentBucket and JaypieStaticWebBucket
|
|
138
139
|
|
package/skills/fabricator.md
CHANGED
|
@@ -85,6 +85,82 @@ fab.generate.person();
|
|
|
85
85
|
- **RARE (2.1%)**: firstName is a surname, lastName is hyphenated
|
|
86
86
|
- **EPIC (0.307%)**: double middle names
|
|
87
87
|
|
|
88
|
+
### Corpus
|
|
89
|
+
|
|
90
|
+
Generate deterministic prose for fixtures, snapshots, or seeded benchmarks.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const fab = fabricator("seed");
|
|
94
|
+
|
|
95
|
+
fab.corpus(); // 108 words of English-ish prose (default)
|
|
96
|
+
fab.corpus(1000); // 1000 words
|
|
97
|
+
fab.corpus({ wordsPerPeriod: 10 });
|
|
98
|
+
fab.corpus(500, { typoRate: 0.20 });
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Determinism contract
|
|
102
|
+
|
|
103
|
+
- Each call **advances** the fabricator's faker state, so successive calls with the same params return different output (`fab.corpus(100) !== fab.corpus(100)`).
|
|
104
|
+
- Replaying from a fresh `fabricator(seed)` reproduces the same sequence.
|
|
105
|
+
- Word count and options are folded into the per-call seed, so different params produce **independent** streams. `corpus(100)` and `corpus(101)` differ across the whole text — not by one word.
|
|
106
|
+
|
|
107
|
+
#### Custom corpus
|
|
108
|
+
|
|
109
|
+
Mix domain vocabulary into the output. By default the custom pool blends 50/50 with default English; typo (~6%) and phonotactic invention (~3%) rates stay at their defaults.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
fab.corpus(500, { corpus: deployLogText }); // raw text → derived weights
|
|
113
|
+
fab.corpus(500, { words: [["deploy", 5], ["lambda", 2]] });
|
|
114
|
+
|
|
115
|
+
fab.corpus(500, { corpus: deployLogText, blend: 0.7 }); // tune the mix
|
|
116
|
+
fab.corpus(500, { corpus: deployLogText, replaceDefaults: true }); // pure custom
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Custom token functions
|
|
120
|
+
|
|
121
|
+
For non-word-shaped tokens (UUIDs, dollar amounts, IDs), pass `functions`. Each function receives the fabricator and emits one token per draw. Weight is the share of total content tokens taken from the main word stream.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// Shorthand for a single function
|
|
125
|
+
fab.corpus(500, {
|
|
126
|
+
functions: [({ fab }) => fab.string.uuid(), 0.03],
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Multiple functions
|
|
130
|
+
fab.corpus(500, {
|
|
131
|
+
functions: [
|
|
132
|
+
[({ fab }) => fab.string.uuid(), 0.03],
|
|
133
|
+
[({ fab }) => "$" + fab.finance.amount(), 0.04],
|
|
134
|
+
[({ fab }) => fab.internet.email(), 0.02],
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### Full options
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
interface CorpusOptions {
|
|
143
|
+
corpus?: string; // raw text → derive weights
|
|
144
|
+
words?: ReadonlyArray<readonly [string, number]>; // explicit weights
|
|
145
|
+
blend?: number; // share given to custom pool, default 0.5
|
|
146
|
+
replaceDefaults?: boolean; // skip default English entirely
|
|
147
|
+
typos?: ReadonlyArray<readonly [string, number]>; // override typo pool
|
|
148
|
+
phonotactic?: PhonotacticOptions; // tune invented words
|
|
149
|
+
typoRate?: number; // default 0.06
|
|
150
|
+
phonotacticRate?: number; // default 0.03
|
|
151
|
+
wordsPerPeriod?: number; // default 17
|
|
152
|
+
wordsPerComma?: number; // default 22
|
|
153
|
+
periodsPerBreak?: number; // default 5
|
|
154
|
+
sentences?: boolean; // default true
|
|
155
|
+
chars?: number; // generate by char length instead of word count
|
|
156
|
+
functions?: // custom token functions
|
|
157
|
+
| readonly [CorpusTokenFunction, number]
|
|
158
|
+
| ReadonlyArray<readonly [CorpusTokenFunction, number]>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
type CorpusTokenFunction = (params: { fab: Fabricator }) => string;
|
|
162
|
+
```
|
|
163
|
+
|
|
88
164
|
## CHANCE Constants
|
|
89
165
|
|
|
90
166
|
```typescript
|
package/skills/infrastructure.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: AWS, CDK, CI/CD, and observability
|
|
3
|
-
related: aws, cdk, cicd, cicd-actions, cicd-deploy, cicd-environments, datadog, dns, dynamodb, secrets, variables, websockets
|
|
3
|
+
related: aws, cdk, cicd, cicd-actions, cicd-deploy, cicd-environments, datadog, dns, dynamodb, secrets, variables, web, websockets
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Infrastructure
|
|
@@ -23,4 +23,5 @@ Cloud infrastructure and deployment patterns.
|
|
|
23
23
|
| `migrations` | DynamoDB migration custom resources |
|
|
24
24
|
| `secrets` | AWS Secrets Manager |
|
|
25
25
|
| `variables` | Environment variables reference |
|
|
26
|
+
| `web` | Static site and web content hosting |
|
|
26
27
|
| `websockets` | WebSocket API Gateway constructs |
|
package/skills/skills.md
CHANGED
|
@@ -17,7 +17,7 @@ Look up skills by alias: `mcp__jaypie__skill(alias)`
|
|
|
17
17
|
|----------|--------|
|
|
18
18
|
| contents | index, releasenotes |
|
|
19
19
|
| development | apikey, documentation, errors, llm, logs, mocks, monorepo, repokit, style, subpackages, tests, tools |
|
|
20
|
-
| infrastructure | apigateway, aws, cdk, cicd, datadog, dns, dynamodb, express, lambda, migrations, secrets, sqs, streaming, variables, websockets |
|
|
20
|
+
| infrastructure | apigateway, aws, cdk, cicd, datadog, dns, dynamodb, express, lambda, migrations, secrets, sqs, streaming, variables, web, websockets |
|
|
21
21
|
| patterns | api, fabric, handlers, models, services, vocabulary |
|
|
22
22
|
| recipes | recipe-api-server |
|
|
23
23
|
| meta | issues, jaypie, mcp, skills |
|
package/skills/web.md
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Static site and web content hosting with CloudFront, S3, and DNS
|
|
3
|
+
related: cdk, cicd-deploy, dns, secrets, streaming
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Web Hosting
|
|
7
|
+
|
|
8
|
+
Deploying static websites and web content through `@jaypie/constructs`. Pair an S3 origin with a CloudFront distribution, Route53 alias, ACM certificate, and (optionally) an OIDC deploy role for GitHub Actions — all wired up by one construct.
|
|
9
|
+
|
|
10
|
+
## Constructs
|
|
11
|
+
|
|
12
|
+
| Construct | Purpose |
|
|
13
|
+
|-----------|---------|
|
|
14
|
+
| `JaypieWebDeploymentBucket` | S3 + CloudFront + Route53 + OIDC deploy role for a static site |
|
|
15
|
+
| `JaypieStaticWebBucket` | Pre-configured `JaypieWebDeploymentBucket` that defaults to the `static` subdomain |
|
|
16
|
+
| `JaypieDistribution` | CloudFront in front of a dynamic handler (Lambda / Function URL / origin) |
|
|
17
|
+
| `JaypieNextJs` | Server-rendered Next.js deployment (see `skill("cdk")`) |
|
|
18
|
+
|
|
19
|
+
Use `JaypieWebDeploymentBucket` / `JaypieStaticWebBucket` for pre-built assets (SPA bundles, static docs). Use `JaypieDistribution` when CloudFront fronts an Express Lambda or streaming handler. Use `JaypieNextJs` for SSR Next.js.
|
|
20
|
+
|
|
21
|
+
## JaypieWebDeploymentBucket
|
|
22
|
+
|
|
23
|
+
Static site on S3 fronted by CloudFront, wired to Route53 and ACM. Setting `CDK_ENV_REPO` also provisions an OIDC deploy role with scoped S3 and CloudFront invalidation permissions for GitHub Actions.
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { JaypieWebDeploymentBucket } from "@jaypie/constructs";
|
|
27
|
+
|
|
28
|
+
new JaypieWebDeploymentBucket(this, "Web", {
|
|
29
|
+
host: "app.example.com",
|
|
30
|
+
zone: "example.com",
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Props
|
|
35
|
+
|
|
36
|
+
| Prop | Type | Default |
|
|
37
|
+
|------|------|---------|
|
|
38
|
+
| `host` | `string` | `mergeDomain(CDK_ENV_WEB_SUBDOMAIN, CDK_ENV_WEB_HOSTED_ZONE \|\| CDK_ENV_HOSTED_ZONE)` |
|
|
39
|
+
| `zone` | `string \| IHostedZone \| JaypieHostedZone` | `CDK_ENV_WEB_HOSTED_ZONE \|\| CDK_ENV_HOSTED_ZONE` |
|
|
40
|
+
| `certificate` | `boolean \| ICertificate` | `true` (creates via `resolveCertificate`) |
|
|
41
|
+
| `name` | `string` | `constructEnvName("web")` |
|
|
42
|
+
| `roleTag` | `string` | `CDK.ROLE.HOSTING` |
|
|
43
|
+
|
|
44
|
+
Also accepts all `s3.BucketProps` — the bucket defaults to `autoDeleteObjects: true`, `publicReadAccess: true`, `websiteIndexDocument: "index.html"`, `websiteErrorDocument: "index.html"` (SPA-friendly).
|
|
45
|
+
|
|
46
|
+
### CloudFront
|
|
47
|
+
|
|
48
|
+
- Default behavior: S3 static website origin, `REDIRECT_TO_HTTPS`, `CACHING_DISABLED`.
|
|
49
|
+
- In production (`isProductionEnv()`), a second behavior on `/*` enables `CACHING_OPTIMIZED` — `index.html` stays uncached so SPA deploys are visible immediately; hashed assets get edge cache.
|
|
50
|
+
|
|
51
|
+
### DNS
|
|
52
|
+
|
|
53
|
+
Creates an A record alias to the distribution. Tags the record with `CDK.ROLE.NETWORKING`.
|
|
54
|
+
|
|
55
|
+
### Deploy Role (OIDC)
|
|
56
|
+
|
|
57
|
+
When `CDK_ENV_REPO` is set (e.g., `finlaysonstudio/jaypie`), the construct creates an IAM role assumed via GitHub OIDC with:
|
|
58
|
+
|
|
59
|
+
- `s3:PutObject`, `s3:DeleteObject`, `s3:GetObject`, `s3:ListObjectsV2` on the bucket
|
|
60
|
+
- `s3:ListBucket` on the bucket
|
|
61
|
+
- `cloudformation:DescribeStacks` on the owning stack (so workflows can read outputs)
|
|
62
|
+
- `cloudfront:CreateInvalidation` on the distribution
|
|
63
|
+
|
|
64
|
+
Exposed as `CfnOutput`s for workflow consumption:
|
|
65
|
+
|
|
66
|
+
| Output | Contents |
|
|
67
|
+
|--------|----------|
|
|
68
|
+
| `DestinationBucketName` | Target bucket for `aws s3 sync` |
|
|
69
|
+
| `DestinationBucketDeployRoleArn` | Role ARN for `aws-actions/configure-aws-credentials` |
|
|
70
|
+
| `DistributionId` | CloudFront distribution for `aws cloudfront create-invalidation` |
|
|
71
|
+
| `CertificateArn` | ACM certificate ARN (when a certificate is created) |
|
|
72
|
+
|
|
73
|
+
See `skill("cicd-deploy")` for the workflow pattern that reads these outputs and deploys content.
|
|
74
|
+
|
|
75
|
+
## JaypieStaticWebBucket
|
|
76
|
+
|
|
77
|
+
`JaypieWebDeploymentBucket` with `static` as the default subdomain. Use for a "static.example.com" asset site sharing the project's hosted zone.
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import { JaypieStaticWebBucket } from "@jaypie/constructs";
|
|
81
|
+
|
|
82
|
+
// Minimal — host defaults to `envHostname({ subdomain: "static" })`,
|
|
83
|
+
// zone defaults to CDK_ENV_DOMAIN || CDK_ENV_HOSTED_ZONE
|
|
84
|
+
new JaypieStaticWebBucket(this, "Static");
|
|
85
|
+
|
|
86
|
+
// Override host/zone when needed
|
|
87
|
+
new JaypieStaticWebBucket(this, "Docs", {
|
|
88
|
+
host: "docs.example.com",
|
|
89
|
+
zone: "example.com",
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The default `name` is `constructEnvName("static")` so the bucket is namespaced per environment.
|
|
94
|
+
|
|
95
|
+
## Environment-Aware Hosts
|
|
96
|
+
|
|
97
|
+
`envHostname()` resolves a hostname from `PROJECT_ENV`, producing apex for production and a prefixed subdomain otherwise.
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { envHostname, JaypieStaticWebBucket } from "@jaypie/constructs";
|
|
101
|
+
|
|
102
|
+
// production → "jaypie.net"
|
|
103
|
+
// sandbox → "sandbox.jaypie.net"
|
|
104
|
+
// development → "development.jaypie.net"
|
|
105
|
+
const host = envHostname({ domain: "jaypie.net" });
|
|
106
|
+
|
|
107
|
+
new JaypieStaticWebBucket(this, "Bucket", { host, zone: "jaypie.net" });
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
See `skill("variables")` for the `PROJECT_ENV` / `CDK_ENV_*` variables involved.
|
|
111
|
+
|
|
112
|
+
## JaypieDistribution (dynamic origins)
|
|
113
|
+
|
|
114
|
+
For CloudFront in front of an Express Lambda, Function URL, or custom origin — not a static S3 site — reach for `JaypieDistribution`. It ships with ACM, Route53 alias, WAF, and security headers by default.
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { JaypieDistribution, JaypieExpressLambda } from "@jaypie/constructs";
|
|
118
|
+
|
|
119
|
+
const api = new JaypieExpressLambda(this, "Api", {
|
|
120
|
+
code: "../api/dist",
|
|
121
|
+
handler: "index.handler",
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
new JaypieDistribution(this, "Distribution", {
|
|
125
|
+
handler: api,
|
|
126
|
+
host: "api.example.com",
|
|
127
|
+
zone: "example.com",
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Security headers (`ResponseHeadersPolicy`) and WAFv2 WebACL are covered in `skill("cdk")`. Response streaming with `createLambdaStreamHandler` is covered in `skill("streaming")`.
|
|
132
|
+
|
|
133
|
+
### Certificate Sharing
|
|
134
|
+
|
|
135
|
+
`resolveCertificate` caches certificates at the stack level by domain, so swapping `JaypieDistribution` ↔ `JaypieApiGateway` on the same hostname does not tear down or recreate the certificate. For explicit control:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import { JaypieCertificate, JaypieDistribution } from "@jaypie/constructs";
|
|
139
|
+
|
|
140
|
+
const cert = new JaypieCertificate(this, "ApiCert", {
|
|
141
|
+
domainName: "api.example.com",
|
|
142
|
+
zone: "example.com",
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
new JaypieDistribution(this, "Dist", { handler: api, certificate: cert });
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Environment Variables
|
|
149
|
+
|
|
150
|
+
| Variable | Purpose |
|
|
151
|
+
|----------|---------|
|
|
152
|
+
| `CDK_ENV_HOSTED_ZONE` | Default hosted zone for all web constructs |
|
|
153
|
+
| `CDK_ENV_WEB_HOSTED_ZONE` | Override hosted zone for web buckets specifically |
|
|
154
|
+
| `CDK_ENV_WEB_SUBDOMAIN` | Subdomain under the hosted zone |
|
|
155
|
+
| `CDK_ENV_WEB_HOST` | Full host override (skips subdomain + zone composition) |
|
|
156
|
+
| `CDK_ENV_REPO` | `owner/repo` — when set, provisions the OIDC deploy role |
|
|
157
|
+
| `CDK_ENV_DOMAIN` | Default domain for `JaypieStaticWebBucket` zone resolution |
|
|
158
|
+
|
|
159
|
+
See `skill("variables")` for the full environment variable reference.
|
|
160
|
+
|
|
161
|
+
## Deployment Workflow
|
|
162
|
+
|
|
163
|
+
A typical `feat/*` branch deploy:
|
|
164
|
+
|
|
165
|
+
1. CDK deploys the bucket, distribution, and deploy role.
|
|
166
|
+
2. Workflow reads `DestinationBucketName`, `DestinationBucketDeployRoleArn`, and `DistributionId` from stack outputs.
|
|
167
|
+
3. Workflow assumes the deploy role, runs `aws s3 sync ./dist s3://$BUCKET`, then invalidates `/*` on the distribution.
|
|
168
|
+
|
|
169
|
+
See `skill("cicd-deploy")` for the reusable action pattern.
|
|
170
|
+
|
|
171
|
+
## Stack Example
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
import { Construct } from "constructs";
|
|
175
|
+
import {
|
|
176
|
+
envHostname,
|
|
177
|
+
JaypieAppStack,
|
|
178
|
+
JaypieStaticWebBucket,
|
|
179
|
+
} from "@jaypie/constructs";
|
|
180
|
+
|
|
181
|
+
export class DocumentationStack extends JaypieAppStack {
|
|
182
|
+
public readonly bucket: JaypieStaticWebBucket;
|
|
183
|
+
|
|
184
|
+
constructor(scope: Construct, id?: string) {
|
|
185
|
+
super(scope, id ?? "JaypieDocumentationStack", { key: "documentation" });
|
|
186
|
+
|
|
187
|
+
const zone = process.env.CDK_ENV_HOSTED_ZONE ?? "example.com";
|
|
188
|
+
const host = envHostname({ domain: zone });
|
|
189
|
+
|
|
190
|
+
this.bucket = new JaypieStaticWebBucket(this, "DocumentationBucket", {
|
|
191
|
+
host,
|
|
192
|
+
zone,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## See Also
|
|
199
|
+
|
|
200
|
+
- **`skill("cdk")`** — core constructs, `JaypieDistribution` WAF and security headers, `JaypieNextJs`
|
|
201
|
+
- **`skill("cicd-deploy")`** — workflows that consume `DestinationBucketName` / `DeployRoleArn` / `DistributionId`
|
|
202
|
+
- **`skill("dns")`** — hosted zones, ACM certificates, DNS debugging
|
|
203
|
+
- **`skill("secrets")`** — `JaypieEnvSecret` provider/consumer pattern
|
|
204
|
+
- **`skill("streaming")`** — `JaypieDistribution` streaming configuration
|
|
205
|
+
- **`skill("variables")`** — environment variable reference
|