From e0e161acba0b5bddca458f351daa674c7f045111 Mon Sep 17 00:00:00 2001 From: Jeeva Ramachandran Date: Fri, 11 Oct 2024 18:12:19 +0530 Subject: [PATCH 1/3] chore: add custom-webpack --- config/config.toml | 4 +- package.json | 1 + public/hyperswitch/index.html | 2 +- src/screens/Connectors/ConnectorUtils.res | 2 +- webpack.custom.js | 90 +++++++++++++++++++++++ 5 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 webpack.custom.js diff --git a/config/config.toml b/config/config.toml index 80696aa4f..4103aab6b 100644 --- a/config/config.toml +++ b/config/config.toml @@ -3,7 +3,7 @@ primary_color="#006DF9" primary_hover_color="#005ED6" sidebar_color="#242F48" [default.endpoints] -api_url="http://localhost:8080" +api_url="https://sandbox.hyperswitch.io" sdk_url="" logo_url="" favicon_url="" @@ -18,7 +18,7 @@ test_live_toggle=false is_live_mode=false email=false quick_start=false -audit_trail=false +audit_trail=true system_metrics=false sample_data=false frm=false diff --git a/package.json b/package.json index d40215720..7fbf5b962 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "serve": "node dist/server/server.js", "prod:start": "webpack serve --config webpack.dev.js", "build:netlify": "webpack --config webpack.prod.js --env netlifyHosted", + "build:custom": "npm run re:clean && npm run re:build && APP_VERSION=$npm_package_version && webpack --config webpack.custom.js", "build:prod": "npm run re:clean && npm run re:build && APP_VERSION=$npm_package_version && webpack --config webpack.prod.js", "build:test": "npm run re:clean && npm run re:build && APP_VERSION=$npm_package_version && webpack --config webpack.prod.js", "re:build": "rescript", diff --git a/public/hyperswitch/index.html b/public/hyperswitch/index.html index ed0d9aa14..a3d8f19e8 100644 --- a/public/hyperswitch/index.html +++ b/public/hyperswitch/index.html @@ -98,7 +98,7 @@ - +
diff --git a/src/screens/Connectors/ConnectorUtils.res b/src/screens/Connectors/ConnectorUtils.res index 6d1799e90..9cfd19062 100644 --- a/src/screens/Connectors/ConnectorUtils.res +++ b/src/screens/Connectors/ConnectorUtils.res @@ -494,7 +494,7 @@ let taxJarInfo = { description: "TaxJar is reimagining how businesses manage sales tax compliance. Its cloud-based platform automates the entire sales tax life cycle across all sales channels — from calculations and nexus tracking to reporting and filing.", } let nexixpayInfo = { - description : "Nexi's latest generation virtual POS is designed for those who, through a website, want to sell goods or services by managing payments online." + description: "Nexi's latest generation virtual POS is designed for those who, through a website, want to sell goods or services by managing payments online.", } let signifydInfo = { description: "One platform to protect the entire shopper journey end-to-end", diff --git a/webpack.custom.js b/webpack.custom.js new file mode 100644 index 000000000..a247bdb4c --- /dev/null +++ b/webpack.custom.js @@ -0,0 +1,90 @@ +const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const TerserPlugin = require("terser-webpack-plugin"); +const CopyPlugin = require("copy-webpack-plugin"); +const tailwindcss = require("tailwindcss"); +const webpack = require("webpack"); +const path = require("path"); +const serverConfig = require("./webpack.server"); +let customBuild = (appName = "hyperswitch") => { + const isDevelopment = process.env.NODE_ENV !== "production"; + let entryObj = { + app: `./src/entryPoints/HyperSwitchEntry.res.js`, + }; + return { + mode: "production", + entry: entryObj, + output: { + path: path.resolve(__dirname, "dist", appName), + clean: true, + publicPath: "/", + }, + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + terserOptions: { + compress: { + drop_console: true, + }, + }, + }), + ], + }, + module: { + rules: [ + { + test: /\.css$/i, + use: [ + MiniCssExtractPlugin.loader, + "css-loader", + { + loader: "postcss-loader", + options: { + postcssOptions: { + plugins: [[tailwindcss("./tailwind.config.js")]], + }, + }, + }, + ], + }, + { + test: /\.ttf$/, + use: ["file-loader"], + }, + { + test: /\.js$/, + use: { + loader: "istanbul-instrumenter-loader", + options: { esModules: true }, + }, + enforce: "post", + exclude: /node_modules|\.spec\.js$/, + }, + ], + }, + plugins: [ + new MiniCssExtractPlugin(), + new CopyPlugin({ + patterns: [ + { from: `public/${appName}/index.html` }, + { from: `public/${appName}/module.js` }, + ].filter(Boolean), + }), + new webpack.DefinePlugin({ + dashboardAppName: JSON.stringify(appName), + dashboardAppEnv: JSON.stringify(process.env.APP_ENV || "sandbox"), + GIT_COMMIT_HASH: JSON.stringify(process.env.GIT_COMMIT_HASH || ""), + appVersion: JSON.stringify(process.env.APP_VERSION || ""), + }), + isDevelopment && new ReactRefreshWebpackPlugin(), + ].filter(Boolean), + }; +}; + +module.exports = (env, _argv) => { + var webpackConfigs = [serverConfig]; + webpackConfigs.push(customBuild("hyperswitch", env)); + console.log("webpackConfigs", webpackConfigs); + return webpackConfigs; +}; From 716f5a3fa3365c8ac0f1ff0f8c76b8684f222861 Mon Sep 17 00:00:00 2001 From: Jeeva Ramachandran Date: Tue, 15 Oct 2024 10:00:13 +0530 Subject: [PATCH 2/3] chore: add custom-webpack --- public/hyperswitch/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/hyperswitch/index.html b/public/hyperswitch/index.html index a3d8f19e8..ed0d9aa14 100644 --- a/public/hyperswitch/index.html +++ b/public/hyperswitch/index.html @@ -98,7 +98,7 @@ - +
From e25a1318cc153c55457803dc8d83804c39fd8a7a Mon Sep 17 00:00:00 2001 From: Jeeva Ramachandran Date: Tue, 15 Oct 2024 15:04:33 +0530 Subject: [PATCH 3/3] chore: add custom-webpack --- config/config.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.toml b/config/config.toml index 4103aab6b..80696aa4f 100644 --- a/config/config.toml +++ b/config/config.toml @@ -3,7 +3,7 @@ primary_color="#006DF9" primary_hover_color="#005ED6" sidebar_color="#242F48" [default.endpoints] -api_url="https://sandbox.hyperswitch.io" +api_url="http://localhost:8080" sdk_url="" logo_url="" favicon_url="" @@ -18,7 +18,7 @@ test_live_toggle=false is_live_mode=false email=false quick_start=false -audit_trail=true +audit_trail=false system_metrics=false sample_data=false frm=false