-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: support Spanish documentation (#1499)
- Loading branch information
Showing
6 changed files
with
693 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,134 @@ | ||
import { defineConfig } from 'vitepress' | ||
import { defineConfig } from "vitepress"; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
title: "Husky", | ||
description: "Git hooks made easy", | ||
head: [ | ||
['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>' }], | ||
[ | ||
"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>', | ||
}, | ||
], | ||
], | ||
base: '/husky/', | ||
base: "/husky/", | ||
themeConfig: { | ||
// outline: [2, 3], | ||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/typicode/husky' }, | ||
{ icon: 'twitter', link: 'https://x.com/typicode' } | ||
{ icon: "github", link: "https://github.com/typicode/husky" }, | ||
{ icon: "twitter", link: "https://x.com/typicode" }, | ||
], | ||
// carbonAds: { | ||
// code: 'CWYDP53L', | ||
// placement: 'typicodegithubio', | ||
// }, | ||
sidebar: [ | ||
{ text: 'Introduction', link: '/' }, | ||
{ text: 'Get Started', link: '/get-started' }, | ||
{ text: 'How To', link: '/how-to' }, | ||
{ text: 'Troubleshoot', link: '/troubleshoot' }, | ||
{ text: 'Migrate from v4', link: '/migrate-from-v4' }, | ||
], | ||
nav: [ | ||
{ text: 'Sponsor', link: 'https://github.com/sponsors/typicode' } | ||
] | ||
{ text: "Introduction", link: "/" }, | ||
{ text: "Get Started", link: "/get-started" }, | ||
{ text: "How To", link: "/how-to" }, | ||
{ text: "Troubleshoot", link: "/troubleshoot" }, | ||
{ text: "Migrate from v4", link: "/migrate-from-v4" }, | ||
], | ||
nav: [{ text: "Sponsor", link: "https://github.com/sponsors/typicode" }], | ||
}, | ||
locales: { | ||
root: { | ||
label: 'English', | ||
lang: 'en-US' | ||
label: "English", | ||
lang: "en-US", | ||
}, | ||
zh: { | ||
label: '简体中文', | ||
lang: 'zh-hans', | ||
description: '使 Git hooks 变得简单', | ||
link: '/zh/', | ||
label: "简体中文", | ||
lang: "zh-hans", | ||
description: "使 Git hooks 变得简单", | ||
link: "/zh/", | ||
themeConfig: { | ||
sidebar: [ | ||
{ text: '简介', link: '/zh/' }, | ||
{ text: '快速开始', link: '/zh/get-started' }, | ||
{ text: '如何使用', link: '/zh/how-to' }, | ||
{ text: '故障排查', link: '/zh/troubleshoot' }, | ||
{ text: '从 v4 迁移', link: '/zh/migrate-from-v4' }, | ||
{ text: "简介", link: "/zh/" }, | ||
{ text: "快速开始", link: "/zh/get-started" }, | ||
{ text: "如何使用", link: "/zh/how-to" }, | ||
{ text: "故障排查", link: "/zh/troubleshoot" }, | ||
{ text: "从 v4 迁移", link: "/zh/migrate-from-v4" }, | ||
], | ||
docFooter: { | ||
prev: '上一页', | ||
next: '下一页' | ||
prev: "上一页", | ||
next: "下一页", | ||
}, | ||
outline: { | ||
label: '页面导航' | ||
label: "页面导航", | ||
}, | ||
nav: [ | ||
{ | ||
text: 'v9.0.1', | ||
text: "v9.0.1", | ||
items: [ | ||
{ | ||
text: '更新日志', | ||
link: 'https://github.com/typicode/husky/releases/tag/v9.0.1' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
text: "更新日志", | ||
link: "https://github.com/typicode/husky/releases/tag/v9.0.1", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
ru: { | ||
label: 'Русский', | ||
lang: 'ru-RU', | ||
description: 'Git hooks made easy', | ||
link: '/ru/', | ||
label: "Русский", | ||
lang: "ru-RU", | ||
description: "Git hooks made easy", | ||
link: "/ru/", | ||
themeConfig: { | ||
sidebar: [ | ||
{ text: 'Введение', link: '/ru/' }, | ||
{ text: 'Начало работы', link: '/ru/get-started' }, | ||
{ text: 'Как использовать', link: '/ru/how-to' }, | ||
{ text: 'Устранение неполадок', link: '/ru/troubleshoot' }, | ||
{ text: 'Миграция с v4', link: '/ru/migrate-from-v4' }, | ||
{ text: "Введение", link: "/ru/" }, | ||
{ text: "Начало работы", link: "/ru/get-started" }, | ||
{ text: "Как использовать", link: "/ru/how-to" }, | ||
{ text: "Устранение неполадок", link: "/ru/troubleshoot" }, | ||
{ text: "Миграция с v4", link: "/ru/migrate-from-v4" }, | ||
], | ||
docFooter: { | ||
prev: 'Предыдущая страница', | ||
next: 'Следующая страница' | ||
prev: "Предыдущая страница", | ||
next: "Следующая страница", | ||
}, | ||
outline: { | ||
label: 'Содержание страницы' | ||
label: "Содержание страницы", | ||
}, | ||
nav: [ | ||
{ text: 'Sponsor', link: 'https://github.com/sponsors/typicode' } | ||
] | ||
} | ||
} | ||
} | ||
}) | ||
{ text: "Sponsor", link: "https://github.com/sponsors/typicode" }, | ||
], | ||
}, | ||
}, | ||
sp: { | ||
label: "Español", | ||
lang: "es-EC", | ||
description: "Git hooks se vuelven fáciles", | ||
link: "/es/", | ||
themeConfig: { | ||
sidebar: [ | ||
{ text: "Introducción", link: "/es/" }, | ||
{ text: "Comenzar", link: "/es/get-started" }, | ||
{ text: "Cómo hacerlo", link: "/es/how-to" }, | ||
{ text: "Solucionar problemas", link: "/es/troubleshoot" }, | ||
{ text: "Migrar desde v4", link: "/es/migrate-from-v4" }, | ||
], | ||
docFooter: { | ||
prev: "Pagina anterior", | ||
next: "Página siguiente", | ||
}, | ||
outline: { | ||
label: "Contenido de la página", | ||
}, | ||
nav: [ | ||
{ text: "Sponsor", link: "https://github.com/sponsors/typicode" }, | ||
{ | ||
text: "v9.1.5", | ||
items: [ | ||
{ | ||
text: "Registro de cambios", | ||
link: "https://github.com/typicode/husky/releases/tag/v9.1.5", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Comenzar | ||
|
||
## Instalar | ||
|
||
::: code-group | ||
|
||
```shell [npm] | ||
npm install --save-dev husky | ||
``` | ||
|
||
```shell [pnpm] | ||
pnpm add --save-dev husky | ||
``` | ||
|
||
```shell [yarn] | ||
yarn add --dev husky | ||
# Agregue pinst SÓLO si su paquete no es privado | ||
yarn add --dev pinst | ||
``` | ||
|
||
```shell [bun] | ||
bun add --dev husky | ||
``` | ||
|
||
::: | ||
|
||
## `husky init` (recomendado) | ||
|
||
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. | ||
|
||
::: code-group | ||
|
||
```shell [npm] | ||
npx husky init | ||
``` | ||
|
||
```shell [pnpm] | ||
pnpm exec husky init | ||
``` | ||
|
||
```shell [yarn] | ||
# Debido a advertencias específicas y diferencias con otros administradores de paquetes, | ||
# consulte la sección Cómo hacerlo. | ||
``` | ||
|
||
```shell [bun] | ||
bunx husky init | ||
``` | ||
|
||
::: | ||
|
||
## Pruébalo | ||
|
||
¡Felicitaciones! Has configurado exitosamente tu primer gancho de Git (Git hook) con solo un comando 🎉. Probémoslo: | ||
|
||
```shell | ||
git commit -m "Keep calm and commit" | ||
# El script de prueba se ejecutará cada vez que realices un commit | ||
``` | ||
|
||
## Algunas palabras... | ||
|
||
### Scripting | ||
|
||
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). | ||
|
||
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: | ||
|
||
```shell | ||
# .husky/pre-commit | ||
prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown | ||
git update-index --again | ||
``` | ||
|
||
_Este es un ejemplo básico pero funcional, verifique [lint-staged](https://github.com/lint-staged/lint-staged) si necesitas más._ | ||
|
||
### Deshabilitar ganchos | ||
|
||
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. |
Oops, something went wrong.