scripts

New in version 6.0.

Optional | Type: Object

Execute custom scripts during the special Package Management CLI life cycle events:

Event

Description

postinstall

runs a script AFTER the package has been installed

preuninstall

runs a script BEFORE the package is removed.

Examples

  1. Run a custom Python script located in the package “scripts” folder AFTER the package is installed. Please note that you don’t need to specify a Python interpreter for Python scripts.

    "scripts": {
        "postinstall": "scripts/after_install.py"
    }
    
  2. Run a custom Bash script BEFORE the package is uninstalled. The script is declared as a list of command arguments and is located at the root of a package:

    "scripts": {
        "preuninstall": ["maintainance.sh", "--action", "uninstall"]
    }