Workspace scripts now run tasks in parallel against all sub-packages #310
JeremyJonas
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Workspaces created with NxMonorepo previously required using
npx nx run-many --target={task}
syntax to execute tasks in parallel across all sub-packages. This required knowledge of how nx run-many command works and context switching betweennx
andyarn
depending on if you were targeting workspace (nx) or package (yarn) based tasks.Since #307, the common workspace tasks (build, test, compile, watch, etc.) have been mapped to the respective
nx run-many --target={task}
tasks, which enables simply usingyarn {task}
consistently throughout.Now you can just call
yarn build
from your workspace root and it will automatically usenx run-many
to graph dependencies and perform parallel execution, which also benefit fromnx caching.All these workspace tasks accept nx run-many options, so you maintain the same control you would get from directly call
nx run-many
, such as scoping execution to a subset of packages using --project option, or changing console output style using --output-style option.Additionally, there is a
run-many
workspace task that is not mapped to a specific target (eg: build) to support other similar use cases.This is the first of many features to come that are working to simplify cognitive load of the underlying technology we use (nx, projen, jsii, etc.) and unify the way in which engineers develop. If you have any other suggestion, we are all ears - please give us your feedback.
If you are using a different package manager than yarn, such as npm or pnpm, that will work the same - just replace
yarn {task}
with your manager script runner syntax (eg:npm run build
)Beta Was this translation helpful? Give feedback.
All reactions