NPM is package manager for JavaScript, NPM Manager helps us to find, store JavaScript packages. There are lots of open community building modules which helps to build application quickly. Any components build to be used by NPM requires a package.json, which helps us to define
- Name - Name of the package
- Version
- Dependencies - Packages which are required to consumed by the application
- devDependecies - Packages required for development
- OptionalDependecies - Packages required for development, these are marked as optional when we execute npm install. If the package is not available npm install will fail.
- Scripts - To execute the command on package lifecycle
Sample Package.json for React Application
{
"version": "1.0.0",
"name": "testapp",
"author": {
"email": "hariram.p@gmail.com",
"name": "Hariram P"
} ,
"private": true,
"license": "MIT",
"devDependencies": {
"babel-loader": "6.2.4",
"babel-core": "6.18.2",
"babel": "6.5.2",
"babel-preset-es2015": "6.9.0",
"babel-preset-react": "6.11.1",
"react": "15.2.1",
"react-dom": "15.2.1",
"webpack": "1.13.1"
},
"dependencies": {
},
"scripts": {
"build": "webpack --config webpack.config.js --display-error-details"
}
}
No comments:
Post a Comment