Repository navigation
Replies: 11 comments 16 replies
|
@vsavkin great road map! Focusing on scalability of big repos look like a best direction right now. |
|
I'd love to see dependencies like Babel, Webpack and Jest be removed from the core workspace packages. With tools like esbuild, vite, swc, vitest, Ladle etc it is really easy to remove large parts of projects dependency trees by dropping those dependencies. |
Filter Imports Based on TagsCare to explain this feature in more detail? I don't understand what it does. |
|
Each release is wonderful, nice roadmap. Will there also be an upgrade to storybook 6.5? And do you have intentions to add an executor for the test runner or will it initially be community-driven? It would make the additional Cypress integration for component testing somewhat redundant, or am I mistaken? |
|
@vsavkin Can't wait when Nx will be able to publish packages to NPM. Having integration with semantic-release will be absolutely amazing. Please 🙏🏻 |
|
when will vite be integrated to be used with react? |
|
ETA v15 release with OTB configuration for storybook web components? |
|
would love to see support of |
|
There was a section in the Nx 14 Roadmap discussion:
Was curious what the latest is there. Seems like questions related to this are somewhat regular. Might be something useful to clarify in docs (would be down to help with this!) Thanks! Selected References
EDIT: I wanted to double check that I hadn't overlooked something in the docs -- and I found this from the Mental Model page.
Does this work by default now? Any additional config?* EDIT2: *This comment has the most detailed description of the behavior that I've found -- and this |
|
I've been using
I think generators are misunderstood. Some of us may not understand that The ideas shared here seem really ambitious and I can't wait to see whats coming. The possibilities brought by |
|
Would love if nx team made research about possibility using |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Core
“Negative” Configuration
A lot of folks talk about “zero” configuration, and we ourselves mention it in the docs. If you run “npx add-nx-to-monorepo”, you’ll get “nx.json” with some properties in it and that’s about it. Every npm script you have will get faster without your having to configure anything per script. But since Nx is pluggable, we can do a lot better.
Imagine a repo with 1000 projects, many of which are similar.
Most folks using Nx today (or using other monorepo tools) will have a npm script called build defined for each of those (in case of Nx, you could also define the build target in project.json instead of the npm script). Nx users already could write a small plugin (a 30-line JS file in your workspace) that will teach Nx how to build every project, so you don’t have to define those scripts. It’s already possible, but since it requires writing a plugin, no matter how small or easy this is, few do it.
Any large Nx workspace with hundreds or thousands of projects will have thousands of nearly identical build configurations. We are going to make it much simpler to describe these configs in one place and remove all those npm scripts or project.json files–no plugins required.
Adding Nx to your repo could remove thousands of lines of configuration. So Nx isn’t just zero-config, it's negative-config.
Publishable Plugins and Local Plugins
Pluggability and customizability make up one of the core Nx design principles. No matter how fast your build system is, if you cannot adapt it to the needs of your organization or community, it isn’t going to be used in the long run.
We have introduced the “@nrwl/nx-plugin”, “@nrwl/devkit” and “create-nx-plugin” packages two years ago. With them you can scaffold, build and publish plugins. In the last 6 months, we have put a lot of effort into simplifying this process. In particular, we made it easier to create Nx plugins which are mainly used in the same workspace (you can call them local plugins). Now building a custom executor or generator and using it in your org takes a few minutes.
We are going to simplify this process even further, in particular, making it easier to e2e test your plugins. We are also planning to migrate folks away from using workspace generators (fully automatically) to using local plugins. Using a local plugin instead of workspace generators will allow us to eliminate a special case from Nx, but more importantly will catch these generators up in terms of features. Generators in a local plugin can be set as a workspace’s default collection, have default parameters set, and also receive the same affordances that any other generator may have. And to stress it again, you won’t have to do anything to make it happen – an Nx migration will do it for you completely automatically.
Cleanup
We spent a lot of effort attending to the technical debt in core in the last 6 months. The result is a cleaner codebase that is easier to understand and maintain, and the only package you have to install now to use Nx is “nx”.
There is still a lot to do: moving all the Nx-related computation to the daemon process that runs in the background, removing third-party deps, straightening up some idiosyncratic configuration options etc. As always, everything in your workspace will be updated automatically.
JavaScript/TypeScript
Building Massive JS/TS Applications
Distributed Computation Caching and Distributed Task Execution, which Nx provides, let you scale your repo horizontally, so no matter how big it gets, the CI time remains constant.
Many Nx plugins (e.g., React, Next.js, Angular) support zero-config incremental builds, where some parts of a given application can be built separately and shared across dev machines or CI runs. The downside of this setup is that cold builds (where everything needs to be rebuilt) could become slower because you need to initialize multiple TS programs, which can be costly.
Two things that can help us make this tradeoff better:
The two features should help us get faster cold and warm builds locally, while preserving distributed caching and distributed task execution.
React
React Server-Side Rendering and Server Components
The new “react-dom/server” APIs along with server components make the server-side rendering story much better. The support for suspense makes it possible to do SSR without some of the drawbacks that previously existed–such as not knowing when a data-dependent component is ready to render.
Nx will provide a new generator to enable SSR for existing React apps. The SSR support will provide adapters for Nx-supported server frameworks: Express and NestJS. Nx users that want to do SSR but do not want to use Next.js or Remix can use the new generator, then further customize it to fit their needs.
React Native + Detox
The detox build does not land itself well to being used in Detox E2E tests. Nx will provide the necessary integration points to make this work together, which will be a great option for teams using Expo.
Cleanup and Optimizations
The dependency on “rxjs” adds 5 MB to workspaces that use “@nrwl/react” and “@nrwl/web”. We should convert rxjs usages with plain async iterator composition, as there is no reason to install rxjs for React workspaces.
The webpack setup also has some tech debt that needs to be cleaned up to increase readability and maintainability (both important for community contribution). We will also continue benchmarking our builds to improve speed where we can.
Angular
Streamlined Migration of Angular CLI Workspaces -> Nx
Currently, our support for migrating Angular CLI workspaces to Nx is limited and restrictive. We only support migrating workspaces that contain a single application.
We will improve this story significantly by adding support for Angular CLI Workspaces that contain multiple applications and libraries, with the caveat that these workspaces must be using official builders from Angular Devkit.
This should become possible with a single command: “ng add @nrwl/angular”. This should increase the number of potential Angular CLI Workspaces that can be automatically migrated to Nx.
We will also investigate the complexity of supporting Angular CLI Workspaces that contain builders and targets supporting the following: Storybook, Jest, Ngx-build-plus
Ensure Evergreen Angular Support
Angular 14 is on the horizon and we will ensure that it is fully supported in Nx with any required migrations when it has been released. This will help to maintain the evergreen status of Angular projects in Nx Workspaces.
Storybook
Remove Inconsistencies with the Native Builder
Storybook has evolved quite a lot in recent versions, in particular when integrating with Angular. Some of the logic we had built in our Nx Storybook executors to cope with missing features on the Storybook end, for both Angular workspaces but also scenarios that are specific to monorepos can now be removed. We are going to make sure to more tightly integrate with Storybook on the "builder" level to avoid potential inconsistencies with the native Storybook setup.
Support MDX Stories Generation
We will support the MDX stories format, potentially “MDX-flavored CSF”. That new feature should help Nx users produce Storybook docs easier, out of the box, with their stories.
Be Consistent with CSF
We already support Component Story Format, and will make changes to our generators and executors to remain in sync with the latest version of the format.
Support Web Components Stories Generation
We will add support for generating stories for web components.
We will also improve support for storybook composition and the Cypress-Storybook integration.
Cypress
Speed Up CI
By default the Cypress executor will serve the web application you're testing, which is great for local iterative development, but a waste of resources within CI as your web app has most likely already been built within previous steps of the CI process. Today, you must manually configure a static file server and cypress to prevent rebuilding. Cypress will now provide those configurations out of the box.
Support for Multiple Targets
Often developers have to spin up multiple targets for full e2e tests, i.e. database, backend api, and frontend web applications. We will provide ways to serve all of these targets to make your experience even better.
Jest
Batch Mode
We will be working improving Jest performance via Batch mode, where we can batch tests across projects together when they have the same configurations. This has existed in very early alpha within nx today. We are looking to keep progressing this feature.
Configurations
We will be moving Jest configurations to TS files. At the same time, we will be working on unifying the jest config into a default configuration object that can easily be extended where needed. This helps nx by making jest configuration migrations easier and keep consistency within your jest configurations.
Nx Console
Project Graph Viz Integration
We will bring the project graph viz to Nx Console. With more recent updates to how the graph performs and is shown, we think that having this tool available in Visual Studio Code will help when trying to figure out what depends on what, without having to leave the comfort of your editor.
We’ll also add functionality so that you can instantly focus on a project in the dep graph through the projects view in Nx Console.
Remove/Move Projects
Did you know that Nx has support for removing / moving projects? You can do this today by running
nx g @nrwl/workspace:remove,nx g @nrwl/workspace:move(and a special case for Angular,nx g @nrwl/angular:remove/move).We will bring this functionality to the front with Nx Console, by making this easier to discover. We will add new context menus and drag and drop support to the Explorer so that moving projects can be easier.
Filter Imports Based on Tags
In large workspaces, it’s good practice to tag your projects, and then configure lint rules for import constraints. This allows the workspace to be lean, and try to keep the project graph simple.
With Nx Console, we can look up these constraints, and filter out TypeScript imports based on tags. In large workspaces, we think that this will greatly reduce the stress of seeing hundreds of imports, and only give you the imports that are actually allowed.
Improved Test Coverage of Nx Console Itself
In addition to above, we also plan on making Nx Console fully test covered. This means that we’re going to start writing Visual Studio Code E2Es, and rely less on Jest mocks.
This will give everyone more confidence on each release of Nx Console, without us having to manually test dozens of different workspace configurations.
Linter
Extend
workspace-lintto Support Custom Lint ChecksCurrently
workspace-lintdoes only the integrity checks -if there are projects without files or files without projects. We want to enable custom checks on configuration files that would ensure greater control on the large repositories e.g. making sure each project has specific tags defined, ensuring we are using the same executor for the same targets across projects etc.Repository
The Nx community has been growing 2.5x-3x per year, so the number of issues and pull requests has been increasing as well. Whereas 3 years ago, I could spend half a Friday every week on managing issues and PRs, now we have several people spending a lot more time than this. We have also merged aux repos into the main Nx monorepo to make the process of releasing simpler, but the result is more issues/prs in the main repo.
Keeping a popular open source repo in good shape is a lot of work. Making sure the high-priority issues are addressed quickly is high priority for us.
All reactions