Ctrl K
ComunidadGuías…

nx.json

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
{
  "analytics": false,
  "affected": {
    "defaultBase": "main"
  },
  "workspaceLayout": {
    "appsDir": "packages",
    "libsDir": "packages"
  },
  "targetDefaults": {
    "build": {
      "cache": true,
      "dependsOn": ["^build"]
    },
    "ci:build": {
      "cache": true,
      "dependsOn": ["^ci:build"],
      // The `runtime` input pairs with `.nvmrc` in sharedGlobals: the file
      // catches a declared version bump, this catches an actual interpreter
      // that disagrees with it (local shells, a runner image change).
      "inputs": ["production", "^production", { "runtime": "node --version" }],
      "outputs": ["{projectRoot}/dist"]
    },
    "ci:lint": {
      "cache": true,
      "dependsOn": ["^ci:build"],
      "inputs": ["default", "^production", { "runtime": "node --version" }]
    },
    // Unit tests import the compiled `dist` of workspace dependencies (e.g.
    // `@hyperdx/common-utils/dist/types`), so they need the same `^ci:build`
    // that `ci:lint` has. Without it, `nx run-many -t ci:unit` can run jest
    // against a stale or absent dist — which fails intermittently, because the
    // nx cache usually leaves a usable dist behind and occasionally does not.
    "ci:unit": {
      "cache": true,
      "dependsOn": ["^ci:build"],
      "inputs": ["default", "^production", { "runtime": "node --version" }]
    },
    // `outputs` is not optional here. Without it nx caches only the terminal
    // output, so a cache hit replays a convincing build log and leaves `dist`
    // exactly as it found it — stale, or missing entirely. That bites because
    // `ci:build` writes the same `dist` from a different command (tsup alone,
    // no `tsc --emitDeclarationOnly`), so running unit tests and then `yarn dev`
    // leaves you on whichever dist won the race, with no sign anything is off.
    "dev:build": {
      "cache": true,
      "outputs": ["{projectRoot}/dist"]
    },
    "lint": {
      "cache": true
    },
    "test": {
      "cache": true
    }
  },
  "namedInputs": {
    "default": [
      "{projectRoot}/**/*",
      "sharedGlobals",
      // `packages/api/openapi.json` is regenerated by `docgen` inside the api's
      // own `ci:lint`, so leaving it in would make that task mutate its own
      // input set. It has to be excluded here rather than on `ci:lint` itself:
      // `@hyperdx/app` depends on the api, so the file also reaches app's lint
      // hash via `^production`, which expands the *dependency's* named inputs.
      "!{projectRoot}/openapi.json"
    ],
    "production": [
      "default",
      "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
      "!{projectRoot}/tsconfig.spec.json",
      "!{projectRoot}/jest.config.[jt]s",
      "!{projectRoot}/eslint.config.mjs"
    ],
    "sharedGlobals": [
      "{workspaceRoot}/tsconfig.base.json",
      "{workspaceRoot}/.prettierrc",
      "{workspaceRoot}/.prettierignore",
      "{workspaceRoot}/package.json",
      "{workspaceRoot}/yarn.lock",
      "{workspaceRoot}/.nvmrc"
    ]
  }
}