#!/bin/bash
# Wrapper pour npm qui corrige le JSON invalide lors de npm list

# Si c'est "npm list --json --production", on nettoie la sortie
if [[ "$*" =~ "list --json --production" ]]; then
  # Capture la sortie et enlève les erreurs npm à la fin
  /snap/bin/npm "$@" 2>&1 | sed '/^npm error/d'
else
  # Sinon, appel npm normal
  /snap/bin/npm "$@"
fi
