00:00 If you have a package.json file in your project or you create one using npm init...I'll just accept all the defaults, which will create that file...you'll see that when you open it, you have a little block called "scripts."
00:12 Anything in that script block can be run from npm run test, which matches up with this name here. When I hit "Enter," you'll see it throws this error, which is expected because it throws an error.
00:24 If instead I change test to demo...I'll go ahead and change all of this to "echo This is working," hop back into the terminal, and say "npm run demo" this time...you'll see it executes "echo This is working," which outputs "This is working."
00:42 You can also use this to execute any arbitrary script, such as this test script I have. If I create a new script here...I'll say "test" and then link that up to my script. I can then hop down into the terminal, say "npm run test." You can see it prompts me for my name. I'll say my name is "John." It'll say "Name Entered is John" because that's what this is expecting.
01:08 The really cool thing is that you'll see if I try and use browserify here and try and get the version number, it says that's an unknown command. If I install browserify locally, create a new script...We'll call this one "version."
01:23 I'll just execute browserify -v, hop into my terminal, say "npm run version." You can see I can get the version number, 6.3.2, but if I were to try and run that from browserify -v, you can see that it doesn't know what that is.
01:43 I'll run it from version. You can see it gets that task, which means that I can use npm run to invoke anything I've installed locally without forcing my users to say "npm install -g" to install things globally.
01:57 Which means with this approach, you could just include a package file in your project, say "npm install" to get everything installed locally, and then npm run whatever task you want to set up, whether it's browserify or whatever. Then it can just grab those locally installed modules and run them.