NX commands

A subset of nx cli commands

Global Options:

--dry-run
--buildable # options for libs. alias is: publishable
--tags=
  domain: <shared>
  type: <app/util/ui/feature/domain-logic/shell>
  platform: <web/mobile/desktop/node/universal>

Generate Commands

Generate Modules

buildable is alias for old publishable you can always make an existing library buildable after the fact.

Every buildable library has a build task.

yarn create nx-workspace yeti --preset=empty -prefix=yeti # create an empty workspace
nx g @nrwl/angular:app yeti-web-app --style=scss --prefix=yeti --routing --tags="domain:yeti,type:app,platform:web" --dry-run
nx g @nrwl/nest:app yeti-api --frontendProject=yeti-web-app --tags="domain:yeti,type:api,platform:node"

# generate share angular lib module
nx g @nrwl/angular:lib ui  --style=scss --tags="domain:shared,type:ui,platform:web"
nx g @nrwl/angular:lib knob --directory=components --buildable --style=scss  --tags="domain:shared,type:ui,platform:web"
nx g @nrwl/nest:lib <nest-lib> [--controller] [--service] [--global] [--buildable] [--tags] # generate nestjs lib module
nx g @nrwl/workspace:lib btree --directory=utils --tags="domain:shared,type:util,platform:universal" # generate share universal lib module

Refactor Modules

Generate Components

Generate workspace schematics

Run commands

For Single Project

For Multiple Projects

For Affected Projects

The print-affected and run-many commands can be used to set up your CI to use multiple agents, while still rebuilding and retesting only what is affected.

Other Commands

Reference

Last updated

Was this helpful?