Skip to content

Commit

Permalink
docs: upgrade website docs
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Correa Casablanca <andreu@kindspells.dev>
  • Loading branch information
castarco committed Apr 29, 2024
1 parent 2efc44e commit 3a4882b
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 81 deletions.
2 changes: 1 addition & 1 deletion @kindspells/astro-shield/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"url": "https://ko-fi.com/coderspirit"
}
],
"packageManager": "pnpm@8.15.6",
"packageManager": "pnpm@9.0.6",
"engines": {
"node": ">= 18.0.0"
},
Expand Down
8 changes: 2 additions & 6 deletions @kindspells/astro-shield/src/headers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export const serialiseHashes = hashes =>
* @returns {string}
*/
export const serializeCspDirectiveSources = hashes =>
Array.from(hashes)
.sort()
.join(' ')
Array.from(hashes).sort().join(' ')

/**
* @param {CSPDirectives} directives
Expand All @@ -44,9 +42,7 @@ export const serialiseCspDirectives = directives =>
export const setSrcDirective = (directives, srcType, hashes) => {
const baseSrcDirective = directives[srcType]
if (baseSrcDirective) {
const srcDirective = new Set(
baseSrcDirective.split(/\s+/),
)
const srcDirective = new Set(baseSrcDirective.split(/\s+/))
for (const hash of hashes) {
srcDirective.add(`'${hash}'`)
}
Expand Down
8 changes: 8 additions & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export default defineConfig({
image: {
service: passthroughImageService(),
},
i18n: {
locales: ['en'],
defaultLocale: 'en',
},
integrations: [
shield({}),
starlight({
Expand All @@ -26,6 +30,10 @@ export default defineConfig({
label: 'English',
lang: 'en',
},
en: {
label: 'English',
lang: 'en',
},
},
social: {
github: 'https://github.com/kindspells/astro-shield',
Expand Down
7 changes: 4 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"type": "module",
"version": "1.4.0",
"scripts": {
"dev": "sst dev astro dev",
"start": "astro dev",
"astro": "astro",
"build": "moon run build",
"deploy":"sst deploy --stage prod",
"dev": "sst dev astro dev",
"preview": "astro preview",
"astro": "astro"
"start": "astro dev"
},
"dependencies": {
"astro-sst": "^2.41.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ export default defineConfig({
`}
/>

<Aside type='tip'>
By default, Astro-Shield will add `'self`' to the `script-src` directive. You
can override this behavior by setting your own `script-src` directive (which
can be an empty string).
</Aside>

<Aside type="caution">
When enabling CSP headers, you must also set the `sri.enableMiddleware` option
to `true`. It is also recommended to set the `sri.hashesModule` option.
Expand Down
4 changes: 2 additions & 2 deletions docs/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default $config({
async run() {
new sst.aws.Astro("AstroShield", {
domain: {
hostedZone: 'kindspells.dev',
domainName: 'astro-shield.kindspells.dev'
dns: sst.aws.dns(),
name: 'astro-shield.kindspells.dev'
}
});
},
Expand Down
3 changes: 2 additions & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
*
* SPDX-License-Identifier: MIT
*/
"extends": "astro/tsconfigs/strictest"
"extends": "astro/tsconfigs/strictest",
"exclude": ["dist/**/*", "node_modules/**/*"]
}
136 changes: 68 additions & 68 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3a4882b

Please sign in to comment.