Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve docs structure #108

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion @kindspells/astro-shield/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"devDependencies": {
"@types/node": "^22.5.5",
"astro": "^4.15.6",
"astro": "^4.15.7",
"get-tsconfig": "^4.8.1",
"rollup": "^4.21.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",
"dependencies": {
"@astrojs/node": "^8.3.3",
"astro": "^4.15.6"
"astro": "^4.15.7"
},
"devDependencies": {
"@kindspells/astro-shield": "workspace:*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"dependencies": {
"@astrojs/node": "^8.3.3",
"astro": "^4.15.6"
"astro": "^4.15.7"
},
"devDependencies": {
"@kindspells/astro-shield": "workspace:*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"dependencies": {
"@astrojs/node": "^8.3.3",
"astro": "^4.15.6"
"astro": "^4.15.7"
},
"devDependencies": {
"@kindspells/astro-shield": "workspace:*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"dependencies": {
"@astrojs/node": "^8.3.3",
"astro": "^4.15.6"
"astro": "^4.15.7"
},
"devDependencies": {
"@kindspells/astro-shield": "workspace:*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"license": "MIT",
"dependencies": {
"astro": "^4.15.6"
"astro": "^4.15.7"
},
"devDependencies": {
"@kindspells/astro-shield": "workspace:*"
Expand Down
85 changes: 69 additions & 16 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import { shield } from '@kindspells/astro-shield'
import aws from 'astro-sst'
import { defineConfig, passthroughImageService } from 'astro/config'

const locales = {
root: { lang: 'en', label: 'English' },
ca: { lang: 'ca', label: 'Català' },
es: { lang: 'es', label: 'Español' },
}

export default defineConfig({
output: 'static',
adapter: aws(),
Expand All @@ -20,27 +26,35 @@ export default defineConfig({
shield({}),
starlight({
title: 'Astro-Shield Docs',
defaultLocale: 'en',
locales: {
root: {
label: 'English',
lang: 'en',
},
en: {
label: 'English',
lang: 'en',
},
},
defaultLocale: 'root',
locales,
social: {
github: 'https://github.com/kindspells/astro-shield',
},
sidebar: [
{
label: 'Start Here',
items: [{ label: 'Getting Started', link: '/getting-started/' }],
translations: {
ca: 'Comença Aquí',
es: 'Empieza Aquí',
},
items: [
{
label: 'Getting Started',
translations: {
ca: 'Començant',
es: 'Empezando',
},
link: '/getting-started/',
},
],
},
{
label: 'Guides',
translations: {
ca: 'Guies',
es: 'Guías',
},
items: [
{
label: 'Subresource Integrity',
Expand All @@ -50,29 +64,68 @@ export default defineConfig({
},
{
label: 'Security Headers',
translations: {
ca: 'Capçaleres de Seguretat',
es: 'Cabeceras de Seguridad',
},
autogenerate: {
directory: 'guides/security-headers',
},
},
{
label: 'Hosting Integrations',
translations: {
ca: "Proveïdors d'Allotjament",
es: 'Proveedores de Alojamiento',
},
autogenerate: {
directory: 'guides/hosting-integrations',
},
},
],
},
{
label: 'Reference',
translations: {
ca: 'Referència',
es: 'Referencia',
},
items: [
{
label: 'Configuration',
translations: {
ca: 'Configuració',
es: 'Configuración',
},
link: '/reference/configuration/',
},
],
},
{
label: 'Other',
translations: {
ca: 'Altres',
es: 'Otros',
},
items: [
{
label: 'Known Limitations',
translations: {
ca: 'Problemes Coneguts',
es: 'Problemas Conocidos',
},
link: '/other/known-limitations/',
},
{
label: 'Contributing',
translations: {
ca: 'Contribució',
es: 'Contribución',
},
link: 'https://github.com/kindspells/astro-shield/blob/main/CONTRIBUTING.md',
},
],
},
// {
// label: 'Reference',
// autogenerate: { directory: 'reference' },
// },
],
}),
],
Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
"dependencies": {
"astro-sst": "^2.43.5",
"sharp": "0.33.5",
"sst": "^3.1.13"
"sst": "^3.1.17"
},
"devDependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/starlight": "^0.27.1",
"@astrojs/starlight": "^0.28.1",
"@astrojs/ts-plugin": "^1.10.2",
"@kindspells/astro-shield": "workspace:^",
"astro": "^4.15.6",
"astro": "^4.15.7",
"typescript": "^5.6.2"
}
}
56 changes: 56 additions & 0 deletions docs/src/content/docs/ca/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# SPDX-FileCopyrightText: 2024 KindSpells Labs S.L.
#
# SPDX-License-Identifier: MIT

title: Començant
description: Comença a protegir els teus llocs web Astro amb Astro-Shield.
---

## Introducció

Astro-Shield t'ajudarà a millorar la seguretat dels teus llocs web Astro
permetent-te aplicar un conjunt ampli de bones pràctiques de seguretat, com ara:
- [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)
- [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)


## How to install

import { Code, Tabs, TabItem } from '@astrojs/starlight/components';

Per a instal·lar-lo, executa la següent comanda al teu terminal:

<Tabs>
<TabItem label="npm">
```bash
npm install --save-dev @kindspells/astro-Shield
```
</TabItem>
<TabItem label="pnpm">
```bash
pnpm add --save-dev @kindspells/astro-shield
```
</TabItem>
<TabItem label="yarn">
```bash
yarn add --dev @kindspells/astro-shield
```
</TabItem>
</Tabs>

## Activant la integració

Al teu fitxer de configuració `astro.config.mjs`, importa Astro-Shield i
afegeix-lo a la llista:

```js
import { defineConfig } from 'astro/config'
import { shield } from '@kindspells/astro-shield'

export default defineConfig({
integrations: [
shield({})
]
})
```
43 changes: 43 additions & 0 deletions docs/src/content/docs/ca/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
# SPDX-FileCopyrightText: 2024 KindSpells Labs S.L.
#
# SPDX-License-Identifier: MIT

title: Benvingut a Astro-Shield
description: Protegeix les teves pàgines web Astro amb Astro-Shield.
template: splash
hero:
tagline: Comença a protegir la teva pàgina web amb Astro-Shield!
image:
file: ../../../assets/astro-shield.webp
actions:
- text: Començar
link: /getting-started/
icon: right-arrow
variant: primary
- text: Aprèn sobre les integracions d'Astro
link: https://docs.astro.build/en/guides/integrations-guide/
icon: external
---

import { Card, CardGrid } from '@astrojs/starlight/components';

## Què fa

<CardGrid stagger>
<Card title="Implementar la Integritat de Subrecursos" icon="pencil">
Astro-Shield s'encarrega de calcular els hashes SRI i de configurar l'atribut
`integrity` a les etiquetes de script i estil per a tu.
</Card>
<Card title="Configurar les capçaleres de Content-Security-Policy" icon="seti:lock">
Astro-Shield pot configurar automàticament les capçaleres de `Content-Security-Policy`
per a tu.
</Card>
<Card title="Bloquejar scripts injectats" icon="close">
Quan Astro-Shield detecta un script sospitós (és a dir, probablement injectat per
un atacant), l'eliminarà de l'HTML renderitzat.
</Card>
{/* <Card title="Prevenir la Contaminació de Prototips" icon="seti:gulp">
Blablablah...
</Card> */}
</CardGrid>
55 changes: 55 additions & 0 deletions docs/src/content/docs/es/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
# SPDX-FileCopyrightText: 2024 KindSpells Labs S.L.
#
# SPDX-License-Identifier: MIT

title: Empezando
description: Empieza a proteger tus sitios web Astro con Astro-Shield.
---

## Introducción

Astro-Shield te ayudará a mejorar la seguridad de tu sitio Astro permitiéndote
aplicar muchas de las mejores prácticas de seguridad, tales como:
- [Integridad de Subrecursos](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity)
- [Política de Seguridad de Contenidos](https://developer.mozilla.org/es/docs/Web/HTTP/CSP)

## Cómo instalar

import { Code, Tabs, TabItem } from '@astrojs/starlight/components';

Para instalar, ejecuta el siguiente comando en tu terminal:

<Tabs>
<TabItem label="npm">
```bash
npm install --save-dev @kindspells/astro-Shield
```
</TabItem>
<TabItem label="pnpm">
```bash
pnpm add --save-dev @kindspells/astro-shield
```
</TabItem>
<TabItem label="yarn">
```bash
yarn add --dev @kindspells/astro-shield
```
</TabItem>
</Tabs>

## Activando la integración

En tu archivo `astro.config.mjs`, importa Astro-Shield y agrégalo a la lista
de integraciones:

```js
import { defineConfig } from 'astro/config'
import { shield } from '@kindspells/astro-shield'

export default defineConfig({
integrations: [
shield({})
]
})
```
Loading
Loading