appName from config.json

This commit is contained in:
Martti Malmi
2023-09-26 08:02:42 +03:00
parent 5d698e550e
commit 1f6e1886b3
8 changed files with 31 additions and 3 deletions

View File

@ -0,0 +1,4 @@
{
"appName": "Snort",
"appTitle": "Snort - Nostr"
}

View File

@ -0,0 +1,4 @@
{
"appName": "iris",
"appTitle": "iris"
}

View File

@ -88,6 +88,7 @@
"@webpack-cli/generators": "^3.0.4",
"@webscopeio/react-textarea-autocomplete": "^4.9.2",
"babel-loader": "^9.1.3",
"config": "^3.3.9",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"css-minimizer-webpack-plugin": "^5.0.0",

View File

@ -11,7 +11,7 @@
<link rel="preconnect" href="https://imgproxy.snort.social" />
<link rel="apple-touch-icon" href="/nostrich_512.png" />
<link rel="manifest" href="/manifest.json" />
<title>Snort - Nostr</title>
<title><%= htmlWebpackPlugin.options.templateParameters.appTitle %></title>
</head>
<body>
<div id="root"></div>

View File

@ -4,7 +4,7 @@ const Logo = () => {
const navigate = useNavigate();
return (
<h1 className="logo" onClick={() => navigate("/")}>
Snort
{process.env.APP_NAME}
</h1>
);
};

View File

@ -209,7 +209,7 @@ function LogoHeader() {
return (
<Link to="/" className="logo">
<h1>Snort</h1>
<h1>{process.env.APP_NAME}</h1>
{currentSubscription && (
<small className="flex">
<Icon name="diamond" size={10} className="mr5" />

View File

@ -9,6 +9,9 @@ const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const WorkboxPlugin = require("workbox-webpack-plugin");
const IntlTsTransformer = require("@formatjs/ts-transformer");
const { DefinePlugin } = require('webpack');
const appConfig = require('config');
console.log(`Current config: ${JSON.stringify(appConfig, null, 2)}`);
const isProduction = process.env.NODE_ENV == "production";
@ -49,6 +52,9 @@ const config = {
template: "public/index.html",
favicon: "public/favicon.ico",
excludeChunks: ["pow", "bench"],
templateParameters: {
appTitle: appConfig.get('appTitle'),
},
}),
new HtmlWebpackPlugin({
filename: "bench.html",
@ -69,6 +75,9 @@ const config = {
swSrc: "./src/service-worker.ts",
})
: false,
new DefinePlugin({
"process.env.APP_NAME": JSON.stringify(appConfig.get('appName')),
}),
],
module: {
rules: [