| Start | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Scripts You can define scripts that can be executed or are triggered before or after another script. In this case, you can execute the script by running either of these commands: Pre-defined scripts
User-defined scriptsYou can also define your own scripts the same way you do with the pre-defined scripts: In this case, you can execute the script by running either of these commands: User-defined scripts also supports pre and post scripts, as shown in the example above. |
||||||||||||||||||||||||||
| Exploring package.json A To initialize a To create a To install a package and save it to You can also use the shorthand notation: NPM aliases The package will appear in your dependencies; if you use
Important properties of Information about some important properties: The unique name of your package and should be down in lowercase. This property is required and your package will not install without it.
The version of the package is specified by Semantic Versioning (opens new window) (semver). Which assumes that a version number is written as MAJOR.MINOR.PATCH and you increment the:
The description of the project. Try to keep it short and concise. The author of this package. An object which is used to expose binary scripts from your package. The object assumes that the key is the name of the binary script and the value a relative path to the script. This property is used by packages that contain a CLI (command line interface). A object which exposes additional npm commands. The object assumes that the key is the npm command and the value is the script path. These scripts can get executed when you run Packages that contain a command line interface and are installed locally can be called without a relative path. So instead of calling The main entry point to your package. When calling It's highly advised that requiring the main file does not generate any side affects. For instance, requiring the main file should not start up a HTTP server or connect to a database. Instead, you should create something like An array of keywords which describe your package. These will help people find your package. These are the dependencies that are only intended for development and testing of your module. The dependencies will be installed automatically unless the If you are using this module, then peerDependencies lists the modules you must install alongside this one. For example, A property that indicates that this page prefers to be installed globally using In all other situations you should NOT use this property. The publishConfig is an object with configuration values that will be used for publishing modules. The configuration values that are set override your default npm configuration. The most common use of the This is an array of all the files to include in the published package. Either a file path or folder path can be used. All the contents of a folder path will be included. This reduces the total size of your package by only including the correct files to be distributed. This field works in conjunction with a |
||||||||||||||||||||||||||
Basic project definition
|
||||||||||||||||||||||||||
| Dependencies "dependencies": { "module-name": "0.1.0" }
After adding them to your package.json, use the command devDependenciesFor dependencies required only for development, like testing styling proxies ext. Those dev-dependencies won't be installed when running "npm install" in production mode. |
||||||||||||||||||||||||||
| Extended project definition Some of the additional attributes are parsed by the npm website like
RemarksYou can create which will ask you about basic facts about your projects, including license identifier (opens new window). |
Read Article
https://develop.horje.com/learn/1434/reference