nodemon.json


Overview

[nodemon.json](/projects/291/68849) is a configuration file specifically for **Nodemon**, a utility that automatically restarts Node.js applications when file changes in the directory are detected. This file defines how Nodemon should monitor, ignore, and execute commands during the development lifecycle of a TypeScript-based Node.js project.

This configuration enables efficient development workflows by specifying exactly which files to watch for changes, which to exclude, and what command to run when a change occurs. It helps automate the build and restart process, reducing manual intervention and improving developer productivity.


Detailed Explanation of Configuration Properties

The [nodemon.json](/projects/291/68849) file is a JSON object containing key-value pairs that configure Nodemon's behavior:

Property

Type

Description

Example Usage

`ignore`

Array of strings

Specifies the list of files or directories that Nodemon should **not** watch for changes. Changes in these files will be ignored and will not trigger a restart.

["ignore": ["src/routes.ts"]](/projects/291/69202) means changes in `src/routes.ts` won't restart Nodemon.

`watch`

Array of strings

Specifies the files or directories Nodemon should watch for changes. When a change is detected in any of these files, Nodemon will trigger the specified command to re-run.

["watch": ["src", "../../../packages/*/dist/tsconfig.tsbuildinfo"]](/projects/291/68809) watches the `src` directory and specific build info files.

`ext`

String

Defines the file extensions Nodemon should pay attention to. Only changes in files with this extension will trigger a restart.

["ext": "ts"](/projects/291/69124) means only `.ts` (TypeScript) files are monitored.

`exec`

String

The command Nodemon runs when a watched file changes. This usually involves building the project and running the output Node.js application.

["exec": "yarn build && node dist/arbitrum-nova/api/src/app.js"](/projects/291/68852) runs the build script and then starts the Node.js app.


Usage Example

Given this file configuration, the typical usage flow during development is:

  1. Start Nodemon: Run nodemon (it will automatically use nodemon.json if present).

  2. Watch for Changes: Nodemon watches all .ts files under src and the specified build info files.

  3. Ignore Certain Files: Changes in src/routes.ts do not trigger restarts.

  4. On Change: When a watched file changes, Nodemon executes:

    yarn build && node dist/arbitrum-nova/api/src/app.js
    

    This rebuilds the project and runs the compiled JavaScript application.

**This automates the build and execution cycle, ensuring the running app is always up to date with the latest source code changes.**


Important Implementation Details


Interaction with Other Parts of the System


Mermaid Diagram: Nodemon Configuration Workflow

flowchart TD
    A[Start Nodemon] --> B{File Change Detected?}
    B -- No --> B
    B -- Yes --> C{Is file in "ignore"?}
    C -- Yes --> B
    C -- No --> D{Is file extension ".ts"?}
    D -- No --> B
    D -- Yes --> E[Run "yarn build"]
    E --> F[On successful build]
    F --> G[Run "node dist/arbitrum-nova/api/src/app.js"]
    G --> B

Summary

This file is an essential part of the development tooling in the project, facilitating smooth and efficient iterative development cycles.