Skip to content

Commit 3e684a5

Browse files
committed
increase node requirements
1 parent 3943a17 commit 3e684a5

6 files changed

Lines changed: 31 additions & 12 deletions

File tree

.ddev/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ web_environment:
2222
- MATOMO_DATABASE_USERNAME=db
2323
- MATOMO_DATABASE_PASSWORD=db
2424
- MATOMO_DATABASE_DBNAME=db
25-
nodejs_version: "16"
25+
nodejs_version: "20"
2626
corepack_enable: true
2727
disable_upload_dirs_warning: true
2828

.github/workflows/buildvue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
- name: Setup node
7474
uses: actions/setup-node@v6
7575
with:
76-
node-version: '16'
76+
node-version: '20'
7777
cache: 'npm'
7878
if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
7979
- run: npm install

.github/workflows/matomo-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
with:
114114
test-type: 'JS'
115115
php-version: '7.2'
116-
node-version: '12'
116+
node-version: '20'
117117
Client:
118118
runs-on: ubuntu-24.04
119119
timeout-minutes: 15
@@ -129,7 +129,7 @@ jobs:
129129
uses: matomo-org/github-action-tests@main
130130
with:
131131
test-type: 'Client'
132-
node-version: '16'
132+
node-version: '20'
133133
mysql-service: false
134134
UI:
135135
runs-on: ubuntu-24.04
@@ -151,7 +151,7 @@ jobs:
151151
ui-test-options: '--num-test-groups=4 --test-group=${{ matrix.parts }}'
152152
test-type: 'UI'
153153
php-version: '7.2'
154-
node-version: '16'
154+
node-version: '20'
155155
redis-service: true
156156
artifacts-pass: ${{ secrets.ARTIFACTS_PASS }}
157157
upload-artifacts: true

.github/workflows/run-single-ui-test-suite.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
ui-test-options: '${{ inputs.test_suite_name }}'
4848
test-type: 'UI'
4949
php-version: '7.2'
50-
node-version: '16'
50+
node-version: '20'
5151
redis-service: true
5252
artifacts-pass: ${{ secrets.ARTIFACTS_PASS }}
53-
upload-artifacts: true
53+
upload-artifacts: true

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
},
2929
"homepage": "https://github.com/matomo-org/matomo#readme",
3030
"engines": {
31-
"node": ">=16.0.0 <17.0.0"
31+
"node": ">=20.0.0 <21.0.0",
32+
"npm": ">=10.0.0"
3233
},
3334
"dependencies": {
3435
"@materializecss/materialize": "^1.1.0",

plugins/CoreVue/Commands/Build.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
class Build extends ConsoleCommand
2020
{
21-
public const RECOMMENDED_NODE_VERSION = '16.0.0';
22-
public const RECOMMENDED_NPM_VERSION = '7.0.0';
21+
public const RECOMMENDED_NODE_VERSION = '20.0.0';
22+
public const RECOMMENDED_NPM_VERSION = '10.0.0';
2323
public const RETRY_COUNT = 2;
2424

2525
protected function configure()
@@ -127,10 +127,12 @@ private function build(array $plugins, bool $printBuildCommand, array $allPlugin
127127

128128
private function watch(array $plugins, bool $printBuildCommand, array $allPluginNames): void
129129
{
130+
$nodeCompatibilityEnv = $this->getNodeCompatibilityEnv();
131+
130132
$commandSingle = 'cd ' . PIWIK_INCLUDE_PATH . ' && '
131133
. "BROWSERSLIST_IGNORE_OLD_DATA=1 FORCE_COLOR=1 MATOMO_CURRENT_PLUGIN=%2\$s "
132134
. 'MATOMO_ALL_PLUGINS=' . implode(',', $allPluginNames) . ' '
133-
. 'node ' . self::getVueCliServiceProxyBin() . ' build --mode=development --target lib --name '
135+
. $nodeCompatibilityEnv . 'node ' . self::getVueCliServiceProxyBin() . ' build --mode=development --target lib --name '
134136
. "%1\$s --filename=%1\$s.development --no-clean %2\$s/vue/src/index.ts --dest %2\$s/vue/dist --watch &";
135137

136138
$command = '';
@@ -151,11 +153,12 @@ private function buildFiles(string $plugin, bool $printBuildCommand, array $allP
151153
{
152154
$output = $this->getOutput();
153155
$pluginDirPath = Manager::getRelativePluginDirectory($plugin);
156+
$nodeCompatibilityEnv = $this->getNodeCompatibilityEnv();
154157

155158
$command = 'cd ' . PIWIK_INCLUDE_PATH . ' && '
156159
. "BROWSERSLIST_IGNORE_OLD_DATA=1 FORCE_COLOR=1 MATOMO_CURRENT_PLUGIN=$pluginDirPath "
157160
. 'MATOMO_ALL_PLUGINS=' . implode(',', $allPluginNames) . ' '
158-
. 'node ' . self::getVueCliServiceProxyBin() . ' build --target lib --name ' . $plugin
161+
. $nodeCompatibilityEnv . 'node ' . self::getVueCliServiceProxyBin() . ' build --target lib --name ' . $plugin
159162
. " $pluginDirPath/vue/src/index.ts --dest $pluginDirPath/vue/dist";
160163

161164
if ($printBuildCommand) {
@@ -292,6 +295,21 @@ private function checkNodeJsVersion(): void
292295
}
293296
}
294297

298+
private function getNodeCompatibilityEnv(): string
299+
{
300+
$nodeVersion = ltrim(trim(`node -v`), 'v');
301+
if (version_compare($nodeVersion, '17.0.0', '<')) {
302+
return '';
303+
}
304+
305+
$nodeOptions = getenv('NODE_OPTIONS') ?: '';
306+
if (strpos($nodeOptions, '--openssl-legacy-provider') === false) {
307+
$nodeOptions = trim($nodeOptions . ' --openssl-legacy-provider');
308+
}
309+
310+
return 'NODE_OPTIONS=' . escapeshellarg($nodeOptions) . ' ';
311+
}
312+
295313
private function isTypeScriptRaceConditionInOutput(string $plugin, string $concattedOutput): bool
296314
{
297315
// Console output can contain ANSI escape sequences; remove them first to make regex matching stable.

0 commit comments

Comments
 (0)