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

fix(deps): upgrade @dhis2/cli-app-scripts for peer deps fixes [LIBS-578] #624

Merged
merged 3 commits into from
Jul 4, 2024

Conversation

KaiVandivier
Copy link
Contributor

@KaiVandivier KaiVandivier commented Apr 9, 2024

Fixes LIBS-578

Fixes peer dependency conflicts that were causing infinite loops when usingnpm v7+ to install the d2 cli. Can be tested using the latest alpha version of @dhis2/cli:

npm i -g @dhis2/cli

Note: this constitutes a breaking change, since the minimum Node version will now be 16
Update: this change did not introduce the Node 14 incompatibility; it was actually present previously with cli-app-scripts. For that reason... I think a major version bump isn't necessary, but it's a bit awkward that a breaking change has happened outside of our control.

A quick summary: When running d2 app scripts init on Node 14, this error breaks the installation:

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=16.0.0". Got "14.21.3"
error Found incompatible module.

What's happening: A broken version of workbox-webpack-plugin ("wwp" for short, from here on) was released as a feature (v6.6.0/v6.6.1) that breaks Node 14 compatibility. @dhis2/cli-app-scripts depends on react-scripts which depends on wwp@^6.4.1, so when @dhis2/cli-app-scripts gets installed, the wwp version resolves to the broken 6.6.1 and causes a failed installation on Node 14.

This affects @dhis2/cli-app-scripts down to v7.6.0, due its own workbox dependency, but now react-scripts also has that dependency since @dhis2/cli-app-scripts v10, and that dependency of a dependency is now a bit out of cli-app-scripts's control to fix as far as I can tell.

A workaround for consuming apps of @dhis2/cli-app-scripts is to add a resolution field on "workbox-webpack-plugin": "6.5.4" exactly.

To patch d2 app scripts init, the created package.json in the bootstrapped app could come with that resolution field already.

However,

...since we're moving to Vite soon, Vite will already increase the minimum supported Node version to 18+, so maybe this issue with workbox isn't worth fussing over.

@KaiVandivier KaiVandivier force-pushed the libs-587-upgrade-cli-app-scripts branch from dee0315 to fa88633 Compare April 9, 2024 19:15
@KaiVandivier KaiVandivier force-pushed the libs-587-upgrade-cli-app-scripts branch from fa88633 to c3727c3 Compare April 16, 2024 10:56
@KaiVandivier KaiVandivier enabled auto-merge (squash) July 4, 2024 15:25
@KaiVandivier KaiVandivier merged commit 02ce484 into master Jul 4, 2024
5 checks passed
@KaiVandivier KaiVandivier deleted the libs-587-upgrade-cli-app-scripts branch July 4, 2024 15:28
dhis2-bot added a commit that referenced this pull request Jul 4, 2024
## [4.2.5](v4.2.4...v4.2.5) (2024-07-04)

### Bug Fixes

* **deps:** upgrade @dhis2/cli-app-scripts for peer deps fixes [LIBS-578] ([#624](#624)) ([02ce484](02ce484))
@dhis2-bot
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants