From 625dae5ac2015515dd48ccf3c8575260263c3355 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Wed, 28 Jun 2023 20:01:45 +0300 Subject: [PATCH] Dont allow npm to clear terminal --- .zshrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.zshrc b/.zshrc index 48ac0a5..bf45f30 100644 --- a/.zshrc +++ b/.zshrc @@ -259,6 +259,18 @@ function gedit { PATH=$REAL_PATH env -u VIRTUAL_ENV /usr/bin/gedit $@; } +# NodeJS people really love to erase the terminal scrollback buffer +# running npm through cat usually solves it +# https://nodejs.org/api/tty.html#tty +# https://github.com/facebook/create-react-app/issues/2495 +function npm { + ( + export COLOR=1 + export REACT_APP_NO_CLEAR_CONSOLE=1 + /usr/bin/npm $@ | cat + ) +} + # i don't like that systemd by default uses a pager export SYSTEMD_PAGER=''