<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Katerina Skroumpelou</title>
    <description>The latest articles on Forem by Katerina Skroumpelou (@mandarini).</description>
    <link>https://forem.com/mandarini</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F150345%2Fc434f1f4-8753-43ce-8348-d96ed5398217.png</url>
      <title>Forem: Katerina Skroumpelou</title>
      <link>https://forem.com/mandarini</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mandarini"/>
    <language>en</language>
    <item>
      <title>Monorepos - Why Speed Matters</title>
      <dc:creator>Katerina Skroumpelou</dc:creator>
      <pubDate>Wed, 20 Mar 2024 20:52:22 +0000</pubDate>
      <link>https://forem.com/nx/monorepos-why-speed-matters-chf</link>
      <guid>https://forem.com/nx/monorepos-why-speed-matters-chf</guid>
      <description>&lt;p&gt;In the ever-evolving landscape of software development, efficiency and speed are vital. As projects grow in complexity, developers and teams need tools that can keep up without sacrificing quality or performance.&lt;/p&gt;

&lt;p&gt;Nx is a suite of powerful tools designed to optimize your development workflow, which sets the &lt;a href="https://nx.dev/ci/concepts/building-blocks-fast-ci"&gt;building blocks for a fast CI&lt;/a&gt;. Nx is always innovating in many ways to make developers’ lives easier, but this post is exclusively focused on the things Nx has done in the past year to make development faster and faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why speed matters
&lt;/h2&gt;

&lt;p&gt;The ability to iterate quickly and efficiently is vital for any software project. Speed in the development process offers several critical advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Faster feedback loops:&lt;/strong&gt; Quick iterations mean immediate feedback, allowing teams to adapt, learn, and improve their work on the fly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduced time to market:&lt;/strong&gt; Accelerating the development process can significantly cut down the overall time to market, providing a competitive edge which reclaims revenue that would have otherwise been lost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decreased developer frustration:&lt;/strong&gt; &lt;a href="https://nx.dev/ci/concepts/reduce-waste"&gt;No more waiting for builds and tests to complete&lt;/a&gt;. A streamlined workflow keeps morale high and productivity higher.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re using Nx already, you’re already familiar with &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nx.dev/ci/features/affected"&gt;&lt;strong&gt;Affected&lt;/strong&gt;&lt;/a&gt; - identifying and running tasks only on projects impacted by code changes,&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nx.dev/ci/features/remote-cache"&gt;&lt;strong&gt;Nx Replay&lt;/strong&gt;&lt;/a&gt; - our powerful cache and&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nx.dev/ci/features/distribute-task-execution"&gt;&lt;strong&gt;Nx Agents&lt;/strong&gt;&lt;/a&gt; - the concept of &lt;a href="https://nx.dev/ci/concepts/parallelization-distribution"&gt;Parallelization and Distribution&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But let’s see all the extra things we did this past year to make everything faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Speed at the core
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Rustifying Nx
&lt;/h3&gt;

&lt;p&gt;The Nx daemon has seen significant enhancements, notably through the use of Rust to calculate file hashes behind the scenes. This improvement not only speeds up the start-up times but also optimizes performance even without the daemon, especially on CI environments where the daemon isn't used. The benchmark results at &lt;a href="https://github.com/vsavkin/large-monorepo"&gt;this repo&lt;/a&gt; showcase the remarkable speed improvements, making Nx competitive with native code solutions while maintaining the accessibility and flexibility of Node.js. Nx is still Node-first, so contributions are easier and only the most performance-critical parts of Nx are native code.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Task Hasher and archive file innovations&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The introduction of a task hasher written in Rust, alongside the use of an archive file to store workspace file hashes (&lt;code&gt;.nx/cache&lt;/code&gt;), has significantly reduced the need for repetitive file system accesses. This innovation means that running multiple Nx commands in CI is much faster, as file hashing becomes unnecessary after the initial run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Archive file&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The archive file is a binary file that contains the workspace file hashes with their last modified time. Every time Nx starts (ie, running &lt;code&gt;nx run project:target&lt;/code&gt;) it gets all the files with their last modified time, and compares it to the archive. If the file exists in the archive, then Nx does not access the file system to read the file to hash (reading individual files is slower than just getting a list of files from a directory). So running multiple nx commands in CI is quick to start because Nx does not need to constantly hash files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Nx Replay
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fad6umaibcczq2ztkti8r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fad6umaibcczq2ztkti8r.png" alt="Nx Replay" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nx Replay enables caching and reusing of task results. It’s our well known Nx remote cache! It allows developers to avoid re-running expensive tasks by retrieving the cached results from a remote cache. This significantly improves build and test performance, as well as developer productivity. Nx Replay is also critical to the functioning of Nx Agents, which rely on the remote cache to ensure that the results of a task will be shared with every agent that needs them. By using Nx Replay, developers can optimize their workflows and reduce the time spent waiting for tasks to complete.&lt;/p&gt;

&lt;p&gt;With Nx Replay, you can see significant speed improvements in your CI pipelines for modified PRs. What’s also important is that if a task has been executed in CI, a developer running that same task locally can reuse the task result instead of actually running the task. So you will also see improvements locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Nx Agents&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fra4u8gspdavty040mpz9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fra4u8gspdavty040mpz9.png" alt="Nx Agents" width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nx.dev/ci/features/distribute-task-execution"&gt;Nx Agents&lt;/a&gt; represent the pinnacle of task distribution optimization, ensuring that tasks are executed as efficiently as possible based on the specific requirements of each change. Some features that make up this effort are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nx.dev/ci/features/distribute-task-execution#cicd-guides"&gt;Easy integration with existing providers&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Distribution is handled on the Nx Cloud infrastructure and all you need is a single line. What’s more, all results are played back to your original CI provider script which triggers the Nx Cloud distribution, so that you can make use of the resulting artifacts&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nx.dev/ci/features/dynamic-agents"&gt;Efficient task distribution&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Save compute resources and reduce costs, minimizing idle time and compute waste&lt;/li&gt;
&lt;li&gt;Dynamic sizing based on PR size&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nx.app/products/tusky"&gt;Tusky&lt;/a&gt; - our AI solution - coming soon

&lt;ul&gt;
&lt;li&gt;You set your desired cost/speed ratio, and you forget about any more configuration. We ensure maximum speed up to limits you set yourself.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can read more about Nx Agents &lt;a href="https://nx.app/products/agents#content"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;TaskAtomizer&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://nx.dev/ci/features/split-e2e-tasks"&gt;TaskAtomizer&lt;/a&gt; splits your Cypress or Playwright e2e tests by file. This significantly enhances granularity for caching, parallel execution, and flaky test identification. This granular approach ensures that individual test results can be cached and only the necessary tests rerun, greatly reducing CI pipeline times and facilitating more accurate flaky test detection.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/0YxcxIR7QU0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Addressing flaky tests with test deflaking&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Flaky tests can be a significant bottleneck in the CI process. Nx tackles this issue head-on by intelligently &lt;a href="https://nx.dev/ci/features/flaky-tasks"&gt;re-running only the flaky tasks&lt;/a&gt;, rather than the entire pipeline. This approach not only saves time but also provides developers with more confidence in their CI pipeline's reliability. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm84osyn5mz4n0ut351w6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm84osyn5mz4n0ut351w6.png" alt="Flaky tests" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nx creates a hash of all the inputs for a task whenever it is run. If it encounters a task that fails with a particular set of inputs and then succeeds with those same inputs, Nx knows for a fact that the task is flaky. &lt;/p&gt;

&lt;h2&gt;
  
  
  New Nx features that tie in with our core speed improvements
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Module Federation
&lt;/h3&gt;

&lt;p&gt;With the help of Nx and the Module Federation setup that Nx offers, you can split up large Angular apps into smaller “vertical slices”. This can significantly speed up your builds and app startup time. Nx has revolutionized the use of Module Federation, especially in how static remotes are built and served. We make use of Nx’s task orchestration, allowing users to fine tune the number of builds happening in parallel to improve local startup time, manage machine resources better, allow for scaling.&lt;/p&gt;

&lt;h3&gt;
  
  
  First-Class Playwright support
&lt;/h3&gt;

&lt;p&gt;With first-class support for Playwright through &lt;strong&gt;&lt;code&gt;@nx/playwright&lt;/code&gt;&lt;/strong&gt;, Nx offers out-of-the-box generators to run Playwright tests efficiently. This integration is especially powerful with features like TaskAtomizer, enhancing the testing process's speed and reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Nx provides an unparalleled toolkit for developers and teams looking to optimize their development workflows, and we keep making it faster. By intelligently leveraging modern technologies and innovative optimizations, Nx delivers speed, efficiency, and reliability, allowing teams to focus on what matters most: building great software.&lt;/p&gt;




&lt;h2&gt;
  
  
  Learn more
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nx.dev"&gt;Nx Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/nxdevtools"&gt;X / Twitter&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/company/nrwl"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nrwl/nx"&gt;Nx GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://go.nx.dev/community"&gt;Nx Community Discord&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/@nxdevtools"&gt;Nx Youtube Channel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nx.app"&gt;Speed up your CI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag__tag ltag__tag__id__18643"&gt;
    &lt;div class="ltag__tag__content"&gt;
      &lt;h2&gt;#&lt;a href="https://dev.to/t/nx" class="ltag__tag__link"&gt;nx&lt;/a&gt; Follow
&lt;/h2&gt;
      &lt;div class="ltag__tag__summary"&gt;
        
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>nx</category>
      <category>nxdevtools</category>
      <category>speed</category>
      <category>ci</category>
    </item>
    <item>
      <title>Introducing @nx/nuxt: Enhanced Nuxt.js Support in Nx</title>
      <dc:creator>Katerina Skroumpelou</dc:creator>
      <pubDate>Tue, 06 Feb 2024 16:35:05 +0000</pubDate>
      <link>https://forem.com/nx/introducing-nxnuxt-enhanced-nuxtjs-support-in-nx-ai7</link>
      <guid>https://forem.com/nx/introducing-nxnuxt-enhanced-nuxtjs-support-in-nx-ai7</guid>
      <description>&lt;p&gt;We're excited to introduce a new way to enhance your &lt;a href="https://nuxt.com/"&gt;Nuxt&lt;/a&gt; development workflow! After the Vue plugin, we're introducing our new Nx plugin for Nuxt, &lt;code&gt;@nx/nuxt&lt;/code&gt;. Designed for Nuxt developers and existing Nx users alike, this integration brings the best of both worlds into your development ecosystem, enabling you to leverage Nx's powerful capabilities seamlessly within your Nuxt projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Consider Nx for Your Nuxt Projects?
&lt;/h2&gt;

&lt;p&gt;Using Nx with your Nuxt.js projects presents the following advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Monorepo Management&lt;/strong&gt;: Simplify the management of multiple projects within a single repository, facilitating code sharing and reducing overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modular Development&lt;/strong&gt;: Break down your Nuxt app into manageable, independent modules that can be developed, tested, and deployed in isolation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enhanced Caching&lt;/strong&gt;: Accelerate your development with Nx's intelligent caching, automatically configured for your Nuxt projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nx generators&lt;/strong&gt;: Nx provides generators for scaffolding new Nuxt applications, with support for Jest, Storybook, and e2e test generation with Cypress or Playwright.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated upgrades&lt;/strong&gt;: Nx offers a set of migrators that help you upgrade your projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting Started with Nx and Nuxt.js
&lt;/h2&gt;

&lt;p&gt;Whether you're initiating a new project or integrating into an existing one, &lt;code&gt;@nx/nuxt&lt;/code&gt; offers a straightforward setup process:&lt;/p&gt;

&lt;h3&gt;
  
  
  Starting a New Nx Workspace with Nuxt
&lt;/h3&gt;

&lt;p&gt;Creating a new Nx workspace optimized for Nuxt is as simple as running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-nx-workspace@latest --preset=nuxt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Our setup wizard will guide you through the initial configuration, ensuring your workspace is tailored to your needs:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-nx-workspace@latest

 &amp;gt;  NX   Let's create a new workspace [https://nx.dev/getting-started/intro]

✔ Where would you like to create your workspace? · my-org
✔ Which stack do you want to use? · vue
✔ What framework would you like to use? · nuxt
✔ Integrated monorepo, or standalone project? · integrated
✔ Application name · my-app
✔ Test runner to use for end to end (E2E) tests · playwright (also cypress)
✔ Default stylesheet format · scss (also css, less)
✔ Set up CI with caching, distribution and test deflaking · github
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This command will create a new Nx workspace with a single Nuxt application, complete with essential features and ready for development.&lt;/p&gt;
&lt;h2&gt;
  
  
  Enhancing an Existing Nuxt Project with Nx
&lt;/h2&gt;

&lt;p&gt;Integrating Nx into an existing Nuxt.js project has never been easier, with the help of the &lt;code&gt;nx init&lt;/code&gt; command. This command will add Nx to your project without the need to disrupt your current setup.&lt;/p&gt;
&lt;h3&gt;
  
  
  How It Works
&lt;/h3&gt;

&lt;p&gt;When you run &lt;code&gt;nx init&lt;/code&gt; in your existing Nuxt.js project, Nx does the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Installs @nx/nuxt&lt;/strong&gt;: Adds the necessary Nx and @nx/nuxt dependencies to your project, enabling Nx's features while keeping your existing setup intact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Understands Existing Configurations&lt;/strong&gt;: Nx automatically recognizes your nuxt.config.js or nuxt.config.ts file, ensuring that all your custom configurations, scripts, and commands are preserved and utilized.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimal Configuration&lt;/strong&gt;: Only a minimal &lt;code&gt;nx.json&lt;/code&gt; file is added to your project. This file is used to configure the &lt;code&gt;@nx/nuxt&lt;/code&gt; plugin if needed, but in most cases, your existing Nuxt.js configurations will suffice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To begin the integration process, simply navigate to the root of your existing Nuxt.js project and run:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx nx init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This approach offers several key benefits for teams looking to adopt Nx:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero Disruption&lt;/strong&gt;: Your project will continue to use its existing configurations, and the existing configuration entrypoint files. There's no need to learn new configuration syntaxes or reconfigure your project to start using Nx.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Immediate Value&lt;/strong&gt;: Instantly gain access to Nx's powerful developer tools and build system, without significant changes to your project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Future Flexibility&lt;/strong&gt;: As your project grows, Nx is ready to scale with you. You can gradually adopt more Nx features and plugins over time, at a pace that suits your team.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Using Nx to run your Nuxt app
&lt;/h2&gt;

&lt;p&gt;Nx scans your workspace to look for Nuxt configuration files (eg. &lt;code&gt;nuxt.config.ts&lt;/code&gt;). It uses these files to understand where your Nuxt projects live, and uses them to set up tasks that can be invoked through Nx, like &lt;code&gt;serve&lt;/code&gt; and &lt;code&gt;build&lt;/code&gt;. So, in your Nx workspace, you can then run:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nx serve my-nuxt-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nx build my-nuxt-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and these commands will call the &lt;code&gt;nuxt&lt;/code&gt; CLI under the hood, enhanced with Nx's features.&lt;/p&gt;

&lt;p&gt;You can see a visual representation of your task dependencies by running&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nx graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s2JDXfSA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgur.com/gLex9co.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s2JDXfSA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgur.com/gLex9co.png" alt="Task graph - build" width="800" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also see how Nx configures your tasks, by running:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nx show project my-nuxt-app --web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qlebSKat--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgur.com/eA56wHy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qlebSKat--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgur.com/eA56wHy.png" alt="Project details" width="800" height="547"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XqBG8tIv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgur.com/RF7e2rj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XqBG8tIv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgur.com/RF7e2rj.png" alt="Project details - individual task details" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Using Nx Console
&lt;/h3&gt;

&lt;p&gt;You get access to all these features through our VSCode and WebStorm &lt;a href="https://nx.dev/features/integrate-with-editors"&gt;Nx Console extension&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can use Nx Console to visualize tasks, and understand where each inferred task (like &lt;code&gt;build&lt;/code&gt; and &lt;code&gt;serve&lt;/code&gt; in Nuxt's case) is coming from, with our codelens-like feature, as an alternative to the &lt;code&gt;--web&lt;/code&gt; flag on the &lt;code&gt;nx show project&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;Nx Console is also very convenient for generating code and running tasks, since it offers a graphical user interface for all the amazing features of the Nx CLI.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Does Nx Bring to Your Nuxt Development?
&lt;/h2&gt;

&lt;p&gt;With &lt;code&gt;@nx/nuxt&lt;/code&gt;, your Nuxt projects gain automatic recognition of &lt;code&gt;build&lt;/code&gt; and &lt;code&gt;serve&lt;/code&gt; processes. There's no need to deal with unfamiliar configurations; Nx intuitively understands your Nuxt project structure and optimizes accordingly.&lt;/p&gt;
&lt;h3&gt;
  
  
  Modularize and Scale with Ease
&lt;/h3&gt;

&lt;p&gt;One of the most compelling aspects of using Nx with Nuxt.js is the ability to modularize large applications into manageable libraries or components. This not only makes your codebase more organized and maintainable but also significantly enhances your development workflow and CI processes.&lt;/p&gt;
&lt;h4&gt;
  
  
  Breaking Down a Monolithic Nuxt App
&lt;/h4&gt;

&lt;p&gt;Large Nuxt applications can become challenging to maintain and scale over time. By adopting Nx, you can structure your Nuxt app as a collection of smaller, focused libraries. Each library can encapsulate specific functionalities or features, such as UI components, utilities, or business logic.&lt;/p&gt;
&lt;h4&gt;
  
  
  Independent Development and Testing
&lt;/h4&gt;

&lt;p&gt;This modular structure allows teams to work on different aspects of the application in parallel, reducing bottlenecks and improving collaboration. Furthermore, you can run tests, linters, and other checks independently for each library, making your development process more efficient and targeted.&lt;/p&gt;

&lt;p&gt;For instance, if you want to create a new Vue UI library, you can use the following command:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nx generate @nx/vue:lib my-shared-ui
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This command creates a my-shared-ui library within your workspace, which can then be used across your Nuxt app and potentially other applications within the same workspace.&lt;/p&gt;
&lt;h4&gt;
  
  
  Enhancing CI with Modular Builds
&lt;/h4&gt;

&lt;p&gt;On the CI front, Nx's modular approach makes things much faster. You can configure your CI pipeline to build, test, and deploy only the affected libraries and applications, thanks to Nx's advanced dependency graph analysis. This results in faster CI runs and more efficient resource utilization.&lt;/p&gt;
&lt;h4&gt;
  
  
  Sharing Code Between Applications
&lt;/h4&gt;

&lt;p&gt;Nx's workspace model facilitates code sharing between projects, which is particularly useful in monorepos containing multiple front-end projects. With Nx, sharing UI components, utilities, or services between these applications becomes straightforward.&lt;br&gt;
To share code, simply import the library into your Nuxt and Vue applications as needed. Nx takes care of the rest, ensuring that dependencies are correctly managed and that your applications remain buildable and testable.&lt;/p&gt;

&lt;p&gt;Imagine a scenario where your workspace contains a Nuxt application for your public-facing website and a Vue application for an internal tool. You can create a shared library for common UI components, such as buttons, inputs, and modals, and use these components in both applications. This not only reduces duplication but also ensures consistency across your projects.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Importing a shared UI component in your Nuxt app
import { MyButton } from '@my-org/my-shared-ui';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Importing the same component in your Vue app
import { MyButton } from '@my-org/my-shared-ui';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Visualizing Your Project Structure
&lt;/h3&gt;

&lt;p&gt;Nx provides a clear overview of your project's structure and dependencies, making it easier to manage complex applications. The Nx Console extension for VSCode, for instance, offers a graphical interface to visualize and run tasks, enhancing your development experience.&lt;/p&gt;

&lt;p&gt;In your workspace, you can run&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nx graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;and see the structure of your projects:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D2YCTaiV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgur.com/igflZRF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D2YCTaiV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imgur.com/igflZRF.png" alt="A project graph" width="800" height="655"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Embracing Nx in Your Nuxt Journey
&lt;/h2&gt;

&lt;p&gt;Whether you're starting a new Nuxt project or looking to enhance an existing one, Nx offers a compelling set of tools and features to streamline your development process. From modularization to caching, the integration of Nx into your Nuxt projects promises a more efficient, scalable, and enjoyable development experience. By embracing Nx's capabilities in your Nuxt development, you're not just optimizing your current workflow; you're future-proofing your development process. As your projects grow and evolve, Nx's modular architecture and powerful tooling will continue to provide value, making your development experience more enjoyable and productive.&lt;/p&gt;


&lt;h2&gt;
  
  
  Learn more
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://nx.dev"&gt;Nx Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/nxdevtools"&gt;X / Twitter&lt;/a&gt; - &lt;a href="https://www.linkedin.com/company/nrwl"&gt;LinkedIn&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nrwl/nx"&gt;Nx GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://go.nx.dev/community"&gt;Nx Community Discord&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/@nxdevtools"&gt;Nx Youtube Channel&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nx.app"&gt;Speed up your CI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag__tag ltag__tag__id__18643"&gt;
    &lt;div class="ltag__tag__content"&gt;
      &lt;h2&gt;#&lt;a href="https://dev.to/t/nx" class="ltag__tag__link"&gt;nx&lt;/a&gt; Follow
&lt;/h2&gt;
      &lt;div class="ltag__tag__summary"&gt;
        
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>devtools</category>
      <category>javascript</category>
      <category>monorepos</category>
      <category>nuxt</category>
    </item>
    <item>
      <title>Storybook Interaction Tests in Nx</title>
      <dc:creator>Katerina Skroumpelou</dc:creator>
      <pubDate>Thu, 03 Aug 2023 15:20:27 +0000</pubDate>
      <link>https://forem.com/nx/storybook-interaction-tests-in-nx-16ja</link>
      <guid>https://forem.com/nx/storybook-interaction-tests-in-nx-16ja</guid>
      <description>&lt;p&gt;In Nx 16.6 we are introducing our new generators for &lt;a href="https://storybook.js.org/docs/react/writing-tests/interaction-testing"&gt;Storybook interaction tests&lt;/a&gt;! These new generators replace the default Cypress tests we used to generate along with a project’s Storybook configuration, particularly for those already using Storybook. The intention is that if a user chooses to use Storybook and generate Storybook configuration, to integrate in that experience Storybook Interaction testing, and skip generating Cypress tests, to keep everything in one place, in an integrated experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Storybook Interaction Tests
&lt;/h2&gt;

&lt;p&gt;Interaction tests allow users to verify the functional aspects of UIs. This is done by supplying the initial state of a component, simulating user behavior such as clicks and form entries, and finally checking if the UI and component state update correctly​. Very much like e2e tests are doing.&lt;br&gt;
In Storybook, this workflow occurs in your browser, which makes it easier to debug failures since you’re running tests in the same environment you develop components.&lt;/p&gt;
&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;You write a story to set up the component’s initial state, simulate user behavior using the &lt;a href="https://storybook.js.org/docs/react/writing-stories/play-function"&gt;play function&lt;/a&gt;, and then use the &lt;a href="https://storybook.js.org/docs/react/writing-tests/test-runner"&gt;test runner&lt;/a&gt; to confirm that the component renders correctly and that your interaction tests with the play function pass​. &lt;a href="https://storybook.js.org/docs/react/writing-tests/test-runner"&gt;Storybook’s Test runner&lt;/a&gt; is a standalone utility — powered by Jest and Playwright — that executes all of your interaction tests, and runs parallel to your Storybook.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting Up Storybook Interaction Tests on Nx
&lt;/h2&gt;

&lt;p&gt;You can read our detailed guide on how to set up Storybook interaction tests on Nx, here: &lt;a href="https://nx.dev/packages/storybook/documents/storybook-interaction-tests"&gt;https://nx.dev/packages/storybook/documents/storybook-interaction-tests&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Writing Interaction Tests in Storybook
&lt;/h2&gt;

&lt;p&gt;An interaction test is defined inside a play function connected to a story. The story simulates the user’s behavior once it loads in the UI and verifies the underlying logic​.&lt;br&gt;
Under the hood, Storybook’s &lt;a href="https://storybook.js.org/addons/@storybook/addon-interactions"&gt;@storybook/addon-interactions&lt;/a&gt; mirrors &lt;a href="https://testing-library.com/"&gt;Testing Library&lt;/a&gt;’s user-events API. So, you can use the same queries and assertions that you would use for Testing Library, like we already do with our unit tests.&lt;br&gt;
For complex flows, it can be worthwhile to group sets of related interactions using the step function. This allows you to provide a custom label that describes a set of interactions.&lt;/p&gt;
&lt;h2&gt;
  
  
  Debugging and Reproducing Errors
&lt;/h2&gt;

&lt;p&gt;Storybook provides an interactive debugger that displays the step-by-step flow of your interactions, and provides UI controls to pause, resume, rewind, and step through each interaction​.&lt;/p&gt;

&lt;p&gt;If an error occurs during a story’s play function, it’ll be shown in the interaction addon panel to help with debugging. And since Storybook is a web app, anyone with the URL can reproduce the error with the same detailed information without any additional environment configuration or tooling required​.&lt;/p&gt;
&lt;h2&gt;
  
  
  Executing and Automating Tests
&lt;/h2&gt;

&lt;p&gt;Storybook only runs the interaction test when you’re viewing a story. Therefore, as a Storybook grows, it becomes unrealistic to review each change manually. The Storybook test-runner automates the process by running all tests for you. This can be executed via the command line or on CI environment​.&lt;/p&gt;
&lt;h2&gt;
  
  
  What should I choose? Interaction tests or E2E tests?
&lt;/h2&gt;

&lt;p&gt;Setting up interaction tests with Nx and Storybook provides an extra layer of confidence in the functionality of your components. It ensures that they not only look right but also behave correctly in response to user interactions.&lt;br&gt;
Storybook interaction tests provide a unique advantage over traditional e2e tests, especially when considering the development setup. With Storybook already in place, you essentially have a controlled environment set up for each of your components. This allows you to write interaction tests almost immediately, without the overhead of setting up and navigating through a full application environment, as is the case with e2e tests.&lt;br&gt;
Moreover, since Storybook isolates each component, you can ensure that the tests are solely focused on individual component behavior rather than application-level concerns. This results in faster test execution, easier debugging, and more granular feedback during the development process. In essence, with Storybook’s interaction tests, you get many of the benefits of e2e tests but with a setup that’s quicker, more focused, and integrated right into your component development workflow.&lt;/p&gt;
&lt;h2&gt;
  
  
  Useful Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://storybook.js.org/docs/react/writing-tests/interaction-testing"&gt;https://storybook.js.org/docs/react/writing-tests/interaction-testing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nx.dev/packages/storybook/documents/storybook-interaction-tests"&gt;https://nx.dev/packages/storybook/documents/storybook-interaction-tests&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Learn more
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;🧠 &lt;a href="https://nx.dev"&gt;Nx Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;👩‍💻 &lt;a href="https://github.com/nrwl/nx"&gt;Nx GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;💬 &lt;a href="https://go.nrwl.io/join-slack"&gt;Nx Community Slack&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;📹 &lt;a href="https://www.youtube.com/@nxdevtools"&gt;Nx Youtube Channel&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;🚀 &lt;a href="https://nx.app"&gt;Speed up your CI&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, if you liked this, click the ❤️ and make sure to follow &lt;a href="https://twitter.com/psybercity"&gt;Katerina&lt;/a&gt; and &lt;a href="https://twitter.com/nxdevtools"&gt;Nx&lt;/a&gt; on Twitter for more!&lt;/p&gt;


&lt;div class="ltag__tag ltag__tag__id__18643"&gt;
    &lt;div class="ltag__tag__content"&gt;
      &lt;h2&gt;#&lt;a href="https://dev.to/t/nx" class="ltag__tag__link"&gt;nx&lt;/a&gt; Follow
&lt;/h2&gt;
      &lt;div class="ltag__tag__summary"&gt;
        
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>nx</category>
      <category>storybook</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
