Can i run this mand node.js from package.json ?
"browserify file.js -o bundle.js"
if i can how i can do this and how to execute it without using mand prompt?
Can i run this mand node.js from package.json ?
"browserify file.js -o bundle.js"
if i can how i can do this and how to execute it without using mand prompt?
Share Improve this question asked Dec 16, 2015 at 21:22 ameniameni 3932 gold badges9 silver badges17 bronze badges1 Answer
Reset to default 6npm gives you the ability to run aliased mands that you can store in your package.json file. Two basics are npm test
and npm start
, which respectively test and start your application (if you provide the mands that would do those things).
You can put your aliased mands in a nested object w/in the scripts property. To run mands that aren't either start or test, you have to use npm run <mand alias>
. So, you could do npm run bundle
.
"scripts": {
"test": "some test mand",
"start": "some start mand",
"bundle": "browserify file.js -o bundle.js"
}
Also, to clarify, you can't execute code from/in a JSON file, JSON is just a data interchange format.
Hope that helps!