Skip to content

Commit c3afd5f

Browse files
authored
docs: support Spanish documentation (#1499)
1 parent c5f4f48 commit c3afd5f

File tree

6 files changed

+693
-54
lines changed

6 files changed

+693
-54
lines changed

docs/.vitepress/config.mts

+92-54
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,134 @@
1-
import { defineConfig } from 'vitepress'
1+
import { defineConfig } from "vitepress";
22

33
// https://vitepress.dev/reference/site-config
44
export default defineConfig({
55
title: "Husky",
66
description: "Git hooks made easy",
77
head: [
8-
['link', { rel: 'icon', href: 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="85">🐶</text></svg>' }],
8+
[
9+
"link",
10+
{
11+
rel: "icon",
12+
href: 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="85">🐶</text></svg>',
13+
},
14+
],
915
],
10-
base: '/husky/',
16+
base: "/husky/",
1117
themeConfig: {
1218
// outline: [2, 3],
1319
socialLinks: [
14-
{ icon: 'github', link: 'https://github.com/typicode/husky' },
15-
{ icon: 'twitter', link: 'https://x.com/typicode' }
20+
{ icon: "github", link: "https://github.com/typicode/husky" },
21+
{ icon: "twitter", link: "https://x.com/typicode" },
1622
],
1723
// carbonAds: {
1824
// code: 'CWYDP53L',
1925
// placement: 'typicodegithubio',
2026
// },
2127
sidebar: [
22-
{ text: 'Introduction', link: '/' },
23-
{ text: 'Get Started', link: '/get-started' },
24-
{ text: 'How To', link: '/how-to' },
25-
{ text: 'Troubleshoot', link: '/troubleshoot' },
26-
{ text: 'Migrate from v4', link: '/migrate-from-v4' },
27-
],
28-
nav: [
29-
{ text: 'Sponsor', link: 'https://github.com/sponsors/typicode' }
30-
]
28+
{ text: "Introduction", link: "/" },
29+
{ text: "Get Started", link: "/get-started" },
30+
{ text: "How To", link: "/how-to" },
31+
{ text: "Troubleshoot", link: "/troubleshoot" },
32+
{ text: "Migrate from v4", link: "/migrate-from-v4" },
33+
],
34+
nav: [{ text: "Sponsor", link: "https://github.com/sponsors/typicode" }],
3135
},
3236
locales: {
3337
root: {
34-
label: 'English',
35-
lang: 'en-US'
38+
label: "English",
39+
lang: "en-US",
3640
},
3741
zh: {
38-
label: '简体中文',
39-
lang: 'zh-hans',
40-
description: '使 Git hooks 变得简单',
41-
link: '/zh/',
42+
label: "简体中文",
43+
lang: "zh-hans",
44+
description: "使 Git hooks 变得简单",
45+
link: "/zh/",
4246
themeConfig: {
4347
sidebar: [
44-
{ text: '简介', link: '/zh/' },
45-
{ text: '快速开始', link: '/zh/get-started' },
46-
{ text: '如何使用', link: '/zh/how-to' },
47-
{ text: '故障排查', link: '/zh/troubleshoot' },
48-
{ text: '从 v4 迁移', link: '/zh/migrate-from-v4' },
48+
{ text: "简介", link: "/zh/" },
49+
{ text: "快速开始", link: "/zh/get-started" },
50+
{ text: "如何使用", link: "/zh/how-to" },
51+
{ text: "故障排查", link: "/zh/troubleshoot" },
52+
{ text: "从 v4 迁移", link: "/zh/migrate-from-v4" },
4953
],
5054
docFooter: {
51-
prev: '上一页',
52-
next: '下一页'
55+
prev: "上一页",
56+
next: "下一页",
5357
},
5458
outline: {
55-
label: '页面导航'
59+
label: "页面导航",
5660
},
5761
nav: [
5862
{
59-
text: 'v9.0.1',
63+
text: "v9.0.1",
6064
items: [
6165
{
62-
text: '更新日志',
63-
link: 'https://github.com/typicode/husky/releases/tag/v9.0.1'
64-
}
65-
]
66-
}
67-
]
68-
}
66+
text: "更新日志",
67+
link: "https://github.com/typicode/husky/releases/tag/v9.0.1",
68+
},
69+
],
70+
},
71+
],
72+
},
6973
},
7074
ru: {
71-
label: 'Русский',
72-
lang: 'ru-RU',
73-
description: 'Git hooks made easy',
74-
link: '/ru/',
75+
label: "Русский",
76+
lang: "ru-RU",
77+
description: "Git hooks made easy",
78+
link: "/ru/",
7579
themeConfig: {
7680
sidebar: [
77-
{ text: 'Введение', link: '/ru/' },
78-
{ text: 'Начало работы', link: '/ru/get-started' },
79-
{ text: 'Как использовать', link: '/ru/how-to' },
80-
{ text: 'Устранение неполадок', link: '/ru/troubleshoot' },
81-
{ text: 'Миграция с v4', link: '/ru/migrate-from-v4' },
81+
{ text: "Введение", link: "/ru/" },
82+
{ text: "Начало работы", link: "/ru/get-started" },
83+
{ text: "Как использовать", link: "/ru/how-to" },
84+
{ text: "Устранение неполадок", link: "/ru/troubleshoot" },
85+
{ text: "Миграция с v4", link: "/ru/migrate-from-v4" },
8286
],
8387
docFooter: {
84-
prev: 'Предыдущая страница',
85-
next: 'Следующая страница'
88+
prev: "Предыдущая страница",
89+
next: "Следующая страница",
8690
},
8791
outline: {
88-
label: 'Содержание страницы'
92+
label: "Содержание страницы",
8993
},
9094
nav: [
91-
{ text: 'Sponsor', link: 'https://github.com/sponsors/typicode' }
92-
]
93-
}
94-
}
95-
}
96-
})
95+
{ text: "Sponsor", link: "https://github.com/sponsors/typicode" },
96+
],
97+
},
98+
},
99+
sp: {
100+
label: "Español",
101+
lang: "es-EC",
102+
description: "Git hooks se vuelven fáciles",
103+
link: "/es/",
104+
themeConfig: {
105+
sidebar: [
106+
{ text: "Introducción", link: "/es/" },
107+
{ text: "Comenzar", link: "/es/get-started" },
108+
{ text: "Cómo hacerlo", link: "/es/how-to" },
109+
{ text: "Solucionar problemas", link: "/es/troubleshoot" },
110+
{ text: "Migrar desde v4", link: "/es/migrate-from-v4" },
111+
],
112+
docFooter: {
113+
prev: "Pagina anterior",
114+
next: "Página siguiente",
115+
},
116+
outline: {
117+
label: "Contenido de la página",
118+
},
119+
nav: [
120+
{ text: "Sponsor", link: "https://github.com/sponsors/typicode" },
121+
{
122+
text: "v9.1.5",
123+
items: [
124+
{
125+
text: "Registro de cambios",
126+
link: "https://github.com/typicode/husky/releases/tag/v9.1.5",
127+
},
128+
],
129+
},
130+
],
131+
},
132+
},
133+
},
134+
});

docs/es/get-started.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Comenzar
2+
3+
## Instalar
4+
5+
::: code-group
6+
7+
```shell [npm]
8+
npm install --save-dev husky
9+
```
10+
11+
```shell [pnpm]
12+
pnpm add --save-dev husky
13+
```
14+
15+
```shell [yarn]
16+
yarn add --dev husky
17+
# Agregue pinst SÓLO si su paquete no es privado
18+
yarn add --dev pinst
19+
```
20+
21+
```shell [bun]
22+
bun add --dev husky
23+
```
24+
25+
:::
26+
27+
## `husky init` (recomendado)
28+
29+
El comando `init` simplifica la configuración de husky en un proyecto. Crea un script `pre-commit` en `.husky/` y actualiza el script `prepare` en `package.json`. Se pueden realizar modificaciones más tarde para que se adapten a su flujo de trabajo.
30+
31+
::: code-group
32+
33+
```shell [npm]
34+
npx husky init
35+
```
36+
37+
```shell [pnpm]
38+
pnpm exec husky init
39+
```
40+
41+
```shell [yarn]
42+
# Debido a advertencias específicas y diferencias con otros administradores de paquetes,
43+
# consulte la sección Cómo hacerlo.
44+
```
45+
46+
```shell [bun]
47+
bunx husky init
48+
```
49+
50+
:::
51+
52+
## Pruébalo
53+
54+
¡Felicitaciones! Has configurado exitosamente tu primer gancho de Git (Git hook) con solo un comando 🎉. Probémoslo:
55+
56+
```shell
57+
git commit -m "Keep calm and commit"
58+
# El script de prueba se ejecutará cada vez que realices un commit
59+
```
60+
61+
## Algunas palabras...
62+
63+
### Scripting
64+
65+
Si bien la mayoría de las veces, solo ejecutarás algunos comandos `npm run` o `npx` en tus ganchos (hooks), también puedes crear scripts con el shell POSIX para flujos de trabajo personalizados (custom workflows).
66+
67+
Por ejemplo, aquí se muestra cómo puedes analizar (lint) tus archivos preparados (staged files) en cada commit con solo dos líneas de código de shell y sin dependencia externa:
68+
69+
```shell
70+
# .husky/pre-commit
71+
prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
72+
git update-index --again
73+
```
74+
75+
_Este es un ejemplo básico pero funcional, verifique [lint-staged](https://github.com/lint-staged/lint-staged) si necesitas más._
76+
77+
### Deshabilitar ganchos
78+
79+
Husky no fuerza los ganchos de Git (Git hooks). Se pueden deshabilitar globalmente (`HUSKY=0`) o se pueden habilitar si se desea. Consulta la sección [Cómo hacerlo](cómo hacerlo) para obtener más información y realizar una configuración manual.

0 commit comments

Comments
 (0)