Skip to content

NX Snippets

If you don't have nx available globally, substitute nx with npx nx in the followings:

General

bash
nx lint kmsv2

# lint all projects
nx run-many -t lint

# lint all projects in packages/kmsv2*
nx run-many -t lint -p packages/kmsv2*

Angular

bash
# Create a new angular application
nx g @nx/angular:app admin

# create toolbar component inside admin app
nx g @nx/angular:component toolbar --directory packages/admin/src/app/toolbar

# Create a new angular library
nx g @nx/angular:lib admin-tenant

# create myComponent inside admin-tenant library
nx g @nx/angular:component myComponent --directory packages/admin-tenant/src/lib/myComponent

# create tenant-service inside admin-tenant library
nx g @nx/angular:service tenant --directory packages/admin-tenant/src/lib

# development
nx serve admin

# lint
nx lint admin

CDK

bash
nx synth tenant-api
nx deploy tenant-api
nx serve tenant-api
nx destroy tenant-api
nx cdklist tenant-api

The commands was made available by entries in project.json/targets and package.json/scripts

Workspace

bash
# Run lint on many projects
nx run-many -t lint -p admin admin-tenant

# Run test on all affected projects
nx affected -t test --parallel=5

# Show dependency graph
nx graph

# Create then remove a project
nx g @nx/angular:app fooProject
nx remove fooProject

Made with ❤️ by Bagubagu Studio