Skip to content

Commit ed4f24a

Browse files
committed
fix: apply Managed- part of cache policy automatically
1 parent e4e9569 commit ed4f24a

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ features are as follows:
8484
export interface AWSAdapterProps {
8585
artifactPath?: string // Build output directory (default: build)
8686
autoDeploy?: boolean // Should automatically deploy in SvelteKit build step (default: false)
87-
cachePolicy?: string // Cloudfront managed cache policy (default: 'Managed-CachingOptimized')
87+
cachePolicy?: string // Cloudfront managed cache policy (default: 'CachingOptimized')
8888
defaultHeaders?: string[] // Default whitelist of headers for the SSR server. (default: ['Accept','Accept-Language','If-None-Match','Host','Origin','Referer','X-Forwarded-Host'])
8989
esbuildOptions?: any // Override or extend default esbuild options for the SSR server. Supports `external` (default `['node:*']`), `format` (default `cjs`), `target` (default `node18`), `banner` (default `{}`).
9090
extraHeaders?: string[] // Additional headers to add to whitelist. (default: [])

adapter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface AWSAdapterProps {
3232
export function adapter({
3333
artifactPath = 'build',
3434
autoDeploy = false,
35-
cachePolicy = 'Managed-CachingOptimized',
35+
cachePolicy = 'CachingOptimized',
3636
defaultHeaders = [
3737
'Accept',
3838
'Accept-Language',
@@ -77,7 +77,7 @@ export function adapter({
7777

7878
await serverStack.setAllConfig({
7979
'aws:region': { value: region },
80-
cachePolicy: { value: cachePolicy },
80+
cachePolicy: { value: `Managed-${cachePolicy}` },
8181
projectPath: { value: process.cwd() },
8282
serverPath: { value: server_directory },
8383
optionsPath: { value: options_directory },

tests/adapter.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ describe('adapter.ts', () => {
9393
const awsAdapter = adapter.adapter({
9494
artifactPath: tmpDir,
9595
autoDeploy: true,
96+
stackName: 'mock',
9697
})
9798
await awsAdapter.adapt(builder)
9899

0 commit comments

Comments
 (0)