# package.json **Repository Path**: necessityovo/package.json ## Basic Information - **Project Name**: package.json - **Description**: ๐Ÿ—ƒ๏ธ package.json fields explained - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-07-01 - **Last Updated**: 2021-07-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Package.json [![Twitter Follow](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Follow)](https://twitter.com/stereobooster) **caution** do not use `package.json` for the folder name if you want to clone this project to your machine - it will break `yarn` (`An unexpected error occurred: "EISDIR: illegal operation on a directory, read".`). Original version of this document copied from [yarnpkg](https://yarnpkg.com/lang/en/docs/package-json/). See also [npm documentation](https://docs.npmjs.com/files/package.json), [std-pkg](https://github.com/jamiebuilds/std-pkg), [clean-publish](https://github.com/shashkovdanil/clean-publish), [package-json-validator](http://package-json-validator.com/), [cosmiconfig](https://github.com/davidtheclark/cosmiconfig), [rc](https://github.com/dominictarr/rc) (as an opponent approach to cosmiconfig). - [Essentials](#essentials) * [`name`](#name) * [`version`](#version) - [Info](#info) * [`description`](#description) * [`keywords`](#keywords) * [`license`](#license) - [Links](#links) * [`homepage`](#homepage) * [`bugs`](#bugs) * [`repository`](#repository) - [Maintainers](#maintainers) * [`author`](#author) * [`contributors`](#contributors) - [Files](#files) * [`files`](#files) * [`main`](#main) * [`bin`](#bin) * [`man`](#man) * [`directories`](#directories) - [Tasks](#tasks) * [`scripts`](#scripts) * [npm specific `scripts`](#npm-specific-scripts) * [`config`](#config) - [Dependencies](#dependencies) * [`dependencies`](#dependencies) * [`devDependencies`](#devdependencies) * [`peerDependencies`](#peerdependencies) * [`optionalDependencies`](#optionaldependencies) * [`bundledDependencies`](#bundleddependencies) - [System](#system) * [`engines`](#engines) * [`os`](#os) * [`cpu`](#cpu) - [Publishing](#publishing) * [`private`](#private) * [`publishConfig`](#publishconfig) - [Yarn](#yarn) * [`flat`](#flat) * [`resolutions`](#resolutions) - [Lerna + Yarn](#lerna--yarn) * [`workspaces`](#workspaces) - [Bolt](#bolt) * [`bolt`](#bolt) - [unpkg](#unpkg) * [`unpkg`](#unpkg) - [TypeScript](#typescript) * [`types`](#types) - [Flow](#flow) * [`flow:main`](#flowmain) - [browserslist](#browserslist) * [`browserslist`](#browserslist) - [Package bundlers](#package-bundlers) * [`module`](#module) * [`browser`](#browser) * [`esnext`](#esnext) * [`es2015`](#es2015) * [`esm`](#esm) * [`module-browser`](#module-browser) * [`modules.root`](#modulesroot) * [`jsnext:main`](#jsnextmain) - [metro](#metro) * [`react-native`](#react-native) - [webpack](#webpack) * [`sideEffects`](#sideeffects) - [microbundle](#microbundle) * [`source`, `umd:main`](#source-umdmain) - [Parcel](#parcel) * [`source`](#source) - [@std/esm](#stdesm) * [`@std/esm`](#stdesm) - [jspm](#jspm) * [`jspm`](#jspm) * [`ignore`](#ignore) * [`format`](#format) * [`registry`](#registry) * [`shim`](#shim) * [`map`](#map) - [browserify](#browserify) * [`browserify.transform`](#browserifytransform) - [Create React App](#create-react-app) * [`proxy`](#proxy) * [`homepage`](#homepage-1) - [babel](#babel) * [`babel`](#babel) - [eslint](#eslint) * [`eslintConfig`](#eslintconfig) - [jest](#jest) * [`jest`](#jest) - [stylelint](#stylelint) * [`stylelint`](#stylelint) - [size-limit](#size-limit) * [`size-limit`](#size-limit) - [PWMetrics](#pwmetrics) * [`pwmetrics`](#pwmetrics) - [AVA](#ava) * [`ava`](#ava) - [nyc](#nyc) * [`nyc`](#nyc) - [Other](#other) * [`preferGlobal`](#preferglobal) * [`style`](#style) * [`less`](#less) - [CommonJS Packages](#commonjs-packages) * [Reserved Properties](#reserved-properties) - [Standard JS](#standard-js) * [`standard`](#standard) ## Essentials The two most important fields in your `package.json` are `name` and `version`, without them your package won't be able to install. The `name` and `version` fields are used together to create a unique id. ### `name` ```json { "name": "my-awesome-package" } ``` This is the name of your package. It gets used in URLs, as an argument on the command line, and as the directory name inside `node_modules`. ```sh yarn add [name] ``` ``` node_modules/[name] ``` ``` https://registry.npmjs.org/[name]/-/[name]-[version].tgz ``` **Rules** - Must be less than or equal to 214 characters (including the `@scope/` for scoped packages). - Must not start with a dot (`.`) or an underscore (`_`). - Must not have an uppercase letter in the name. - Must use only URL-safe characters. **Tips** - Don't use the same name as a core Node.js module - Don't put `js` or `node` in the name. - Keep names short and descriptive. You want people to understand what it is from the name, but it will also be used in `require()` calls. - Make sure that there isn't something in the [registry](https://www.npmjs.com/) with the same name. ### `version` ```json { "version": "1.0.0" } ``` The current version of your package. ## Info ### `description` ```json { "description": "My short description of my awesome package" } ``` The description is just a string that helps people understand the purpose of the package. It can be used when searching for packages in a package manager as well. ### `keywords` ```json { "keywords": ["short", "relevant", "keywords", "for", "searching"] } ``` Keywords are an array of strings that are useful when searching for packages in a package manager. ### `license` ```json { "license": "MIT", "license": "(MIT or GPL-3.0)", "license": "SEE LICENSE IN LICENSE_FILENAME.txt", "license": "UNLICENSED" } ``` All packages should specify a license so that users know how they are permitted to use it and any restrictions that you are placing on it. You are encouraged to use an Open Source ([OSI-approved](https://opensource.org/licenses/alphabetical)) license unless you have a specific reason not to. If you built your package as part of your job it's likely best to check with your company before deciding on a license. **Must be one of the following:** - A valid [SPDX license identifier](https://spdx.org/licenses/) if you are using a standard license. - A valid [SPDX license expression syntax 2.0 expression](https://www.npmjs.com/package/spdx) if you are using multiple standard licenses. - A `SEE LICENSE IN ` string that points to a `` in the top level of your package if you are using a non-standard license. - A `UNLICENSED` string if you do not want to grant others the right to use a private or unpublished package under any terms. ## Links Various links to documentation, places to file issues and where your package code actually lives. ### `homepage` ```json { "homepage": "https://your-package.org" } ``` The homepage is the URL to the landing page or documentation for your package. Also used by [Create React App](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#building-for-relative-paths) ### `bugs` ```json { "bugs": "https://github.com/user/repo/issues" } ``` The URL to your project's issue tracker. This can also be something like an email address as well. It provides users a way to find out where to send issues with your package. ### `repository` ```json { "repository": { "type": "git", "url": "https://github.com/user/repo.git" }, "repository": "github:user/repo", "repository": "gitlab:user/repo", "repository": "bitbucket:user/repo", "repository": "gist:a1b2c3d4e5f" } ``` The repository is the location where the actual code for your package lives. ## Maintainers The maintainers of your project. ### `author` ```json { "author": { "name": "Your Name", "email": "you@example.com", "url": "http://your-website.com" }, "author": "Your Name (http://your-website.com)" } ``` Package author information. An author is one person. ### `contributors` ```json { "contributors": [ { "name": "Your Friend", "email": "friend@example.com", "url": "http://friends-website.com" } { "name": "Other Friend", "email": "other@example.com", "url": "http://other-website.com" } ], "contributors": [ "Your Friend (http://friends-website.com)", "Other Friend (http://other-website.com)" ] } ``` Those that have contributed to your package. Contributors are an array of people. ## Files You can specify files that will be included in your project, along with the main entry point for your project. ### `files` ```json { "files": [ "filename.js", "directory/", "glob/*.{js,json}" ] } ``` These are files that are included in your project. You can specify single files, whole directories or use wildcards to include files that meet a certain criteria. ### `main` ```json { "main": "filename.js" } ``` This is the primary entry point for the functionality for your project. ### `bin` ```json { "bin": "bin.js", "bin": { "command-name": "bin/command-name.js", "other-command": "bin/other-command" } } ``` Executable files included with your project that will be installed. ### `man` ```json { "man": "./man/doc.1", "man": ["./man/doc.1", "./man/doc.2"] } ``` If you have man pages associated with your project, add them here. ### `directories` ```json { "directories": { "lib": "path/to/lib/", "bin": "path/to/bin/", "man": "path/to/man/", "doc": "path/to/doc/", "example": "path/to/example/" } } ``` When installing your package, you can specify exact locations to put binary files, man pages, documentation, examples, etc. ## Tasks Your package can include runnable scripts or other configuration. ### `scripts` ```json { "scripts": { "build-project": "node build-project.js" } } ``` Scripts are a great way of automating tasks related to your package, such as simple build processes or development tools. Using the `"scripts"` field, you can define various scripts to be run as `yarn run