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
7.6 KiB
| title | description | keywords | ||||
|---|---|---|---|---|---|---|
| Common Tasks | Learn about standard task naming conventions in Nx projects, including build, serve, test, and lint tasks, for consistent project configuration. |
|
Common Tasks
The tasks that are inferred by plugins or that you define in your project configuration can have any name that you want, but it is helpful for developers if you keep your task naming convention consistent across the projects in your repository. This way, if a developer moves from one project to another, they already know how to launch tasks for the new project. Here are some common task names that you can define for your projects.
build
This task should produce the compiled output of this project. Typically, you'll want to have build tasks depend on the build tasks of project dependencies across the whole repository. You can set this default in the nx.json file like this:
{
"targetDefaults": {
"build": {
"dependsOn": ["^build"]
}
}
}
The task might use the @nx/vite, @nx/webpack or @nx/rspack plugins. Or you could have the task launch your own custom script.
{% tabs %} {% tab label="Vite" %}
Set up an inferred build task for every project that has a Vite configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/vite/plugin",
"options": {
"buildTargetName": "build"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="Webpack" %}
Set up an inferred build task for every project that has a Webpack configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/webpack/plugin",
"options": {
"buildTargetName": "build"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="rspack" %}
Set up an inferred build task for every project that has an rspack configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/rspack/plugin",
"options": {
"buildTargetName": "build"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="Custom Script" %}
You can define your own build task in your project configuration. Here is an example that uses ts-node to run a node script.
{
"scripts": {
"build": "ts-node build-script.ts"
}
}
{% /tab %} {% /tabs %}
serve
This task should run your project in a developer preview mode. The task might use the @nx/vite, @nx/webpack or @nx/rspack plugins. Or you could have the task launch your own custom script.
{% tabs %} {% tab label="Vite" %}
Set up an inferred serve task for every project that has a Vite configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/vite/plugin",
"options": {
"serveTargetName": "serve"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="Webpack" %}
Set up an inferred serve task for every project that has a Webpack configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/webpack/plugin",
"options": {
"serveTargetName": "serve"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="rspack" %}
Set up an inferred serve task for every project that has an rspack configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/rspack/plugin",
"options": {
"serveTargetName": "serve"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="Custom Script" %}
You can define your own serve task in your project configuration. Here is an example that uses ts-node to run the entry point of your project.
{
"scripts": {
"serve": "ts-node main.ts"
}
}
{% /tab %} {% /tabs %}
test
This task typically runs unit tests for a project. The task might use the @nx/vite or @nx/jest plugins. Or you could have the task launch your own custom script.
{% tabs %} {% tab label="Vitest" %}
Set up an inferred test task for every project that has a Vitest configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/vite/plugin",
"options": {
"testTargetName": "test"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="Jest" %}
Set up an inferred test task for every project that has a Jest configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/jest/plugin",
"options": {
"targetName": "test"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="Custom Script" %}
You can define your own test task in your project configuration. Here is an example that runs the ava test tool.
{
"scripts": {
"test": "ava"
}
}
{% /tab %} {% /tabs %}
lint
This task should run lint rules for a project. The task might use the @nx/eslint plugin or run your own custom script.
{% tabs %} {% tab label="ESLint" %}
Set up an inferred lint task for every project that has an ESLint configuration file with this configuration in nx.json:
{
"plugins": [
{
"plugin": "@nx/eslint/plugin",
"options": {
"targetName": "lint"
}
}
]
}
You can also override the inferred task configuration as needed.
{% /tab %} {% tab label="Custom Script" %}
You can define your own lint task in your project configuration. Here is an example that runs the sonarts lint tool.
{
"scripts": {
"lint": "sonarts"
}
}
{% /tab %} {% /tabs %}