Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ddev/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ web_environment:
- MATOMO_DATABASE_USERNAME=db
- MATOMO_DATABASE_PASSWORD=db
- MATOMO_DATABASE_DBNAME=db
nodejs_version: "16"
nodejs_version: "20"
corepack_enable: true
disable_upload_dirs_warning: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildvue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: '16'
node-version: '20'
cache: 'npm'
if: steps.vars.outputs.branch != '' && steps.vuecheck.outputs.vue_modified == '1'
- run: npm install
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/matomo-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
with:
test-type: 'JS'
php-version: '7.2'
node-version: '12'
node-version: '20'
Client:
runs-on: ubuntu-24.04
timeout-minutes: 15
Expand All @@ -129,7 +129,7 @@ jobs:
uses: matomo-org/github-action-tests@main
with:
test-type: 'Client'
node-version: '16'
node-version: '20'
mysql-service: false
UI:
runs-on: ubuntu-24.04
Expand All @@ -151,7 +151,7 @@ jobs:
ui-test-options: '--num-test-groups=4 --test-group=${{ matrix.parts }}'
test-type: 'UI'
php-version: '7.2'
node-version: '16'
node-version: '20'
redis-service: true
artifacts-pass: ${{ secrets.ARTIFACTS_PASS }}
upload-artifacts: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-single-ui-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
ui-test-options: '${{ inputs.test_suite_name }}'
test-type: 'UI'
php-version: '7.2'
node-version: '16'
node-version: '20'
redis-service: true
artifacts-pass: ${{ secrets.ARTIFACTS_PASS }}
upload-artifacts: true
upload-artifacts: true
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
},
"homepage": "https://github.com/matomo-org/matomo#readme",
"engines": {
"node": ">=16.0.0 <17.0.0"
"node": ">=20.0.0 <21.0.0",
"npm": ">=10.0.0"
},
"dependencies": {
"@materializecss/materialize": "^1.1.0",
Expand Down
26 changes: 22 additions & 4 deletions plugins/CoreVue/Commands/Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

class Build extends ConsoleCommand
{
public const RECOMMENDED_NODE_VERSION = '16.0.0';
public const RECOMMENDED_NPM_VERSION = '7.0.0';
public const RECOMMENDED_NODE_VERSION = '20.0.0';
public const RECOMMENDED_NPM_VERSION = '10.0.0';
public const RETRY_COUNT = 2;

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

private function watch(array $plugins, bool $printBuildCommand, array $allPluginNames): void
{
$nodeCompatibilityEnv = $this->getNodeCompatibilityEnv();

$commandSingle = 'cd ' . PIWIK_INCLUDE_PATH . ' && '
. "BROWSERSLIST_IGNORE_OLD_DATA=1 FORCE_COLOR=1 MATOMO_CURRENT_PLUGIN=%2\$s "
. 'MATOMO_ALL_PLUGINS=' . implode(',', $allPluginNames) . ' '
. 'node ' . self::getVueCliServiceProxyBin() . ' build --mode=development --target lib --name '
. $nodeCompatibilityEnv . 'node ' . self::getVueCliServiceProxyBin() . ' build --mode=development --target lib --name '
. "%1\$s --filename=%1\$s.development --no-clean %2\$s/vue/src/index.ts --dest %2\$s/vue/dist --watch &";

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

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

if ($printBuildCommand) {
Expand Down Expand Up @@ -292,6 +295,21 @@ private function checkNodeJsVersion(): void
}
}

private function getNodeCompatibilityEnv(): string
{
$nodeVersion = ltrim(trim(`node -v`), 'v');
if (version_compare($nodeVersion, '17.0.0', '<')) {
return '';
}

$nodeOptions = getenv('NODE_OPTIONS') ?: '';
if (strpos($nodeOptions, '--openssl-legacy-provider') === false) {
$nodeOptions = trim($nodeOptions . ' --openssl-legacy-provider');
}

return 'NODE_OPTIONS=' . escapeshellarg($nodeOptions) . ' ';
}

private function isTypeScriptRaceConditionInOutput(string $plugin, string $concattedOutput): bool
{
// Console output can contain ANSI escape sequences; remove them first to make regex matching stable.
Expand Down
Loading