I cant get my head around how scripts are running within package.json
& would appreciate some insight for us newbies.
Is it the case that they are bash
scripts that are run by node having loaded the various dependencies
?
If yes, then how does it process the javascript code?
yes
no, they are run by
sh
.no, no js files are loaded, the only thing
npm
does for you is to prepare the environment. Among other things, it adds./node_modules/.bin
toPATH
so you can invoke installed modules immediately.When you run
npm run-script whatever
, this is whatnpm
does:package.json
sh
(orcomspec
on win) and gives it the command and the env. No big magic here.