Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition from Nx to wireit #1310

Closed
3 tasks done
sndrs opened this issue Mar 26, 2024 · 0 comments · Fixed by #1386
Closed
3 tasks done

Transition from Nx to wireit #1310

sndrs opened this issue Mar 26, 2024 · 0 comments · Fixed by #1386
Assignees

Comments

@sndrs
Copy link
Member

sndrs commented Mar 26, 2024

Nx does a lot more than we need it for, and there's a feeling that this is weighing down on maintenance and cognitive load for new devs.

Wireit provides a much lighter-weight option for defining cross-task dependency and output caching – the two things we use Nx for.

We will try incrementally swapping out Nx for wireit in the various corners of the repo, starting with the lowest impact areas (e.g. github pages) and working up the biggest (e.g. publishing source).

This way, if it works well, we'll end up removing Nx as we see the benefit. If it doesn't, we can revert the changes.

Using Nx to run repo-wide tasks, for now

Because Nx will try to run matching npm-scripts if it can't find a task in the Nx project.json, we can keep using Nx to run the new wireit tasks while Nx is still set up to handle repo-wide tasks and some project-specific tasks.

For example, once github-pages is using wireit, running make github-pages:build can still call pnpm nx run github-pages:build. Since there's no actual build task in the project.json, Nx itself will run pnpm build in the github-pages project dir (starting the wireit task).

This reduces the amount of change we need to make each time while making it easier to revert to full Nx if we need to.

If/when we decide to remove Nx, updating everything to run the npm-scripts directly will be the last step.

Tip

Use a W!RE!T comment to leave inline instructions along the way that will help with any final switch over, e.g.

// W!RE!T
// 1. remove the next line 
const someNxConfig = {}
// 2. uncomment this line
// const someWireitConfig = {}

Tasks

  1. run_chromatic 📦 npm 🛠 workspace
  2. run_chromatic
  3. @guardian/ab-core @guardian/ab-react @guardian/browserslist-config @guardian/eslint-config @guardian/eslint-config-typescript @guardian/libs @guardian/prettier @guardian/tsconfig run_chromatic 📦 npm 🛠 workspace
@sndrs sndrs changed the title Add wireit alongside Nx Spike moving from Nx to wireit Mar 28, 2024
@sndrs sndrs self-assigned this Mar 28, 2024
@sndrs sndrs changed the title Spike moving from Nx to wireit Transition from Nx to wireit Apr 4, 2024
@sndrs sndrs linked a pull request May 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant