Nx Monorepo build system
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
npx nx <target> <project>
nx run-many -t build
nx affected -t test
nx graphnx show projects
nx g <plugin>:<generator>
nx resetnx <target> <project> --skipNxCache
Concepts
- Project graph projects + deps
- Task graph what to run
- Cache hit: replay
- Run parallel
Run tasks
nx run <project>:<target>
nx <target> <project>
nx run <p>:<t>:<config>
nx <target> <project> -c <config>
nx run-many -t <target>
nx run-many -t <t1> <t2>
nx run-many -t <target> -p <a> <b>
nx run-many -t <target> -p
"tag:<tag>"
nx run-many -t <target> --exclude <p>
nx affected -t <target>
nx affected -t <target> --base=<ref>
--head=<ref>
nx affected -t <target> --uncommitted
nx affected -t <target> --explain=stdout
--parallel=<n>
--parallel=false
--nxBail--outputStyle=<style>
--graphnx watch --all -- <cmd>
Inspect
nx graphnx graph --focus=<project>
nx graph --affected
nx graph --view=tasks --targets=<t>
nx graph --file=<out>.json
nx show projects
nx show projects --withTarget=<t>
nx show projects --type=<app|lib|e2e>
nx show projects --affected
nx show project <project>
nx show target inputs <project>:<t>
nx show target outputs <project>:<t>
nx listnx list <plugin>
Generate and set up
nx g <plugin>:<generator> <name>
nx g <plugin>:<generator> --dry-run
nx g @nx/js:library <name>
nx add <package>
nx initnx syncnx sync:checknx format:writenx format:checknx migrate latest
nx migrate --runMigrations
nx migrate latest --createCommits
Cache and daemon
nx resetnx reset --onlyCache
nx reset --onlyDaemon
--skipNxCache--skipRemoteCache
NX_DAEMON=falsenx connectConfig files
project.json: targets
project.json: tags
targets.<t>.executor
targets.<t>.command
targets.<t>.dependsOn
"^build" in dependsOn
targets.<t>.inputs
targets.<t>.outputs
targets.<t>.cache: true
targets.<t>.configurations
nx.json: targetDefaults
nx.json: namedInputs
nx.json: plugins
nx.json: defaultBase
nx.json: nxCloudId
Recipes
{ "defaultBase": "main", "targetDefaults": { "build": { "dependsOn": ["^build"], "cache": true, "outputs": ["{projectRoot}/dist"] }, "test": { "cache": true } }}
nx affected -t lint test build --base=origin/main# shallow clones hide history:# fetch full history (fetch-depth: 0)
nx migrate latestnpm installnx migrate --runMigrations# review diff, then delete migrations.json
nx show target inputs <project>:buildnx build <project> --skipNxCachenx reset



