Skip to content

Commit 27beba8

Browse files
mhartingtonisaacplmannjaysoo
authored
docs(core): release blog post (#28275)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # --------- Co-authored-by: Isaac Mann <[email protected]> Co-authored-by: Jack Hsu <[email protected]>
1 parent 63e0f27 commit 27beba8

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

docs/blog/2024-10-03-nx-20-release.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Announcing Nx 20
3+
slug: announcing-nx-20
4+
authors: [Mike Hartington]
5+
tags: [nx, release]
6+
cover_image: /blog/images/2024-10-03/nx-20-header.png
7+
---
8+
9+
I know it's hard to believe but Nx 20 is here! There's a lot to cover in this release, so let's just dive right in.
10+
11+
## `@nx` All The Things!
12+
13+
If you've been around the Nx ecosystem for any amount of time, you're probably aware that our plugins were published originally under the `@nrwl` npm scope. Since version 16, we've provided backwards compatibility by reexporting `@nx` scoped packages from `@nrwl`. With Nx 20 though, we'll be officially dropping support for the `@nrwl` scoped packages and they will no longer be published to npm. For projects that still have the older packages in them, our [migration docs][rescope] can guide you to what the new packages are in order for you to update any impacted dependencies.
14+
15+
## TypeScript Project References For Monorepos
16+
17+
[**Project References**](https://www.typescriptlang.org/docs/handbook/project-references.html) allows TypeScript to process individual projects rather than the entire monorepo as whole. This is a huge improvement in terms of build times and developer experience. However, Project References comes with a maintenance cost, as it is up to you to update these references. In a large monorepo, this cost is prohibitive.
18+
19+
With Nx 20, when using `create-nx-workspace --preset=ts`, workspaces will use Project References out of the box. Nx removes the maintenance cost of this feature by automatically updating the references for you when you run `build` or `typecheck` targets. You can also run [`nx sync`](/reference/nx-commands#sync) to update references, and `nx sync:check` in CI to validate the workspace.
20+
21+
In addition to adopting Project References, we're also changing the way we link projects in a TypeScript monorepos. **Workspaces** is the standard way to link packages in monorepos. This is a feature that all modern package managers support, such as [npm](https://docs.npmjs.com/cli/using-npm/workspaces), [yarn](https://yarnpkg.com/features/workspaces), [pnpm](https://pnpm.io/workspaces), and [bun](https://bun.sh/docs/install/workspaces), so taking advantage of it is a no-brainer. Now we have a proper way to provide type information and have your packages available in a way developers are used to.
22+
23+
Note that we've enabled Project References and Workspaces for the TS preset (i.e. `--preset=ts`), and we're working on extending this support for all other presets soon (Angular, React, Vue, Node). If you are an existing Nx user and want to create an empty workspace in the previous "integrated" style, you can use `create-nx-workspace --preset=apps`.
24+
25+
## `@nx/rspack` Graduates From Labs 🎓
26+
27+
[Rspack][rspack] has become one of the most exciting new bundlers in recent years. With a webpack-compatible API, it's a painless migration for folks who want faster builds without having to rewrite their entire build process. At Nx, we're big fans of Rspack and have been working on a plugin for folks who would like to migrate. With that in mind, the `@nx/rspack` plugin has officially been merged into the main Nx repository and will become a fully supported plugin for the ecosystem.
28+
29+
In addition to this, Nx core team member [Colum Ferry][colum] has taken the work he's done on the Rspack plugin and brought it to the Angular ecosystem! He's recently released `@ng-rspack/nx` to bring Rspack support to your Angular projects. Simply install the plugin and generate a new app in your workspace to try it out!
30+
31+
```bash
32+
# In an Nx Workspace (npx create-nx-workspace)
33+
# Install Package
34+
npm install @ng-rspack/nx
35+
36+
# Run the app generator
37+
npx nx g @ng-rspack/nx: app apps/myapp
38+
39+
# Serve the app
40+
npx nx serve myapp
41+
42+
# Build the app
43+
npx nx build myapp
44+
45+
# Run the e2es
46+
npx nx e2e myapp-e2e
47+
```
48+
49+
## Nx Release: More Powerful And Flexible Versioning
50+
51+
`nx release` has added many powerful versioning capabilities since it was first made public as part of Nx 19. We are super excited about an in progress ground-up reworking of our versioning logic that powers `nx release` and the programmatic API `releaseVersion()` that will continue to support all these features, and allow for even more complex and large scale workspaces to be supported.
52+
53+
For example, release groups have existed as a concept from the very beginning, but their effectiveness is currently not maximized because it is not supported to have project dependencies that span across release group boundaries. The new version coming in a later Nx v20 minor release makes it possible for any number of dependency relationships to exist across any number of release group boundaries.
54+
55+
Additionally, for workspaces that contain multiple different programming languages, extending the versioning logic within `nx release` can currently be quite verbose, with maintenance being quite a burden due to the business logic that lives within the version generator abstraction, and this is what gets implemented per language/ecosystem.
56+
57+
The Nx Team provides the JavaScript version generator out of the box, so for many users, this is not a concern. But for those working with Go, Rust, Dotnet, Java etc, currently a lot of logic needs to be reimplemented and kept up to date with the latest features. In the upcoming versioning rework, the abstraction required for each new language/ecosystem is tiny and purely deals with interacting with the relevant manifest file and registry, if applicable. All feature capabilities are maintained on the Nx core side. Once this new versioning implementation is available in an Nx v20 minor release we will update our documentation to provide guidance on how to opt in, before it ultimately becomes the primary implementation in Nx v21.
58+
59+
## So Long Derived Directories 👋
60+
61+
Generating apps and libraries in a monorepo is something folks do quite regularly and part of that is telling Nx where it should put things. So you've probably seen this prompt before:
62+
63+
![Derived Path](/blog/images/2024-10-03/derived.png)
64+
65+
This is where the concept of derived directories comes in. It will try to inspect your project and put things where it makes sense. But with Nx 20, we're moving away from using derived directories for generators. Now, you'll need to provide the `directory` where you want your apps or libraries to be generated to.
66+
67+
## Wrapping Up
68+
69+
There's a lot more in Nx 20, so be sure to check the full changelog for all the details on everything in this major release.
70+
71+
- [Nx 20 Changelog](/changelog)
72+
73+
[rspack]: https://rspack.dev
74+
[rescope]: /deprecated/rescope
75+
[colum]: https://x.com/FerryColum
109 KB
Loading
984 KB
Loading

0 commit comments

Comments
 (0)