Configuration

npm-check-updates can be configured using a dedicated config file. This allows you to set default options for your project and share them with your team.

Config File

Add a .ncurc.{json,yml,js,cjs} file to your project directory to specify configuration information.

Options are merged with the following precedence:

  1. Command line options
  2. Local Config File (current working directory)
  3. Project Config File (next to package.json)
  4. User Config File ($HOME)

Example .ncurc.json

{
  "upgrade": true,
  "filter": "svelte",
  "reject": ["@types/estree", "ts-node"]
}

You can also specify a custom config file name or path using the --configFileName or --configFilePath command line options.

Advanced Config with Functions

For more advanced logic, you can use a JavaScript configuration file (.ncurc.js or .ncurc.cjs). This allows you to define options like filter and target as functions.

This project's own .ncurc.js is a good example:

module.exports = {
  format: 'group',
  reject: [
    // esm only modules
    'camelcase',
    'find-up',
    'chai',
    'p-map',
    'remote-git-tags',
    'untildify',
  ],
}

Using defineConfig

Alternatively, you can use the defineConfig helper which provides intellisense in supported editors without the need for JSDoc annotations:

const { defineConfig } = require('npm-check-updates')

module.exports = defineConfig({
  upgrade: true,
  filter: name => name.startsWith('@myorg/'),
})

JSON Schema for IDEs

For .ncurc files in JSON or YAML format, you can enable autocompletion and validation in your IDE by adding the JSON Schema to your settings.

Here is an example for VS Code's settings.json:

{
  "json.schemas": [
    {
      "fileMatch": [
        ".ncurc",
        ".ncurc.json"
      ],
      "url": "https://raw.githubusercontent.com/raineorshine/npm-check-updates/main/src/types/RunOptions.json"
    }
  ],
  "yaml.schemas": {
    "https://raw.githubusercontent.com/raineorshine/npm-check-updates/main/src/types/RunOptions.json": [
        ".ncurc.yml"
    ]
  }
}