Maintenance: Updated NPM packages (#6090)

* Maintenance: Updated NPM packages

Includes typescript update to 6. Needed to update some typescript config
to align with actual module environment used and built by esbuild.

* Maintenance: Fixed testing issues after NPM dep version changes

* Maintenance: Updated JS test workflow step version

* Maintenance: Updated approach used for TS config in jest config
This commit is contained in:
Dan Brown
2026-04-08 21:02:20 +01:00
committed by GitHub
parent e033578fea
commit c33853ed84
5 changed files with 720 additions and 614 deletions

View File

@@ -17,7 +17,7 @@ jobs:
if: ${{ github.ref != 'refs/heads/l10n_development' }} if: ${{ github.ref != 'refs/heads/l10n_development' }}
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Install NPM deps - name: Install NPM deps
run: npm ci run: npm ci

View File

@@ -5,7 +5,15 @@
import type {Config} from 'jest'; import type {Config} from 'jest';
import {pathsToModuleNameMapper} from "ts-jest"; import {pathsToModuleNameMapper} from "ts-jest";
import { compilerOptions } from './tsconfig.json'; import fs from "node:fs";
const { compilerOptions } = JSON.parse(fs.readFileSync('./tsconfig.json', 'utf8'));
const compilerPaths = compilerOptions.paths as Record<string, string[]>;
const cleanedPaths: Record<string, string[]> = {};
Object.keys(compilerPaths).forEach((key) => {
const paths = compilerPaths[key];
cleanedPaths[key] = paths.map(p => p.replace('./', ''));
});
const config: Config = { const config: Config = {
// All imported modules in your tests should be mocked automatically // All imported modules in your tests should be mocked automatically
@@ -98,7 +106,7 @@ const config: Config = {
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: { moduleNameMapper: {
'lexical/shared/invariant': 'resources/js/wysiwyg/lexical/core/shared/__mocks__/invariant', 'lexical/shared/invariant': 'resources/js/wysiwyg/lexical/core/shared/__mocks__/invariant',
...pathsToModuleNameMapper(compilerOptions.paths), ...pathsToModuleNameMapper(cleanedPaths),
}, },
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
@@ -111,7 +119,7 @@ const config: Config = {
// notifyMode: "failure-change", // notifyMode: "failure-change",
// A preset that is used as a base for Jest's configuration // A preset that is used as a base for Jest's configuration
// preset: undefined, preset: 'ts-jest',
// Run tests from one or more projects // Run tests from one or more projects
// projects: undefined, // projects: undefined,

1279
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -20,22 +20,23 @@
"devDependencies": { "devDependencies": {
"@eslint/js": "^10.0.1", "@eslint/js": "^10.0.1",
"@lezer/generator": "^1.8.0", "@lezer/generator": "^1.8.0",
"@types/jest": "^30.0.0",
"@types/markdown-it": "^14.1.2", "@types/markdown-it": "^14.1.2",
"@types/sortablejs": "^1.15.9", "@types/sortablejs": "^1.15.9",
"chokidar-cli": "^3.0", "chokidar-cli": "^3.0",
"esbuild": "^0.27.3", "esbuild": "^0.28.0",
"eslint": "^10.0.2", "eslint": "^10.2.0",
"globals": "^17.4.0", "globals": "^17.4.0",
"jest": "^30.2.0", "jest": "^30.3.0",
"jest-environment-jsdom": "^30.2.0", "jest-environment-jsdom": "^30.3.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"sass": "^1.97.3", "sass": "^1.99.0",
"ts-jest": "^29.4.6", "ts-jest": "^29.4.9",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "5.9.*" "typescript": "6.0.*"
}, },
"dependencies": { "dependencies": {
"@codemirror/commands": "^6.10.2", "@codemirror/commands": "^6.10.3",
"@codemirror/lang-css": "^6.3.1", "@codemirror/lang-css": "^6.3.1",
"@codemirror/lang-html": "^6.4.11", "@codemirror/lang-html": "^6.4.11",
"@codemirror/lang-javascript": "^6.2.5", "@codemirror/lang-javascript": "^6.2.5",
@@ -43,15 +44,14 @@
"@codemirror/lang-markdown": "^6.5.0", "@codemirror/lang-markdown": "^6.5.0",
"@codemirror/lang-php": "^6.0.2", "@codemirror/lang-php": "^6.0.2",
"@codemirror/lang-xml": "^6.1.0", "@codemirror/lang-xml": "^6.1.0",
"@codemirror/language": "^6.12.2", "@codemirror/language": "^6.12.3",
"@codemirror/legacy-modes": "^6.5.2", "@codemirror/legacy-modes": "^6.5.2",
"@codemirror/state": "^6.5.4", "@codemirror/state": "^6.6.0",
"@codemirror/theme-one-dark": "^6.1.3", "@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.39.16", "@codemirror/view": "^6.41.0",
"@lezer/highlight": "^1.2.3", "@lezer/highlight": "^1.2.3",
"@ssddanbrown/codemirror-lang-smarty": "^1.0.0", "@ssddanbrown/codemirror-lang-smarty": "^1.0.0",
"@ssddanbrown/codemirror-lang-twig": "^1.0.0", "@ssddanbrown/codemirror-lang-twig": "^1.0.0",
"@types/jest": "^30.0.0",
"codemirror": "^6.0.2", "codemirror": "^6.0.2",
"idb-keyval": "^6.2.2", "idb-keyval": "^6.2.2",
"markdown-it": "^14.1.1", "markdown-it": "^14.1.1",

View File

@@ -2,15 +2,16 @@
"include": ["resources/js/**/*"], "include": ["resources/js/**/*"],
"exclude": ["resources/js/wysiwyg/lexical/yjs/*"], "exclude": ["resources/js/wysiwyg/lexical/yjs/*"],
"compilerOptions": { "compilerOptions": {
"target": "es2022", "target": "es2023",
"module": "commonjs", "module": "esnext",
"moduleResolution": "bundler",
"rootDir": "./resources/js/", "rootDir": "./resources/js/",
"baseUrl": "./", "types": ["jest", "node"],
"paths": { "paths": {
"@icons/*": ["resources/icons/*"], "@icons/*": ["./resources/icons/*"],
"lexical": ["resources/js/wysiwyg/lexical/core/index.ts"], "lexical": ["./resources/js/wysiwyg/lexical/core/index.ts"],
"lexical/*": ["resources/js/wysiwyg/lexical/core/*"], "lexical/*": ["./resources/js/wysiwyg/lexical/core/*"],
"@lexical/*": ["resources/js/wysiwyg/lexical/*"] "@lexical/*": ["./resources/js/wysiwyg/lexical/*"]
}, },
"resolveJsonModule": true, "resolveJsonModule": true,
"allowJs": true, "allowJs": true,