From f8640bfb40fe0c670c84eacfad8cb264c8addad6 Mon Sep 17 00:00:00 2001 From: koalasat Date: Fri, 18 Jul 2025 14:12:58 +0200 Subject: [PATCH] Bump frontend libraries --- frontend/package-lock.json | 82 ++++++++++++++++++++ frontend/package.json | 1 + frontend/tsconfig.json | 5 +- frontend/webpack.config.ts | 148 +++++++++++++++---------------------- 4 files changed, 145 insertions(+), 91 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index b021e91f..d8b43fbb 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -74,6 +74,7 @@ "@typescript-eslint/eslint-plugin": "^8.33.0", "@typescript-eslint/parser": "^8.36.0", "babel-loader": "^10.0.0", + "copy-webpack-plugin": "^13.0.0", "css-loader": "^7.1.2", "eslint": "^9.30.1", "eslint-config-love": "^120.0.0", @@ -6900,6 +6901,87 @@ "node": ">=18" } }, + "node_modules/copy-webpack-plugin": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-13.0.0.tgz", + "integrity": "sha512-FgR/h5a6hzJqATDGd9YG41SeDViH+0bkHn6WNXCi5zKAZkeESeSxLySSsFLHqLEVCh0E+rITmCf0dusXWYukeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "glob-parent": "^6.0.1", + "normalize-path": "^3.0.0", + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2", + "tinyglobby": "^0.2.12" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/copy-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/copy-webpack-plugin/node_modules/schema-utils": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.2.tgz", + "integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/core-js-compat": { "version": "3.42.0", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.42.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 4e841115..316833f3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -33,6 +33,7 @@ "@typescript-eslint/eslint-plugin": "^8.33.0", "@typescript-eslint/parser": "^8.36.0", "babel-loader": "^10.0.0", + "copy-webpack-plugin": "^13.0.0", "css-loader": "^7.1.2", "eslint": "^9.30.1", "eslint-config-love": "^120.0.0", diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 09d50569..c198178a 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -13,7 +13,10 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + "types": ["node", "react", "react-dom", "jest", "@babel/core", "webpack", "url"], + "typeRoots": ["./node_modules/@types"], + "allowImportingTsExtensions": true }, "include": ["src/**/*"], "exclude": ["node_modules", "**/*.spec.ts"] diff --git a/frontend/webpack.config.ts b/frontend/webpack.config.ts index c6aa5780..b0246507 100644 --- a/frontend/webpack.config.ts +++ b/frontend/webpack.config.ts @@ -1,9 +1,14 @@ import path from 'path'; +import { fileURLToPath } from 'url'; import { Configuration } from 'webpack'; -import FileManagerPlugin from 'filemanager-webpack-plugin'; +import CopyWebpackPlugin from 'copy-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import { version } from './package.json'; +// Setup __dirname equivalent for TypeScript +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + const config: Configuration = { entry: './src/index.js', module: { @@ -81,17 +86,13 @@ const configNode: Configuration = { robosatsSettings: 'selfhosted-pro', basePath: '/', }), - new FileManagerPlugin({ - events: { - onEnd: { - copy: [ - { - source: path.resolve(__dirname, 'static'), - destination: path.resolve(__dirname, '../nodeapp/static'), - }, - ], + new CopyWebpackPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'static'), + to: path.resolve(__dirname, '../nodeapp/static'), }, - }, + ], }), // Desktop App new HtmlWebpackPlugin({ @@ -104,17 +105,13 @@ const configNode: Configuration = { robosatsSettings: 'desktop-basic', basePath: '/', }), - new FileManagerPlugin({ - events: { - onEnd: { - copy: [ - { - source: path.resolve(__dirname, 'static'), - destination: path.resolve(__dirname, '../desktopApp/static'), - }, - ], + new CopyWebpackPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'static'), + to: path.resolve(__dirname, '../desktopApp/static'), }, - }, + ], }), // Web App new HtmlWebpackPlugin({ @@ -137,17 +134,13 @@ const configNode: Configuration = { robosatsSettings: 'web-pro', basePath: '/', }), - new FileManagerPlugin({ - events: { - onEnd: { - copy: [ - { - source: path.resolve(__dirname, 'static'), - destination: path.resolve(__dirname, '../web/static'), - }, - ], + new CopyWebpackPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'static'), + to: path.resolve(__dirname, '../web/static'), }, - }, + ], }), ], }; @@ -216,25 +209,21 @@ const configNative: Configuration = { robosatsSettings: 'mobile-basic', basePath: './', }), - new FileManagerPlugin({ - events: { - onEnd: { - copy: [ - { - source: path.resolve(__dirname, 'static/css'), - destination: path.resolve(__dirname, '../mobile/html/Web.bundle/static/css'), - }, - { - source: path.resolve(__dirname, 'static/assets/sounds'), - destination: path.resolve(__dirname, '../mobile/html/Web.bundle/assets/sounds'), - }, - { - source: path.resolve(__dirname, 'static/federation'), - destination: path.resolve(__dirname, '../mobile/html/Web.bundle/assets/federation'), - }, - ], + new CopyWebpackPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'static/css'), + to: path.resolve(__dirname, '../mobile/html/Web.bundle/static/css'), }, - }, + { + from: path.resolve(__dirname, 'static/assets/sounds'), + to: path.resolve(__dirname, '../mobile/html/Web.bundle/assets/sounds'), + }, + { + from: path.resolve(__dirname, 'static/federation'), + to: path.resolve(__dirname, '../mobile/html/Web.bundle/assets/federation'), + }, + ], }), ], }; @@ -303,49 +292,28 @@ const configAndroid: Configuration = { robosatsSettings: 'mobile-basic', basePath: 'file:///android_asset/Web.bundle/', }), - new FileManagerPlugin({ - events: { - onEnd: { - copy: [ - { - source: path.resolve(__dirname, 'static/css'), - destination: path.resolve( - __dirname, - '../mobile_new/app/src/main/assets/Web.bundle/static/css', - ), - }, - { - source: path.resolve(__dirname, 'static/assets/sounds'), - destination: path.resolve( - __dirname, - '../mobile_new/app/src/main/assets/Web.bundle/assets/sounds', - ), - }, - { - source: path.resolve(__dirname, 'static/federation'), - destination: path.resolve( - __dirname, - '../mobile_new/app/src/main/assets/Web.bundle/assets/federation', - ), - }, - ], + new CopyWebpackPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'static/css'), + to: path.resolve(__dirname, '../mobile_new/app/src/main/assets/Web.bundle/static/css'), }, - }, - }), - new FileManagerPlugin({ - events: { - onEnd: { - copy: [ - { - source: path.resolve(__dirname, '../mobile/html/Web.bundle/static/frontend'), - destination: path.resolve( - __dirname, - '../mobile_new/app/src/main/assets/static/frontend', - ), - }, - ], + { + from: path.resolve(__dirname, 'static/assets/sounds'), + to: path.resolve(__dirname, '../mobile_new/app/src/main/assets/Web.bundle/assets/sounds'), }, - }, + { + from: path.resolve(__dirname, 'static/federation'), + to: path.resolve( + __dirname, + '../mobile_new/app/src/main/assets/Web.bundle/assets/federation', + ), + }, + { + from: path.resolve(__dirname, '../mobile/html/Web.bundle/static/frontend'), + to: path.resolve(__dirname, '../mobile_new/app/src/main/assets/static/frontend'), + }, + ], }), ], };