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

Webiny CLI - Improving System Requirements Checks #4448

Merged
merged 27 commits into from
Jan 9, 2025
Merged

Conversation

adrians5j
Copy link
Member

@adrians5j adrians5j commented Dec 13, 2024

Changes

With this PR, we're centralizing the system requirements checks. By "system requirements checks", we mean checks that ensure proper versions of tools are installed on user's machine:

  • Node.js
  • NPM
  • NPX
  • Yarn

Prior to this PR, these checks were implemented in a couple of places (copy/pasted), making it hard when it comes to maintenance. For example, both create-webiny-project and @webiny/cli packages had their own sys reqs checking-related code.

We've centralized this via a separate @webiny/system-requirements package, which not only performs the checks, but also contains the constraints.json file, which is now a single source of truth when it comes to the required versions of tools Webiny relies on:

{
  "npm": ">=10",
  "npx": ">=10",
  "yarn": ">=1.22.21 || >=3",
  "node": ">=20"
}

With this in place, whenever we end up in a situation where we need to change these, we can just go into this file, and both create-webiny-project and @webiny/cli will start respecting the new requirements.

In the future, we might even rely on this file in other places (like in docs, or in our README.md file), in order to display the system requirements and keep them up to date (we've had cases where there was a mismatch between what was in our docs, and what was actually in the code).

Additional Changes

1. Improved Reporting

In case a system requirement is not satisfied, we now show a full report of which system requirements are in order, and which are not.

image

2. Removed Duplicate Code

As mentioned, we've removed multiple instances of code that was performing the system requirements checks. We've also utilized the SystemRequirements class and its static methods like getNodeVersion to retrieve currently installed versions upon running the webiny about command.

How Has This Been Tested?

Manually.

Documentation

Maybe changelog.

@adrians5j adrians5j changed the title Adrian/check node v Webiny CLI - Throw An Error If Invalid Node Version Used Dec 13, 2024
@webiny-bot webiny-bot added this to the 5.41.4 milestone Dec 13, 2024
@adrians5j adrians5j changed the title Webiny CLI - Throw An Error If Invalid Node Version Used Webiny CLI - Throw An Error If An Invalid Node Version Is Used Dec 13, 2024
@adrians5j adrians5j changed the title Webiny CLI - Throw An Error If An Invalid Node Version Is Used Webiny CLI - Throw An Error If An Unsupported Node Version Is Used Dec 13, 2024
@adrians5j adrians5j modified the milestones: 5.41.4, 5.41.5 Dec 19, 2024
@adrians5j adrians5j changed the title Webiny CLI - Throw An Error If An Unsupported Node Version Is Used Centralized System Requirements Checks Dec 31, 2024
@adrians5j adrians5j changed the title Centralized System Requirements Checks Improving the System Requirements Checks Dec 31, 2024
@adrians5j adrians5j changed the title Improving the System Requirements Checks Improving System Requirements Checks Dec 31, 2024
@adrians5j adrians5j changed the title Improving System Requirements Checks Webiny CLI - Improving System Requirements Checks Dec 31, 2024
@adrians5j adrians5j changed the base branch from dev to next January 8, 2025 06:06
…heck-node-v

# Conflicts:
#	packages/api-prerendering-service/src/render/renderUrl.ts
#	packages/app-page-builder-elements/src/hooks/useLoader.ts
#	packages/app-page-builder/src/PageBuilder.tsx
#	packages/cli/cli.js
#	packages/create-webiny-project/bin.js
#	yarn.lock
@adrians5j adrians5j modified the milestones: 5.41.5, 5.42.0 Jan 8, 2025
@adrians5j
Copy link
Member Author

/cypress

Copy link

github-actions bot commented Jan 8, 2025

Cypress E2E tests have been initiated (for more information, click here). ✨

@adrians5j adrians5j marked this pull request as ready for review January 8, 2025 12:19
@adrians5j adrians5j merged commit 2eb1183 into next Jan 9, 2025
18 checks passed
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 this pull request may close these issues.

3 participants