From 39648ffced1af9a65e01913c5ac3f4f8b175726e Mon Sep 17 00:00:00 2001 From: MariaAga Date: Thu, 1 Feb 2024 14:05:45 +0100 Subject: [PATCH] Fixes #37134 - upgrade to node 18 and npm 8 --- .github/matrix.json | 2 +- .github/workflows/plugins_react_tests.yml | 4 ++-- .npmrc | 1 + Dockerfile | 2 +- developer_docs/foreman_dev_setup.asciidoc | 7 ++----- package.json | 2 +- .../common/dates/__snapshots__/LongDateTime.test.js.snap | 6 +++--- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/matrix.json b/.github/matrix.json index f15a18dd6920..17b4f64b7209 100644 --- a/.github/matrix.json +++ b/.github/matrix.json @@ -1,5 +1,5 @@ { "postgresql": ["12"], "ruby": ["2.7", "3.0"], - "node": ["14"] + "node": ["18"] } diff --git a/.github/workflows/plugins_react_tests.yml b/.github/workflows/plugins_react_tests.yml index 09615b630b27..7d0f7184b7cb 100644 --- a/.github/workflows/plugins_react_tests.yml +++ b/.github/workflows/plugins_react_tests.yml @@ -66,10 +66,10 @@ jobs: repository: ${{ matrix.plugin }} path: ${{ github.workspace }}/projects/plugin - name: Generate ${{ matrix.plugin }} npm dependencies package-lock - run: npm install --package-lock-only --no-audit + run: npm install --package-lock-only --no-audit --legacy-peer-deps working-directory: ${{ github.workspace }}/projects/plugin - name: Install ${{ matrix.plugin }} npm dependencies - run: npm ci --no-audit + run: npm ci --no-audit --legacy-peer-deps working-directory: ${{ github.workspace }}/projects/plugin - name: Run ${{ matrix.plugin }} tests run: npm test diff --git a/.npmrc b/.npmrc index b6f27f135954..d5831dd51888 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ engine-strict=true +legacy-peer-deps=true diff --git a/Dockerfile b/Dockerfile index b5e8fe1571dc..83c4ac1b7714 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Base container that is used for both building and running the app FROM quay.io/centos/centos:stream8 as base ARG RUBY_VERSION="2.7" -ARG NODEJS_VERSION="14" +ARG NODEJS_VERSION="18" ENV FOREMAN_FQDN=foreman.example.com ENV FOREMAN_DOMAIN=example.com diff --git a/developer_docs/foreman_dev_setup.asciidoc b/developer_docs/foreman_dev_setup.asciidoc index 70b9e4894d94..c81c2863f31f 100644 --- a/developer_docs/foreman_dev_setup.asciidoc +++ b/developer_docs/foreman_dev_setup.asciidoc @@ -5,12 +5,9 @@ [[prerequisites]] == Prerequisites -Foreman will run with the following requirements (aside from rubygem dependencies): +Please refer to the `.github/matrix.json` file in the project repository to find the latest supported versions for Ruby, NodeJS, and PostgreSQL. This file is regularly updated to reflect our current support. -* Ruby 2.7.x -* NodeJS 14 -* NPM 6.x -* PostgreSQL 13 +If you're using NPM version 7.x or higher, you will need to use the `--legacy-peer-deps` flag when installing npm packages. This is due to changes in how NPM handles peer dependencies from version 7 onwards. It’s recommended to install https://github.com/rbenv/rbenv[rbenv] or https://github.com/rvm/rvm[rvm] to manage ruby, and https://github.com/nvm-sh/nvm[nvm] to manage node and npm on your system. * For Fedora users, you can use this https://developer.fedoraproject.org/start/sw/web-app/rails.html[guide] for installing: rbenv, Ruby & Bundler. diff --git a/package.json b/package.json index 869e990447b0..006cb3f13892 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "Foreman isn't really a node module, these are just dependencies needed to build the webpack bundle. 'dependencies' are the asset libraries in use and 'devDependencies' are used for the build process.", "private": true, "engines": { - "node": ">14.0.0 <16.0.0" + "node": ">=18.0.0 <21.0.0" }, "scripts": { "lint": "tfm-lint", diff --git a/webpack/assets/javascripts/react_app/components/common/dates/__snapshots__/LongDateTime.test.js.snap b/webpack/assets/javascripts/react_app/components/common/dates/__snapshots__/LongDateTime.test.js.snap index 62a6f38960de..404d7f01a0c3 100644 --- a/webpack/assets/javascripts/react_app/components/common/dates/__snapshots__/LongDateTime.test.js.snap +++ b/webpack/assets/javascripts/react_app/components/common/dates/__snapshots__/LongDateTime.test.js.snap @@ -17,7 +17,7 @@ exports[`LongDateTime formats date 1`] = ` year="numeric" > - October 13, 2017, 11:54 AM + October 13, 2017 at 11:54 AM @@ -43,7 +43,7 @@ exports[`LongDateTime formats date with relative tooltip 1`] = ` year="numeric" > - October 13, 2017, 11:54 AM + October 13, 2017 at 11:54 AM @@ -68,7 +68,7 @@ exports[`LongDateTime formats date with seconds 1`] = ` year="numeric" > - October 13, 2017, 11:54:55 AM + October 13, 2017 at 11:54:55 AM