midudev / la-velada-web-oficial

Web oficial de La Velada IV de Ibai Llanos
https://lavelada.es
Other
1.37k stars 621 forks source link

Fix: Husky commit for github desktop and some idles for windows #857

Closed MattEzekiel closed 4 months ago

MattEzekiel commented 5 months ago

Descripción

Se cambiaron los comandos del pre-commit de husky para que se puedan hacer commits desde github desktop

Problema solucionado

Closes #856

Cambios propuestos

#!/bin/bash

# Verificar el sistema operativo
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
  # Si es Windows, ejecutar npx.cmd lint-staged
  npx.cmd lint-staged
else
  # Si no es Windows, intentar ejecutar npx lint-staged
  if command -v npx &> /dev/null; then
    npx lint-staged
  else
    echo "El comando 'npx' no está disponible. Por favor, instale 'npx' para continuar."
    exit 1
  fi
fi

Comprobación de cambios

vercel[bot] commented 5 months ago

@MattEzekiel is attempting to deploy a commit to the midudev pro Team on Vercel.

A member of the Team first needs to authorize it.

AlejandroSuero commented 5 months ago

@MattEzekiel he arreglado el fallo de ubuntu: image

He cambiado [[ condition || condition ]] por [ condition ] || [ condition ]:

#!/bin/bash

# Verificar el sistema operativo
if [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "win32" ]; then
  # Si es Windows, ejecutar npx.cmd lint-staged
  npx.cmd lint-staged
else
  # Si no es Windows, intentar ejecutar npx lint-staged
    if command -v npx 2> /dev/null; then
    npx lint-staged
  else
    echo "El comando 'npx' no está disponible. Por favor, instale 'npx' para continuar."
    exit 1
  fi
fi

Creo que es porque husky o git usan sh en vez de bash para ejecutar los scripts y sh no reconoce [[ como válido.

Prueba a ver si esto te funciona y así se quitan todos los errores.

MattEzekiel commented 5 months ago

@AlejandroSuero listo, ya lo subí con solo 1 bracket en vez de los 2 como me lo pasaste, desde mi lado sigue funcionando

MattEzekiel commented 5 months ago

@midudev