canopycms 0.0.66-int.82 → 0.0.66-int.83
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/cli/template-files/cms-stack.ts.template +28 -8
- package/dist/cli/template-files/deploy-cms.yml.template +4 -2
- package/dist/operating-mode/deployment-name-fixtures.d.ts +4 -2
- package/dist/operating-mode/deployment-name-fixtures.js +4 -2
- package/dist/operating-mode/deployment-name.d.ts +6 -3
- package/dist/operating-mode/deployment-name.js +6 -3
- package/package.json +1 -1
|
@@ -16,6 +16,15 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'
|
|
|
16
16
|
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager'
|
|
17
17
|
import { Platform } from 'aws-cdk-lib/aws-ecr-assets'
|
|
18
18
|
import { CanopyCmsService, CanopyCmsDistribution } from 'canopycms-cdk'
|
|
19
|
+
// The SAME config file the CMS Lambda reads at request time -- imported here,
|
|
20
|
+
// at synth time, so `baseBranch`/`settingsBranch` below can never drift from
|
|
21
|
+
// `defaultBaseBranch`/`settingsBranch` in canopycms.config.ts the way a
|
|
22
|
+
// hand-copied literal could. As generated by `canopycms init`,
|
|
23
|
+
// `canopycms.config.ts` only imports `defineCanopyConfig` from `canopycms`,
|
|
24
|
+
// which is what makes this safe from a plain `tsx` synth -- if you add
|
|
25
|
+
// server-only or Next.js-specific imports to your own canopycms.config.ts
|
|
26
|
+
// later, this synth-time import pulls those in too.
|
|
27
|
+
import canopyConfig from '../../canopycms.config'
|
|
19
28
|
|
|
20
29
|
export interface CmsStackProps extends StackProps {
|
|
21
30
|
/** GitHub repository the EC2 worker pushes branches and opens PRs against. */
|
|
@@ -91,6 +100,16 @@ export class CmsStack extends Stack {
|
|
|
91
100
|
githubRepo: props.githubRepo,
|
|
92
101
|
deploymentName: props.deploymentName,
|
|
93
102
|
|
|
103
|
+
// Derived from canopycms.config.ts (imported above), not hardcoded or
|
|
104
|
+
// left to CanopyCmsService's own 'main' default. A wrong baseBranch
|
|
105
|
+
// crash-loops the worker forever: verifyBaseBranchExists throws when the
|
|
106
|
+
// named branch doesn't exist in the cloned remote, and systemd restarts
|
|
107
|
+
// into the same failure indefinitely. See CanopyCmsServiceProps.baseBranch's
|
|
108
|
+
// doc comment (packages/canopycms-cdk) for the full mechanism, and
|
|
109
|
+
// .settingsBranch's for the [SYNC-M3] warning this also prevents.
|
|
110
|
+
baseBranch: canopyConfig.server.defaultBaseBranch,
|
|
111
|
+
settingsBranch: canopyConfig.server.settingsBranch,
|
|
112
|
+
|
|
94
113
|
// Secrets the EC2 worker reads. The Lambda needs none of them.
|
|
95
114
|
secretsArns: [githubToken.secretArn, clerkSecretKey.secretArn],
|
|
96
115
|
githubTokenSecretArn: githubToken.secretArn,
|
|
@@ -113,14 +132,13 @@ export class CmsStack extends Stack {
|
|
|
113
132
|
// 2. uncomment the block below, moving it ABOVE `cmsService` (it has to
|
|
114
133
|
// exist before you can pass its bucket);
|
|
115
134
|
// 3. pass `assetBucket: assetSupport.bucket` to CanopyCmsService;
|
|
116
|
-
// 4. pass
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
// },
|
|
135
|
+
// 4. pass `assetSupport` to CanopyCmsDistribution below - it attaches
|
|
136
|
+
// both CloudFront behaviors in the only order that is safe
|
|
137
|
+
// (`/assets/t/*` before `/assets/*`; CloudFront matches path
|
|
138
|
+
// patterns in order, so the general pattern would otherwise
|
|
139
|
+
// swallow the transform one). `cdk synth` fails loudly if a
|
|
140
|
+
// hand-written `additionalBehaviors` ever gets that order wrong
|
|
141
|
+
// instead.
|
|
124
142
|
//
|
|
125
143
|
// `editorOrigins` is REQUIRED: it is the S3 CORS allowlist for the
|
|
126
144
|
// editor's presigned uploads, so it must list the origin the editor is
|
|
@@ -151,6 +169,8 @@ export class CmsStack extends Stack {
|
|
|
151
169
|
// here so that raising `timeout` above cannot silently leave
|
|
152
170
|
// CloudFront answering 504 at the edge on requests that succeed.
|
|
153
171
|
originReadTimeout: cmsService.timeout,
|
|
172
|
+
// Uncomment alongside the `assetSupport` block above to enable media.
|
|
173
|
+
// assetSupport,
|
|
154
174
|
})
|
|
155
175
|
}
|
|
156
176
|
}
|
|
@@ -49,10 +49,12 @@
|
|
|
49
49
|
# the otherwise-obvious GITHUB_TOKEN_SECRET_ARN cannot be created at all.
|
|
50
50
|
# The env var handed to CDK below keeps the unprefixed name.
|
|
51
51
|
# CLERK_SECRET_KEY_SECRET_ARN FULL Secrets Manager ARN (with suffix)
|
|
52
|
-
# CLERK_JWT_KEY Clerk's public JWKS PEM
|
|
53
52
|
# 5. Set these repository variables (same page -> Variables):
|
|
54
53
|
# AWS_REGION e.g. us-east-1
|
|
55
54
|
# NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY or the editor ships unable to sign in
|
|
55
|
+
# CLERK_JWT_KEY Clerk's PUBLIC JWKS PEM. A variable,
|
|
56
|
+
# not a secret: it is public key material,
|
|
57
|
+
# and the CMS Lambda takes public values only
|
|
56
58
|
# CANOPY_BOOTSTRAP_ADMIN_IDS comma-separated Clerk user IDs
|
|
57
59
|
# Optional:
|
|
58
60
|
# CANOPYCMS_DEPLOYMENT_NAME defaults to 'prod'
|
|
@@ -153,7 +155,7 @@ jobs:
|
|
|
153
155
|
env:
|
|
154
156
|
GITHUB_TOKEN_SECRET_ARN: ${{ secrets.CANOPY_GITHUB_TOKEN_SECRET_ARN }}
|
|
155
157
|
CLERK_SECRET_KEY_SECRET_ARN: ${{ secrets.CLERK_SECRET_KEY_SECRET_ARN }}
|
|
156
|
-
CLERK_JWT_KEY: ${{
|
|
158
|
+
CLERK_JWT_KEY: ${{ vars.CLERK_JWT_KEY }}
|
|
157
159
|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ vars.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
|
|
158
160
|
CANOPY_BOOTSTRAP_ADMIN_IDS: ${{ vars.CANOPY_BOOTSTRAP_ADMIN_IDS }}
|
|
159
161
|
CANOPYCMS_DEPLOYMENT_NAME: ${{ vars.CANOPYCMS_DEPLOYMENT_NAME }}
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* The rule that decides whether a `deploymentName` is usable exists TWICE, by
|
|
5
5
|
* necessity: once at runtime (`deployment-name.ts`'s `isValidDeploymentName`)
|
|
6
6
|
* and once at synth time (`canopycms-cdk`'s `constructs/cms-service.ts`).
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* The construct deliberately does not import the real thing — see
|
|
8
|
+
* `isValidDeploymentName`'s doc comment in cms-service.ts for why (not, as
|
|
9
|
+
* this comment used to say, that the published construct lacks a runtime
|
|
10
|
+
* dependency on `canopycms` — it doesn't).
|
|
9
11
|
*
|
|
10
12
|
* The dangerous drift is asymmetric: a rule TIGHTENED at runtime but not at
|
|
11
13
|
* synth produces a stack that synths clean and then crash-loops the Lambda at
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* The rule that decides whether a `deploymentName` is usable exists TWICE, by
|
|
5
5
|
* necessity: once at runtime (`deployment-name.ts`'s `isValidDeploymentName`)
|
|
6
6
|
* and once at synth time (`canopycms-cdk`'s `constructs/cms-service.ts`).
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* The construct deliberately does not import the real thing — see
|
|
8
|
+
* `isValidDeploymentName`'s doc comment in cms-service.ts for why (not, as
|
|
9
|
+
* this comment used to say, that the published construct lacks a runtime
|
|
10
|
+
* dependency on `canopycms` — it doesn't).
|
|
9
11
|
*
|
|
10
12
|
* The dangerous drift is asymmetric: a rule TIGHTENED at runtime but not at
|
|
11
13
|
* synth produces a stack that synths clean and then crash-loops the Lambda at
|
|
@@ -25,9 +25,12 @@
|
|
|
25
25
|
/**
|
|
26
26
|
* Exported so `canopycms-cdk`'s suite can assert that its own synth-time copy
|
|
27
27
|
* of this rule (constructs/cms-service.ts) still agrees with this one. The
|
|
28
|
-
* construct
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* construct deliberately does not import this directly — see
|
|
29
|
+
* `isValidDeploymentName`'s doc comment in cms-service.ts for the real reason
|
|
30
|
+
* (not, as this comment used to say, that the published construct lacks a
|
|
31
|
+
* runtime dependency on `canopycms` — it doesn't: `canopycms` is a
|
|
32
|
+
* non-optional peerDependency there, and the package's own main entry already
|
|
33
|
+
* imports it at runtime). The drift check is therefore test-only — see
|
|
31
34
|
* `deployment-name-fixtures.ts`.
|
|
32
35
|
*/
|
|
33
36
|
export declare const isValidDeploymentName: (name: string) => boolean;
|
|
@@ -42,9 +42,12 @@ const VALID_DEPLOYMENT_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
|
42
42
|
/**
|
|
43
43
|
* Exported so `canopycms-cdk`'s suite can assert that its own synth-time copy
|
|
44
44
|
* of this rule (constructs/cms-service.ts) still agrees with this one. The
|
|
45
|
-
* construct
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* construct deliberately does not import this directly — see
|
|
46
|
+
* `isValidDeploymentName`'s doc comment in cms-service.ts for the real reason
|
|
47
|
+
* (not, as this comment used to say, that the published construct lacks a
|
|
48
|
+
* runtime dependency on `canopycms` — it doesn't: `canopycms` is a
|
|
49
|
+
* non-optional peerDependency there, and the package's own main entry already
|
|
50
|
+
* imports it at runtime). The drift check is therefore test-only — see
|
|
48
51
|
* `deployment-name-fixtures.ts`.
|
|
49
52
|
*/
|
|
50
53
|
export const isValidDeploymentName = (name) => VALID_DEPLOYMENT_NAME.test(name) &&
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"//": "@codemirror/language, @lezer/highlight: workaround — @mdxeditor/editor uses cm6-theme-basic-light which peer-requires these but mdxeditor doesn't declare them as dependencies",
|
|
3
3
|
"name": "canopycms",
|
|
4
|
-
"version": "0.0.66-int.
|
|
4
|
+
"version": "0.0.66-int.83",
|
|
5
5
|
"description": "CanopyCMS core package: schema-driven content, branch-aware editing, and editor UI for Next.js.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|