Skip to content

Commit

Permalink
fix: apply Managed- part of cache policy automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
H0R5E committed Sep 9, 2024
1 parent e4e9569 commit ed4f24a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ features are as follows:
export interface AWSAdapterProps {
artifactPath?: string // Build output directory (default: build)
autoDeploy?: boolean // Should automatically deploy in SvelteKit build step (default: false)
cachePolicy?: string // Cloudfront managed cache policy (default: 'Managed-CachingOptimized')
cachePolicy?: string // Cloudfront managed cache policy (default: 'CachingOptimized')
defaultHeaders?: string[] // Default whitelist of headers for the SSR server. (default: ['Accept','Accept-Language','If-None-Match','Host','Origin','Referer','X-Forwarded-Host'])
esbuildOptions?: any // Override or extend default esbuild options for the SSR server. Supports `external` (default `['node:*']`), `format` (default `cjs`), `target` (default `node18`), `banner` (default `{}`).
extraHeaders?: string[] // Additional headers to add to whitelist. (default: [])
Expand Down
4 changes: 2 additions & 2 deletions adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface AWSAdapterProps {
export function adapter({
artifactPath = 'build',
autoDeploy = false,
cachePolicy = 'Managed-CachingOptimized',
cachePolicy = 'CachingOptimized',
defaultHeaders = [
'Accept',
'Accept-Language',
Expand Down Expand Up @@ -77,7 +77,7 @@ export function adapter({

await serverStack.setAllConfig({
'aws:region': { value: region },
cachePolicy: { value: cachePolicy },
cachePolicy: { value: `Managed-${cachePolicy}` },
projectPath: { value: process.cwd() },
serverPath: { value: server_directory },
optionsPath: { value: options_directory },
Expand Down
1 change: 1 addition & 0 deletions tests/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ describe('adapter.ts', () => {
const awsAdapter = adapter.adapter({
artifactPath: tmpDir,
autoDeploy: true,
stackName: 'mock',
})
await awsAdapter.adapt(builder)

Expand Down

0 comments on commit ed4f24a

Please sign in to comment.