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

Fix multiple parts of the documentation for consistency #1566

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 10 additions & 10 deletions docs/es/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

::: code-group

```shell [npm]
```sh [npm]
npm install --save-dev husky
```

```shell [pnpm]
```sh [pnpm]
pnpm add --save-dev husky
```

```shell [yarn]
```sh [yarn]
yarn add --dev husky
# Agregue pinst SÓLO si su paquete no es privado
yarn add --dev pinst
```

```shell [bun]
```sh [bun]
bun add --dev husky
```

Expand All @@ -30,20 +30,20 @@ El comando `init` simplifica la configuración de husky en un proyecto. Crea un

::: code-group

```shell [npm]
```sh [npm]
npx husky init
```

```shell [pnpm]
```sh [pnpm]
pnpm exec husky init
```

```shell [yarn]
```sh [yarn]
# Debido a advertencias específicas y diferencias con otros administradores de paquetes,
# consulte la sección Cómo hacerlo.
```

```shell [bun]
```sh [bun]
bunx husky init
```

Expand All @@ -53,7 +53,7 @@ bunx husky init

¡Felicitaciones! Has configurado exitosamente tu primer gancho de Git (Git hook) con solo un comando 🎉. Probémoslo:

```shell
```sh
git commit -m "Keep calm and commit"
# El script de prueba se ejecutará cada vez que realices un commit
```
Expand All @@ -66,7 +66,7 @@ Si bien la mayoría de las veces, solo ejecutarás algunos comandos `npm run` o

Por ejemplo, aquí se muestra cómo puedes analizar (lint) tus archivos preparados (staged files) en cada confirmación (commit) con solo dos líneas de código de shell y sin dependencia externa:

```shell
```sh
# .husky/pre-commit
prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
git update-index --again
Expand Down
36 changes: 18 additions & 18 deletions docs/es/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Agregar un gancho (hook) es tan simple como crear un archivo. Esto se puede lograr usando su editor favorito, un script o un comando echo básico. Por ejemplo, en Linux/macOS:

```shell
```sh
echo "npm test" > .husky/pre-commit
```

Expand All @@ -30,7 +30,7 @@ git commit -m "..." -n # Skips Git hooks

Para los comandos sin esta bandera, deshabilite los ganchos (hooks) temporalmente con HUSKY=0:

```shell
```sh
HUSKY=0 git ... # Desactiva temporalmente todos los ganchos de Git (Git hooks)
git ... # Los ganchos (Hooks) se ejecutarán nuevamente
```
Expand All @@ -39,7 +39,7 @@ git ... # Los ganchos (Hooks) se ejecutarán nuevamente

Para deshabilitar los ganchos (hooks) durante un período prolongado (por ejemplo, durante la rebase/fusión (rebase/merge)):

```shell
```sh
export HUSKY=0 # Deshabilita todos los ganchos (hooks) de Git
git ...
git ...
Expand Down Expand Up @@ -99,7 +99,7 @@ Luego, úsalo en `prepare`:

Para probar/testear un gancho (hook), agregue `exit 1` al script del gancho (hook) para cancelar el comando Git:

```shell
```sh
# .husky/pre-commit

# Your WIP script
Expand All @@ -108,7 +108,7 @@ Para probar/testear un gancho (hook), agregue `exit 1` al script del gancho (hoo
exit 1
```

```shell
```sh
git commit -m "testing pre-commit code"
# No se creará una confirmación (commit)
```
Expand All @@ -134,7 +134,7 @@ Configure su script de preparación de la siguiente manera:

En el script de gancho (hook script), cambie el directorio nuevamente al subdirectorio correspondiente:

```shell
```sh
# frontend/.husky/pre-commit
cd frontend
npm test
Expand All @@ -148,13 +148,13 @@ Para ejecutar scripts que requieren el uso de un lenguaje de script, use el sigu

1. Cree un punto de entrada para el gancho (hook):

```shell
```sh
.husky/pre-commit
```

2. En el archivo agregue lo siguiente

```shell
```sh
node .husky/pre-commit.js
```

Expand All @@ -171,7 +171,7 @@ Los scripts de gancho (hook) deben ser compatibles con POSIX para garantizar la

Dicho esto, si su equipo no usa Windows, puede usar Bash de esta manera:

```shell
```sh
# .husky/pre-commit

bash << EOF
Expand All @@ -197,22 +197,22 @@ Los administradores de versiones funcionan de la siguiente manera:

Por ejemplo, si tiene dos versiones de Node:

```shell
```sh
~/version-manager/Node-X/node
~/version-manager/Node-Y/node
```

Al abrir una terminal se inicializa el administrador de versiones, que selecciona una versión (por ejemplo, `Node-Y`) y antepone su ruta a `PATH`:

```shell
```sh
echo $PATH
# Salida
~/version-manager/Node-Y/:...
```

Ahora, el node hace referencia a `Nodo-Y`. Al cambiar a `Nodo-X`, `PATH` cambia en concordancia:

```shell
```sh
echo $PATH
# Salida
~/version-manager/Node-X/:...
Expand All @@ -226,15 +226,15 @@ Husky obtiene `~/.config/husky/init.sh` antes de cada gancho de Git (Git hooks).

Ejemplo con `nvm`:

```shell
```sh
# ~/.config/husky/init.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
```

Como alternativa, si su archivo de inicio de shell es rápido y liviano, consígalo directamente:

```shell
```sh
# ~/.config/husky/init.sh
. ~/.zshrc
```
Expand Down Expand Up @@ -312,24 +312,24 @@ Cree un archivo `pre-commit` en el directorio `.husky/`:

::: code-group

```shell [npm]
```sh [npm]
# .husky/pre-commit
npm test
```

```shell [pnpm]
```sh [pnpm]
# .husky/pre-commit
pnpm test
```

```shell [yarn]
```sh [yarn]
# .husky/pre-commit
yarn test
```

```sh [bun]
# .husky/pre-commit
bun test
bun run test
```

:::
6 changes: 3 additions & 3 deletions docs/es/migrate-from-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Husky v4

Husky v9

```shell
```sh
# .husky/pre-commit
# Tenga en cuenta que ahora puede tener comandos en varias líneas.
npm test // [!code hl]
Expand All @@ -34,7 +34,7 @@ Si estaba llamando a binarios instalados localmente, **ahora necesita ejecutarlo
}
```

```shell [.husky/pre-commit (v9)]
```sh [.husky/pre-commit (v9)]
jest
```

Expand All @@ -52,7 +52,7 @@ La variable de entorno `HUSKY_GIT_PARAMS` ahora se reemplaza por los parámetros
}
```

```shell [.husky/commit-msg (v9)]
```sh [.husky/commit-msg (v9)]
commitlint --edit $1
```

Expand Down
4 changes: 2 additions & 2 deletions docs/es/troubleshoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Los ganchos de Git (Git hooks) pueden fallar con Yarn en Windows usando Git Bash

1. Cree `.husky/common.sh`:

```shell
```sh
command_exists () {
command -v "$1" >/dev/null 2>&1
}
Expand All @@ -33,7 +33,7 @@ fi

2. Obtenga la fuente donde se ejecutan los comandos Yarn:

```shell
```sh
# .husky/pre-commit
. .husky/common.sh

Expand Down
21 changes: 10 additions & 11 deletions docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@

::: code-group

```shell [npm]
```sh [npm]
npm install --save-dev husky
```

```shell [pnpm]
```sh [pnpm]
pnpm add --save-dev husky
```

```shell [yarn]
```sh [yarn]
yarn add --dev husky
# Add pinst ONLY if your package is not private
yarn add --dev pinst
```

```shell [bun]
```sh [bun]
bun add --dev husky
```

Expand All @@ -30,31 +30,30 @@ The `init` command simplifies setting up husky in a project. It creates a `pre-c

::: code-group

```shell [npm]
```sh [npm]
npx husky init
```

```shell [pnpm]
```sh [pnpm]
pnpm exec husky init
```

```shell [yarn]
```sh [yarn]
# Due to specific caveats and differences with other package managers,
# refer to the How To section.
```

```shell [bun]
```sh [bun]
bunx husky init
```

:::


## Try it

Congratulations! You've successfully set up your first Git hook with just one command 🎉. Let's test it:

```shell
```sh
git commit -m "Keep calm and commit"
# test script will run every time you commit
```
Expand All @@ -67,7 +66,7 @@ While most of the time, you'll just run a few `npm run` or `npx` commands in you

For example, here's how you can lint your staged files on each commit with only two lines of shell code and no external dependency:

```shell
```sh
# .husky/pre-commit
prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown
git update-index --again
Expand Down
Loading