Skip to content

Commit a1cfa53

Browse files
authored
chore: migrate from yarn to pnpm 10 + update all dependencies (#154)
1 parent 73649db commit a1cfa53

20 files changed

Lines changed: 4736 additions & 6591 deletions

.editorconfig

Lines changed: 0 additions & 13 deletions
This file was deleted.

.eslintrc.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,32 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v6
13+
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v4
1316

1417
- name: Set up Node.js
15-
uses: actions/setup-node@v4
18+
uses: actions/setup-node@v6
1619
with:
17-
node-version: lts/*
18-
cache: yarn
20+
node-version-file: .nvmrc
21+
cache: pnpm
1922

20-
- name: Installing
21-
run: yarn --frozen-lockfile --perfer-offline
23+
- name: Install dependencies
24+
run: pnpm install --frozen-lockfile
2225

2326
- name: Lint
24-
run: yarn lint
27+
run: pnpm lint
2528

2629
- name: Unit tests
27-
run: yarn test --coverage --coverageReporters=lcov --coverageReporters=text-summary
30+
run: pnpm test:coverage
2831

2932
- name: Send test coverage to codecov
3033
continue-on-error: true
31-
uses: codecov/codecov-action@v3
34+
uses: codecov/codecov-action@v4
3235

3336
- name: Build
34-
run: yarn build
37+
run: pnpm build
3538

3639
- name: Archive build
3740
uses: actions/upload-artifact@v4
@@ -44,21 +47,28 @@ jobs:
4447
if: github.event_name == 'push'
4548
runs-on: ubuntu-latest
4649
steps:
47-
- name: Set up Node
48-
uses: actions/setup-node@v4
49-
with:
50-
node-version: 16.x
50+
- uses: actions/checkout@v6
51+
52+
- name: Install pnpm
53+
uses: pnpm/action-setup@v4
5154

52-
- uses: actions/checkout@v4
55+
- name: Set up Node.js
56+
uses: actions/setup-node@v6
57+
with:
58+
node-version-file: .nvmrc
59+
cache: pnpm
5360

54-
- name: Download lib form build job
61+
- name: Download lib from build job
5562
uses: actions/download-artifact@v4
5663
with:
5764
name: lib
5865
path: lib
5966

67+
- name: Install dependencies
68+
run: pnpm install --frozen-lockfile
69+
6070
- name: Semantic Release
61-
uses: cycjimmy/semantic-release-action@v3
71+
uses: cycjimmy/semantic-release-action@v6
6272
with:
6373
extra_plugins: |
6474
@semantic-release/changelog
@@ -69,4 +79,3 @@ jobs:
6979
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
7080
GIT_COMMITTER_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
7181
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
lib
22
node_modules
33
.idea
4+
yarn.lock
5+
coverage/

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
engine-strict=true
2+
auto-install-peers=true
3+
shamefully-hoist=true

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

custom.d.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ declare global {
55
_paq?: PushArgs[] | null;
66
}
77

8-
namespace NodeJS {
9-
interface Global {
10-
_paq?: PushArgs[] | null;
11-
}
12-
}
8+
// Node 24+ uses globalThis instead of NodeJS.Global
9+
// eslint-disable-next-line no-var
10+
var _paq: PushArgs[] | null | undefined;
1311
}
1412

1513
export {};

eslint.config.mjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import tseslint from "typescript-eslint";
2+
import eslintConfigPrettier from "eslint-config-prettier";
3+
4+
export default tseslint.config(
5+
{
6+
ignores: ["lib/**", "node_modules/**", "jest.config.*"],
7+
},
8+
...tseslint.configs.recommended,
9+
eslintConfigPrettier,
10+
{
11+
files: ["src/**/*.ts"],
12+
ignores: ["src/__tests__/**"],
13+
languageOptions: {
14+
parserOptions: {
15+
project: true,
16+
tsconfigRootDir: import.meta.dirname,
17+
},
18+
},
19+
rules: {
20+
"@typescript-eslint/no-explicit-any": "warn",
21+
"@typescript-eslint/no-unused-vars": [
22+
"error",
23+
{ argsIgnorePattern: "^_" },
24+
],
25+
},
26+
},
27+
{
28+
files: ["src/__tests__/**/*.ts"],
29+
rules: {
30+
"@typescript-eslint/no-explicit-any": "off",
31+
"@typescript-eslint/no-require-imports": "off",
32+
"@typescript-eslint/no-unused-vars": [
33+
"error",
34+
{ argsIgnorePattern: "^_" },
35+
],
36+
},
37+
},
38+
);

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
12
module.exports = {
23
preset: "ts-jest",
4+
testEnvironment: "jsdom",
35
testPathIgnorePatterns: ["./lib"],
46
testMatch: ["**/__tests__/**/*.test.ts"],
7+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json"],
58
};

package.json

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,48 @@
44
"version": "1.11.0",
55
"author": "Fabrique numérique des Ministères Sociaux <dsi-incubateur@sg.social.gouv.fr> (https://www.fabrique.social.gouv.fr)",
66
"homepage": "https://github.com/SocialGouv/matomo-next#readme",
7+
"packageManager": "pnpm@10.29.1",
8+
"engines": {
9+
"node": ">=24.0.0",
10+
"pnpm": ">=10.0.0"
11+
},
712
"devDependencies": {
8-
"@socialgouv/eslint-config-react": "1.131.0",
9-
"@socialgouv/eslint-config-typescript": "^1.97.3",
10-
"@types/jest": "26.0.24",
11-
"@types/trusted-types": "^2.0.4",
12-
"eslint": "7.32.0",
13-
"eslint-config-prettier": "^9.1.0",
14-
"eslint-config-typescript": "^3.0.0",
15-
"jest": "26.6.3",
16-
"next": "11.1.3",
17-
"prettier": "3.1.1",
18-
"react": "16.14.0",
19-
"react-dom": "16.14.0",
20-
"ts-jest": "26.5.6",
21-
"typescript": "3.9.10"
13+
"@types/jest": "^30.0.0",
14+
"@types/react": "^19.2.14",
15+
"@types/react-dom": "^19.2.3",
16+
"@types/trusted-types": "^2.0.7",
17+
"@typescript-eslint/eslint-plugin": "^8.55.0",
18+
"@typescript-eslint/parser": "^8.55.0",
19+
"eslint": "^10.0.0",
20+
"eslint-config-prettier": "^10.1.8",
21+
"jest": "^30.2.0",
22+
"jest-environment-jsdom": "^30.2.0",
23+
"next": "^16.1.6",
24+
"prettier": "^3.8.1",
25+
"react": "^19.2.4",
26+
"react-dom": "^19.2.4",
27+
"ts-jest": "^29.4.6",
28+
"typescript": "^5.9.3",
29+
"typescript-eslint": "^8.55.0"
2230
},
2331
"files": [
2432
"lib"
2533
],
2634
"license": "Apache-2.0",
2735
"main": "lib/index.js",
36+
"types": "lib/index.d.ts",
2837
"peerDependencies": {
29-
"next": ">= 9.5.5"
38+
"next": ">= 13.0.0",
39+
"react": ">= 18.0.0"
3040
},
3141
"publishConfig": {
3242
"access": "public"
3343
},
3444
"scripts": {
3545
"build": "tsc",
3646
"lint": "eslint src",
37-
"test": "jest"
47+
"test": "jest",
48+
"test:coverage": "jest --coverage --coverageReporters=lcov --coverageReporters=text-summary",
49+
"typecheck": "tsc --noEmit"
3850
}
3951
}

0 commit comments

Comments
 (0)