NPM-RUN-SCRIPT(3)

πŸ“¦ version 1.2.1, in nixos 26.05, nixpkgs unstable

πŸ’… NAME πŸ’…

npm-run-script β€” run arbitrary package scripts, bestie. that's it. that's the vibe. πŸŽ€

so like, this whole page lives in the npm-run-script(3) manual, and honestly? it's short, it's sweet, it slays. let's get into it. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

npm.commands.run-script(args, callback)

that's the whole signature. no cap. two things go in: args and callback. πŸ’–


🌸 DESCRIPTION 🌸

okay so here's the tea: this thing runs an arbitrary command straight out of a package's "scripts" object. iconic behavior. πŸ”₯

it's the engine behind the test, start, restart, and stop commands β€” like, that's literally what those commands use under the hood β€” but you can also call it directly if you're feeling main character energy. πŸ‘‘

now, the args parameter? it's an array of strings, and the way it behaves depends entirely on how many elements are in there. vibe check time:

  • if there's only one element β€” npm assumes that element represents a command to be run on the local repository. one string, one job. easy. 🫢
  • if there's more than one element β€” then the first one is assumed to be the package, and the second one is assumed to be the command to run. first = package, second = command. got it? πŸ’…
  • all other elements β€” ignored. not invited to the party. πŸ™ˆ they're just... there. ignored. periodt. πŸ’€
lowkey important: those extra elements don't error out or anything β€” they're just straight up ignored. don't come for me, that's what the page says. 🌈

⭐ SEE ALSO ⭐

  • npm help 7 scripts πŸ“
  • npm apihelp test 🧚
  • npm apihelp start πŸ’œ
  • npm apihelp restart 🌸
  • npm apihelp stop πŸŽ€

aaaand that's the whole page, bestie. not me being obsessed with how short this one is 😭 go run some scripts, you've got this. 🫢

sign-off: this was NPM-RUN-SCRIPT(3), dated March 2017 β€” yes, a vintage. she's an elder but she still ate. πŸ’–βœ¨

πŸ“¦ where this page comes from