Type Alias PackageJSON

PackageJSON: {
    author: AuthorProperty;
    bin: string | Dictionary<string>;
    bugs: BugsProperty;
    bundleDependencies: boolean | string[];
    config: Dictionary<string>;
    contributors: AuthorProperty[];
    dependencies: Dictionary<string>;
    description: string;
    devDependencies: Dictionary<string>;
    exports: string | Dictionary<string>;
    files: string[];
    funding: FundingProperty;
    homepage: string;
    keywords: string[];
    license: LicenseProperty;
    main: string;
    module: string;
    name: string;
    optionalDependencies: Dictionary<string>;
    overrides: Dictionary<string | any>;
    peerDependencies: Dictionary<string>;
    peerDependenciesMeta: Dictionary<any>;
    private: boolean;
    productName: string;
    repository: RepositoryProperty;
    scripts: Dictionary<string>;
    types: string;
    version: string;
}

This type represents a package.json file, the configuration file for npm packages. The official documentation describing all possible properties of package.json can be found at the following link: https://docs.npmjs.com/cli/v10/configuring-npm/package-json

Type declaration

  • author: AuthorProperty

    Specifies the name and contact information of the package's author.

  • bin: string | Dictionary<string>

    Specifies the executable files or commands that the package provides.

  • bugs: BugsProperty

    pecifies the URL or contact information for reporting issues or bugs in the package.

  • bundleDependencies: boolean | string[]

    Specifies the packages that should be bundled when the package is published, ensuring they are included in the distribution.

  • config: Dictionary<string>

    Defines configuration settings that can be used by scripts or tools within the package.

  • contributors: AuthorProperty[]

    Lists additional individuals or organizations who contributed to the package.

  • dependencies: Dictionary<string>

    Lists the packages required for the package to function properly in production.

  • description: string

    A brief summary of the package's purpose or functionality.

  • devDependencies: Dictionary<string>

    Lists the packages required for development purposes, such as testing or build tools.

  • exports: string | Dictionary<string>

    Specifies which files or modules are exposed when the package is imported or required.

  • files: string[]

    Lists the files or directories to include when publishing the package.

  • funding: FundingProperty

    Specifies ways to financially support the package or its maintainers.

  • homepage: string

    The URL to the project homepage.

  • keywords: string[]

    Specifies an array of terms that help identify and categorize the package for search purposes.

  • license: LicenseProperty

    Specifies the license under which the package is distributed.

  • main: string

    Defines the entry point file for the package, typically the main module or script.

  • module: string

    Specifies the entry point for an ES module version of the package.

  • name: string

    The unique identifier and name of the package.

  • optionalDependencies: Dictionary<string>

    Lists the packages that are not required for the package to function, but will be installed if available.

  • overrides: Dictionary<string | any>

    Allows specifying package versions or configurations to override dependencies or their versions in the package tree.

  • peerDependencies: Dictionary<string>

    Lists the packages that are required by the package but should be provided by the consuming project.

  • peerDependenciesMeta: Dictionary<any>

    Provides additional metadata for peer dependencies, such as optional or specific configuration.

  • private: boolean

    Indicates whether the package is private, preventing it from being published to the npm registry.

  • productName: string

    Specifies the name of the product, often used in the app's packaging or installation process.

  • repository: RepositoryProperty

    Provides the URL or details of the package's source code repository.

  • scripts: Dictionary<string>

    Defines custom scripts that can be run using npm commands (e.g., build, test).

  • types: string

    Points to the type definition file for the package, providing TypeScript type information.

  • version: string

    Specifies the package version following semantic versioning (major.minor.patch).