nrwl / nx-labs

A collection of Nx plugins
MIT License
130 stars 48 forks source link

feat(nx-ignore): use slim installation on Netlify to avoid script timeout #393

Closed jaysoo closed 2 months ago

jaysoo commented 2 months ago

Netlify deployments currently has two problems:

  1. npm packages are not installed prior to calling npx nx-ignore.
  2. There is a three minute limit for the ignore script.

For Nx plugins that infer targets from config files, we should do a full installation to ensure packages used by config files are present. Otherwise errors like missing @playwright/test or next/constants will occur. On Vercel, this works fine because there isn't a limit to the ignore script (at least it is reasonable long). On Netlify, the three minute limit for ignore script means full installation will almost always fail.

The fix for this issue is to detect whether we're on Netlify or not (checking NETLIFY env var). If we're on Netlify, then perform a slim installation. And to make it more compatible with Project Crystal, we will install known packages that are used in config files (if they are in the root package.json). Users can also manually pass --additional-packages option if we miss a package.

Note: On the ocean repo, nx-ignore goes from 145s to 23s on my local machine.

nx-cloud[bot] commented 2 months ago

☁️ Nx Cloud Report

⚠️ Important: This organization may reach the limit of the FREE Plan and could be disabled at the end of the month. If this happens, remote caching and distributed task execution will no longer work. Your CI may stop working.

CI is running/has finished running commands for commit 9968cdc77052aa32192940c1a657a22d620754e2. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 4 targets - [`nx affected --target=e2e --parallel --max-parallel=1 --exclude=nx-ignore-e2e`](https://cloud.nx.app/runs/OoxI46r05M?utm_source=pull-request&utm_medium=comment) - [`nx affected --target=test --parallel --max-parallel=2`](https://cloud.nx.app/runs/tckg9rycqn?utm_source=pull-request&utm_medium=comment) - [`nx affected --target=build --parallel --max-parallel=3`](https://cloud.nx.app/runs/zk3DcmF6Ex?utm_source=pull-request&utm_medium=comment) - [`nx affected --target=lint --parallel --max-parallel=3`](https://cloud.nx.app/runs/1oHfkpEs5t?utm_source=pull-request&utm_medium=comment)

Sent with 💌 from NxCloud.