This is an automated email from the ASF dual-hosted git repository. andytaylor pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/activemq-artemis-console.git
commit 7afb6ab7caddb64f9cdd5cd9a3f77085655e300f Author: Grzegorz Grzybek <[email protected]> AuthorDate: Wed Apr 23 10:23:58 2025 +0200 ARTEMIS-5447 - Split library and app configurations (webpack, tsconfig) --- .../artemis-extension/app/package.json | 91 +++++++++++++ .../artemis-extension/{ => app}/tsconfig.json | 0 .../artemis-extension/{ => app}/webpack.config.cjs | 0 .../artemis-extension/craco.config.js | 141 --------------------- .../packages/artemis-console-plugin/package.json | 91 +++++++++++++ .../artemis-console-plugin}/tsconfig.json | 0 6 files changed, 182 insertions(+), 141 deletions(-) diff --git a/artemis-console-extension/artemis-extension/app/package.json b/artemis-console-extension/artemis-extension/app/package.json new file mode 100644 index 0000000..51c418b --- /dev/null +++ b/artemis-console-extension/artemis-extension/app/package.json @@ -0,0 +1,91 @@ +{ + "name": "artemis-console", + "version": "1.1.0", + "description": "Artemis Console", + "main": "./src/main/webapp/app/artemis-console.js", + "license": "Apache-2.0", + "private": true, + "scripts": { + "start": "webpack serve --mode development", + "build": "webpack --mode production && yarn replace-version", + "test": "craco test", + "replace-version": "replace __PACKAGE_VERSION_PLACEHOLDER__ $npm_package_version ./build/static/js -r --include=\"*.js\"", + "license": "yarn licenses generate-disclaimer -R > ../../artemis-console-distribution/src/main/resources/licenses/licenses/NPMLicenses.txt" + }, + "dependencies": { + "@hawtio/react": "1.9.0", + "@patternfly/react-charts": "~7.4.9", + "@patternfly/react-core": "~5.4.14", + "@patternfly/react-icons": "~5.3.2", + "@patternfly/react-table": "~5.4.16", + "@patternfly/react-topology": "~5.4.1", + "d3": "^7.8.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-router-dom": "^6.27.0", + "react-scripts": "^5.0.1" + }, + "devDependencies": { + "@craco/craco": "^7.1.0", + "@hawtio/backend-middleware": "^1.0.6", + "@swc/core": "^1.7.26", + "copy-webpack-plugin": "^12.0.2", + "css-loader": "^7.1.2", + "css-minimizer-webpack-plugin": "^7.0.0", + "html-webpack-plugin": "^5.6.0", + "mini-css-extract-plugin": "^2.9.1", + "monaco-editor-webpack-plugin": "^7.1.0", + "os-browserify": "^0.3.0", + "path-browserify": "^1.0.1", + "react-dev-utils": "^12.0.1", + "replace": "^1.2.2", + "style-loader": "^4.0.0", + "swc-loader": "^0.2.6", + "terser-webpack-plugin": "^5.3.10", + "webpack": "^5.95.0", + "webpack-cli": "^5.1.4", + "webpack-manifest-plugin": "^5.0.0" + }, + "resolutions": { + "axios": "1.8.2", + "@typescript-eslint/eslint-plugin": "6.9.0", + "@typescript-eslint/parser": "6.9.0", + "d3-color": "3.1.0", + "nth-check": "2.0.1", + "tough-cookie": "4.1.3", + "semver": "7.5.2", + "word-wrap": "1.2.4", + "postcss": "8.4.31", + "ws": "8.18.0", + "braces": "3.0.3", + "express": "4.21.0", + "webpack": "5.95.0", + "cookie": "0.7.0", + "micromatch": "4.0.8", + "rollup": "2.79.2", + "http-proxy-middleware": "2.0.7", + "cross-spawn": "7.0.5", + "nanoid": "3.3.8", + "path-to-regexp": "0.1.12", + "serialize-javascript": "6.0.2" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "packageManager": "[email protected]" +} diff --git a/artemis-console-extension/artemis-extension/tsconfig.json b/artemis-console-extension/artemis-extension/app/tsconfig.json similarity index 100% copy from artemis-console-extension/artemis-extension/tsconfig.json copy to artemis-console-extension/artemis-extension/app/tsconfig.json diff --git a/artemis-console-extension/artemis-extension/webpack.config.cjs b/artemis-console-extension/artemis-extension/app/webpack.config.cjs similarity index 100% rename from artemis-console-extension/artemis-extension/webpack.config.cjs rename to artemis-console-extension/artemis-extension/app/webpack.config.cjs diff --git a/artemis-console-extension/artemis-extension/craco.config.js b/artemis-console-extension/artemis-extension/craco.config.js deleted file mode 100644 index cd53384..0000000 --- a/artemis-console-extension/artemis-extension/craco.config.js +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - const { ModuleFederationPlugin } = require('webpack').container -const CracoEsbuildPlugin = require('craco-esbuild') -const { hawtioBackend } = require('@hawtio/backend-middleware') -const { dependencies } = require('./package.json') - -module.exports = { - plugins: [{ plugin: CracoEsbuildPlugin }], - webpack: { - plugins: { - add: [ - new ModuleFederationPlugin({ - // The container name corresponds to 'scope' passed to HawtioPlugin - name: 'artemisPlugin', - filename: 'remoteEntry.js', - // The key in exposes corresponds to 'remote' passed to HawtioPlugin - exposes: { - './plugin': './src/artemis-extension', - }, - shared: { - ...dependencies, - react: { - singleton: true, - requiredVersion: dependencies['react'], - }, - 'react-dom': { - singleton: true, - requiredVersion: dependencies['react-dom'], - }, - 'react-router-dom': { - singleton: true, - requiredVersion: dependencies['react-router-dom'], - }, - '@hawtio/react': { - singleton: true, - requiredVersion: dependencies['@hawtio/react'], - }, - }, - }), - ], - }, - configure: webpackConfig => { - // Required for Module Federation - webpackConfig.output.publicPath = 'auto' - - webpackConfig.module.rules.push({ - test: /\.md/, - type: 'asset/source', - }) - - // For suppressing sourcemap warnings from dependencies - webpackConfig.ignoreWarnings = [ - /Failed to parse source map/, - /Critical dependency: the request of a dependency is an expression/, - ] - - // To resolve errors for @module-federation/utilities 2.x - // https://github.com/module-federation/universe/issues/827 - webpackConfig.resolve = { - ...webpackConfig.resolve, - fallback: { - path: require.resolve('path-browserify'), - os: require.resolve('os-browserify'), - }, - } - - // MiniCssExtractPlugin - Ignore order as otherwise conflicting order warning is raised - const miniCssExtractPlugin = webpackConfig.plugins.find(p => p.constructor.name === 'MiniCssExtractPlugin') - if (miniCssExtractPlugin) { - miniCssExtractPlugin.options.ignoreOrder = true - } - - return webpackConfig - }, - }, - // For plugin development - devServer: { - setupMiddlewares: (middlewares, devServer) => { - // Enabling branding in dev mode - devServer.app.use((req, _, next) => { - if (req.url.startsWith('/artemis-extension')) { - req.url = req.url.replace(/\/artemis-plugin(.*)/, '/hawtio$1') - } - next() - }) - // Redirect / or /console to /console/ - devServer.app.get('/', (_, res) => res.redirect('/console/')) - devServer.app.get('/console$', (_, res) => res.redirect('/console/')) - - const username = 'developer' - const proxyEnabled = true - const plugin = [] - const hawtconfig = {} - - // Hawtio backend API mock - let login = true - devServer.app.get('/console/user', (_, res) => { - login ? res.send(`"${username}"`) : res.sendStatus(403) - }) - devServer.app.post('/console/auth/login', (_, res) => { - login = true - res.send(String(login)) - }) - devServer.app.get('/console/auth/logout', (_, res) => { - login = false - res.redirect('/console/login') - }) - devServer.app.get('/console/proxy/enabled', (_, res) => res.send(String(proxyEnabled))) - devServer.app.get('/console/plugin', (_, res) => res.send(JSON.stringify(plugin))) - - // hawtconfig.json mock - devServer.app.get('/console/hawtconfig.json', (_, res) => res.send(JSON.stringify(hawtconfig))) - - middlewares.push({ - name: 'hawtio-backend', - path: '/console/proxy', - middleware: hawtioBackend({ - // Uncomment it if you want to see debug log for Hawtio backend - logLevel: 'debug', - }), - }) - - return middlewares - }, - }, -} diff --git a/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/package.json b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/package.json new file mode 100644 index 0000000..51c418b --- /dev/null +++ b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/package.json @@ -0,0 +1,91 @@ +{ + "name": "artemis-console", + "version": "1.1.0", + "description": "Artemis Console", + "main": "./src/main/webapp/app/artemis-console.js", + "license": "Apache-2.0", + "private": true, + "scripts": { + "start": "webpack serve --mode development", + "build": "webpack --mode production && yarn replace-version", + "test": "craco test", + "replace-version": "replace __PACKAGE_VERSION_PLACEHOLDER__ $npm_package_version ./build/static/js -r --include=\"*.js\"", + "license": "yarn licenses generate-disclaimer -R > ../../artemis-console-distribution/src/main/resources/licenses/licenses/NPMLicenses.txt" + }, + "dependencies": { + "@hawtio/react": "1.9.0", + "@patternfly/react-charts": "~7.4.9", + "@patternfly/react-core": "~5.4.14", + "@patternfly/react-icons": "~5.3.2", + "@patternfly/react-table": "~5.4.16", + "@patternfly/react-topology": "~5.4.1", + "d3": "^7.8.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-router-dom": "^6.27.0", + "react-scripts": "^5.0.1" + }, + "devDependencies": { + "@craco/craco": "^7.1.0", + "@hawtio/backend-middleware": "^1.0.6", + "@swc/core": "^1.7.26", + "copy-webpack-plugin": "^12.0.2", + "css-loader": "^7.1.2", + "css-minimizer-webpack-plugin": "^7.0.0", + "html-webpack-plugin": "^5.6.0", + "mini-css-extract-plugin": "^2.9.1", + "monaco-editor-webpack-plugin": "^7.1.0", + "os-browserify": "^0.3.0", + "path-browserify": "^1.0.1", + "react-dev-utils": "^12.0.1", + "replace": "^1.2.2", + "style-loader": "^4.0.0", + "swc-loader": "^0.2.6", + "terser-webpack-plugin": "^5.3.10", + "webpack": "^5.95.0", + "webpack-cli": "^5.1.4", + "webpack-manifest-plugin": "^5.0.0" + }, + "resolutions": { + "axios": "1.8.2", + "@typescript-eslint/eslint-plugin": "6.9.0", + "@typescript-eslint/parser": "6.9.0", + "d3-color": "3.1.0", + "nth-check": "2.0.1", + "tough-cookie": "4.1.3", + "semver": "7.5.2", + "word-wrap": "1.2.4", + "postcss": "8.4.31", + "ws": "8.18.0", + "braces": "3.0.3", + "express": "4.21.0", + "webpack": "5.95.0", + "cookie": "0.7.0", + "micromatch": "4.0.8", + "rollup": "2.79.2", + "http-proxy-middleware": "2.0.7", + "cross-spawn": "7.0.5", + "nanoid": "3.3.8", + "path-to-regexp": "0.1.12", + "serialize-javascript": "6.0.2" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "packageManager": "[email protected]" +} diff --git a/artemis-console-extension/artemis-extension/tsconfig.json b/artemis-console-extension/artemis-extension/packages/artemis-console-plugin/tsconfig.json similarity index 100% rename from artemis-console-extension/artemis-extension/tsconfig.json rename to artemis-console-extension/artemis-extension/packages/artemis-console-plugin/tsconfig.json --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
