pnpm run
Aliases: run-script
패키지의 매니페스트 파일에 정의된 스크립트를 실행합니다.
예시
Let's say you have a watch
script configured in your package.json
, like so:
"scripts": {
"watch": "webpack --watch"
}
You can now run that script by using pnpm run watch
! 간단하지요?
Another thing to note for those that like to save keystrokes and time is that
all scripts get aliased in as pnpm commands, so ultimately pnpm watch
is just
shorthand for pnpm run watch
(ONLY for scripts that do not share the same name
as already existing pnpm commands).
Running multiple scripts
스크립트의 이름 대신 정규식을 사용하여 동시에 여러 스크립트를 실행할 수 있습니다.
pnpm run "/<regex>/"
Run all scripts that start with watch:
:
pnpm run "/^watch:.*/"
Details
In addition to the shell’s pre-existing PATH
, pnpm run
includes
node_modules/.bin
in the PATH
provided to scripts
. 즉, 패키지가 설치되어 있는 한 일반 명령어처럼 스크립트에서 사용할 수 있습니다. For example, if you have eslint
installed, you can write up a script
like so:
"lint": "eslint src --fix"