Interface PackageJson

Hierarchy

  • PackageJson

Properties

author: string | Person
bin?: Record<string, string>

A lot of packages have one or more executable files that they'd like to install into the PATH. npm makes this pretty easy (in fact, it uses this feature to install the "npm" executable.)

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bin

browser?: string

If your module is meant to be used client-side the browser field should be used instead of the main field.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#browser

bugs?: Bug

The url to your project's issue tracker and / or the email address to which issues should be reported.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bugs

bundleDependencies?: string[]

This defines an array of package names that will be bundled when publishing the package.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bundledependencies

config?: Record<string, string>

A "config" object can be used to set configuration parameters used in package scripts that persist across upgrades. It could have a start command that referenced the npm_package_config_port environment variable.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#config

contributors?: Person[]
cpu?: string[]

If your code only runs on certain cpu architectures, you can specify which ones.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#engines

dependencies?: Record<string, string>

Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#dependencies

description: string

Put a description in it. This helps people discover your package, as it's listed in npm search.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#description-1

devDependencies?: Record<string, string>

If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#devdependencies

directories?: Directories

The CommonJS Packages spec details a few ways that you can indicate the structure of your package using a directories object.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#directories

engines?: Record<string, string>

You can specify the version of node that your stuff works on. And, like with dependencies, if you don't specify the version (or if you specify "*" as the version), then any version of node will do. You can also use the "engines" field to specify which versions of npm are capable of properly installing your program.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#engines

files?: string[]

The optional files field is an array of file patterns that describes the entries to be included when your package is installed as a dependency.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#files

funding?: string | Funding | Funding[]

Up-to-date information about ways to help fund development of your package.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#funding

homepage?: string
keywords?: string[]

Put keywords in it. This helps people discover your package as it's listed in npm search.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#keywords

license: string

You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you're placing on it.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#license

main?: string

The main field is a module ID that is the primary entry point to your program.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#main

man?: string | string[]

Specify either a single file or an array of filenames to put in place for the man program to find.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#man

name: string
optionalDependencies?: Record<string, string>

If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the optionalDependencies object.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#optionaldependencies

os?: string[]

You can specify which operating systems your module will run on.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#os

overrides?: Record<string, string>

If you need to make specific changes to dependencies of your dependencies, for example replacing the version of a dependency with a known security issue, replacing an existing dependency with a fork, or making sure that the same version of a package is used everywhere, then you may add an override.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides

peerDependencies?: Record<string, string>

In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a require of this host. This is usually referred to as a plugin.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependencies

peerDependenciesMeta?: Record<string, PeerDependencyMeta>

When a user installs your package, npm will emit warnings if packages specified in peerDependencies are not already installed.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependenciesmeta

private?: boolean

If you set "private": true in your package.json, then npm will refuse to publish it.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private

publishConfig?: string[]

This is a set of config values that will be used at publish-time.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#publishconfig

repository?: string | Repository

Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the npm docs command will be able to find you.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#repository

scripts?: Record<string, string>

Script commands that are run at various times in the lifecycle of your package. The key is the lifecycle event, and the value is the command to run at that point.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#scripts

version: string
workspaces?: string[]

The optional workspaces field is an array of file patterns that describes locations within the local file system that the install client should look up to find each workspace that needs to be symlinked to the top level node_modules folder.

See

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#workspaces

Generated using TypeDoc