nx/docs/shared/recipes/running-tasks/running-custom-commands.md
Jack Hsu 66eaf2fc74
docs(misc): remove /nx-api pages (#31453)
This PR removes the `/nx-api` pages from `nx-dev`. They are already
redirected from `/nx-api` to either `/technologies` or
`/reference/core-api` URLs.

e.g. `/nx-api/nx` goes to `/reference/core-api/nx` and `/nx-api/react`
goes to `/technologies/react/api`

**Changes**:
- Remove old `nx-api.json` from being generated in
`scripts/documentation/generators/generate-manifests.ts` -- this was
used to generate the sitemap
- Remove `pages/nx-api` from Next.js app since we don't need them
- Remove workaround from link checker
`scripts/documentation/internal-link-checker.ts` -- the angular
rspack/rsbuild and other workarounds are gone now that they are proper
docs in `map.json`
- Update Powerpack/Remote Cache reference docs to exclude API documents
(since they are duplicated in the Intro page) --
`nx-dev/models-document/src/lib/mappings.ts`
- All content in `docs` have been updated with new URL structure

**Note:** Redirects are already handled, and Claude Code was used to
verify the updated `docs/` URLs (see report below). The twelve 404s
links were updated by hand.

## Verification Report

https://gist.github.com/jaysoo/c7863fe7e091cb77929d1976165c357a
2025-06-04 16:57:01 -04:00

1.4 KiB

title description
Running Custom Commands Learn how to run custom terminal commands with Nx to make them cacheable, distributable, and compatible with Nx's affected commands.

Running Custom Commands

You can easily run any command with the Nx toolchain. The main benefit is to make the operation cacheable, distributable as well as being able to use it with Nx's affected commands.

1. Define the terminal command to be run

The command we want to run for each project is:

make hello

With this Makefile in the root of the project:

hello:
  echo "Hello, world!"

2. Update project.json

For each project for which you want to enable make, add a target in its project.json:

// ...
"targets": {
    "make": {
        "command": "make hello"
    }
    // ...
}

For more information (e.g. how to forward arguments), see the run-commands api doc.

3. Run the command

To run the command, use the usual Nx syntax:

nx run my-app:make

or

nx make my-app

You can also run the make command for all projects it has been defined on:

nx run-many -t make

Or just on a subset of projects that are affected by a given change:

nx affected -t make