Passer au contenu principal
Version : Suivant

Scripts

Comment pnpm gère le champ scripts du package.json.

Hidden Scripts

Added in: v11.0.0

Scripts with names starting with . are hidden. They cannot be run directly via pnpm run and are omitted from the pnpm run listing. Hidden scripts can only be called from other scripts.

{
"scripts": {
".helper": "echo 'I am hidden'",
"build": "pnpm run .helper && tsc"
}
}

In this example, pnpm run .helper would fail, but pnpm run build would succeed because .helper is called from another script.

Scripts du cycle de vie

pnpm:devPreinstall

Fonctionne uniquement sur pnpm install local.

S'exécute avant l'installation de toute dépendance.

Ce script est exécuté uniquement lorsqu'il est défini dans le package.json du projet racine.