Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 52b755fe16 | |||
| b1c31731ee | |||
| b8cc43c556 | |||
| 24b9ff3b5f | |||
| a38b8922a0 | |||
| fcedc00612 | |||
| da4316dccc | |||
| faacb8b8c7 | |||
| c48fcba994 | |||
| 56e3151db0 | |||
| 8aeaa46332 |
@@ -0,0 +1,10 @@
|
|||||||
|
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
|
||||||
|
|
||||||
@@ -44,6 +44,7 @@ To set up this template in development mode:
|
|||||||
4. Run `cp .envdev .env` and enter your details into the `.env` file
|
4. Run `cp .envdev .env` and enter your details into the `.env` file
|
||||||
5. Execute `npm run dev`
|
5. Execute `npm run dev`
|
||||||
6. Navigate to `http://localhost:3001` in your web browser
|
6. Navigate to `http://localhost:3001` in your web browser
|
||||||
|
7. Repeat this process for each microservice (linked above)
|
||||||
|
|
||||||
# Features List
|
# Features List
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
//polyfills
|
|
||||||
import 'regenerator-runtime/runtime';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
|
|
||||||
|
|||||||
+15
-8
@@ -46,18 +46,21 @@ See https://github.com/krgamestudios/MERN-template/wiki for help.
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
||||||
//determine local computer address for mac user vs everyone else
|
// //determine local computer address for mac user vs everyone else
|
||||||
let macUser = '';
|
// let macUser = '';
|
||||||
while (macUser.toLowerCase() !== 'yes' && macUser.toLowerCase() !== 'no') {
|
// while (macUser.toLowerCase() !== 'yes' && macUser.toLowerCase() !== 'no') {
|
||||||
macUser = await question('Will the MERN-Template be running locally on a MacOS system? (yes or no, this only alters startup.sql)', '');
|
// macUser = await question('Will the MERN-Template be running locally on a MacOS system? (yes or no, this only alters startup.sql)', '');
|
||||||
}
|
// }
|
||||||
|
|
||||||
const localAddress = macUser ? 'localhost' : '%';
|
// const localAddress = macUser === 'yes' ? 'localhost' : '%';
|
||||||
|
const localAddress = '%';
|
||||||
|
|
||||||
//project configuration
|
//project configuration
|
||||||
const projectName = await question('Project Name', 'template');
|
const projectName = await question('Project Name', 'template');
|
||||||
const projectWebAddress = await question('Project Web Address', 'example.com');
|
const projectWebAddress = await question('Project Web Address', 'example.com');
|
||||||
|
|
||||||
|
const corsWebOrigin = await question('CORS Web Origin', `https://${projectWebAddress}`);
|
||||||
|
|
||||||
let projectDBLocation = '';
|
let projectDBLocation = '';
|
||||||
while (typeof projectDBLocation != 'string' || /^[le]/i.test(projectDBLocation[0]) == false) {
|
while (typeof projectDBLocation != 'string' || /^[le]/i.test(projectDBLocation[0]) == false) {
|
||||||
projectDBLocation = await question('Project [l]ocal or [e]xternal database?');
|
projectDBLocation = await question('Project [l]ocal or [e]xternal database?');
|
||||||
@@ -180,7 +183,7 @@ See https://github.com/krgamestudios/MERN-template/wiki for help.
|
|||||||
const defaultHost = tmpHost;
|
const defaultHost = tmpHost;
|
||||||
|
|
||||||
if (defaultUser) {
|
if (defaultUser) {
|
||||||
console.log(`Default user email will be: ${defaultUser}@${authWebAddress}`);
|
console.log(`Default user email will be: ${defaultUser}@${defaultHost}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
//traefic configuration
|
//traefic configuration
|
||||||
@@ -206,6 +209,7 @@ services:
|
|||||||
- traefik.http.routers.${projectName}router.service=${projectName}service@docker
|
- traefik.http.routers.${projectName}router.service=${projectName}service@docker
|
||||||
- traefik.http.services.${projectName}service.loadbalancer.server.port=${projectPort}
|
- traefik.http.services.${projectName}service.loadbalancer.server.port=${projectPort}
|
||||||
environment:
|
environment:
|
||||||
|
- WEB_ORIGIN=${corsWebOrigin}
|
||||||
- WEB_PORT=${projectPort}
|
- WEB_PORT=${projectPort}
|
||||||
- DB_HOSTNAME=${projectDBHost}
|
- DB_HOSTNAME=${projectDBHost}
|
||||||
- DB_PORTNAME=${projectDBPort}
|
- DB_PORTNAME=${projectDBPort}
|
||||||
@@ -238,6 +242,7 @@ services:
|
|||||||
- traefik.http.routers.${newsName}router.service=${newsName}service@docker
|
- traefik.http.routers.${newsName}router.service=${newsName}service@docker
|
||||||
- traefik.http.services.${newsName}service.loadbalancer.server.port=${newsPort}
|
- traefik.http.services.${newsName}service.loadbalancer.server.port=${newsPort}
|
||||||
environment:
|
environment:
|
||||||
|
- WEB_ORIGIN=${corsWebOrigin}
|
||||||
- WEB_PORT=${newsPort}
|
- WEB_PORT=${newsPort}
|
||||||
- DB_HOSTNAME=${newsDBHost}
|
- DB_HOSTNAME=${newsDBHost}
|
||||||
- DB_PORTNAME=${newsDBPort}
|
- DB_PORTNAME=${newsDBPort}
|
||||||
@@ -268,6 +273,7 @@ services:
|
|||||||
- traefik.http.routers.${authName}router.service=${authName}service@docker
|
- traefik.http.routers.${authName}router.service=${authName}service@docker
|
||||||
- traefik.http.services.${authName}service.loadbalancer.server.port=${authPort}
|
- traefik.http.services.${authName}service.loadbalancer.server.port=${authPort}
|
||||||
environment:
|
environment:
|
||||||
|
- WEB_ORIGIN=${corsWebOrigin}
|
||||||
- WEB_PROTOCOL=https
|
- WEB_PROTOCOL=https
|
||||||
- WEB_ADDRESS=${authWebAddress}
|
- WEB_ADDRESS=${authWebAddress}
|
||||||
- HOOK_POST_VALIDATION_ARRAY=${authPostValidationHookArray}
|
- HOOK_POST_VALIDATION_ARRAY=${authPostValidationHookArray}
|
||||||
@@ -309,6 +315,7 @@ services:
|
|||||||
- traefik.http.routers.${chatName}router.service=${chatName}service@docker
|
- traefik.http.routers.${chatName}router.service=${chatName}service@docker
|
||||||
- traefik.http.services.${chatName}service.loadbalancer.server.port=${chatPort}
|
- traefik.http.services.${chatName}service.loadbalancer.server.port=${chatPort}
|
||||||
environment:
|
environment:
|
||||||
|
- WEB_ORIGIN=${corsWebOrigin}
|
||||||
- WEB_PORT=${chatPort}
|
- WEB_PORT=${chatPort}
|
||||||
- DB_HOSTNAME=${chatDBHost}
|
- DB_HOSTNAME=${chatDBHost}
|
||||||
- DB_PORTNAME=${chatDBPort}
|
- DB_PORTNAME=${chatDBPort}
|
||||||
@@ -376,7 +383,7 @@ networks:
|
|||||||
FROM node:22-bookworm-slim
|
FROM node:22-bookworm-slim
|
||||||
WORKDIR "/app"
|
WORKDIR "/app"
|
||||||
COPY . /app
|
COPY . /app
|
||||||
RUN mkdir /app/public
|
RUN mkdir -p /app/public
|
||||||
RUN chown node:node /app/public
|
RUN chown node:node /app/public
|
||||||
RUN npm install --production
|
RUN npm install --production
|
||||||
EXPOSE ${projectPort}
|
EXPOSE ${projectPort}
|
||||||
|
|||||||
Generated
+3084
-2960
File diff suppressed because it is too large
Load Diff
+22
-25
@@ -10,10 +10,7 @@
|
|||||||
"build:client": "webpack --env=production --config webpack.config.js",
|
"build:client": "webpack --env=production --config webpack.config.js",
|
||||||
"dev": "concurrently npm:dev:server npm:dev:client",
|
"dev": "concurrently npm:dev:server npm:dev:client",
|
||||||
"dev:server": "nodemon --ext js,jsx,json --ignore 'node_modules/*'",
|
"dev:server": "nodemon --ext js,jsx,json --ignore 'node_modules/*'",
|
||||||
"dev:client": "webpack serve --env=development --config webpack.config.js",
|
"dev:client": "webpack serve --config webpack.config.js",
|
||||||
"local": "concurrently npm:local:server npm:local:client",
|
|
||||||
"local:server": "nodemon --ext js,jsx,json --ignore 'node_modules/*'",
|
|
||||||
"local:client": "webpack serve --env=local --config webpack.config.js",
|
|
||||||
"analyze": "webpack --env=production --env=analyze --config webpack.config.js"
|
"analyze": "webpack --env=production --env=analyze --config webpack.config.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -27,34 +24,34 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/KRGameStudios/MERN-template#readme",
|
"homepage": "https://github.com/KRGameStudios/MERN-template#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.24.5",
|
"@babel/core": "^7.28.4",
|
||||||
"@babel/preset-env": "^7.24.5",
|
"@babel/preset-env": "^7.28.3",
|
||||||
"@babel/preset-react": "^7.24.1",
|
"@babel/preset-react": "^7.27.1",
|
||||||
"babel-loader": "^9.1.3",
|
"babel-loader": "^10.0.0",
|
||||||
"clean-webpack-plugin": "^4.0.0",
|
"clean-webpack-plugin": "^4.0.0",
|
||||||
"compression-webpack-plugin": "^11.1.0",
|
"compression-webpack-plugin": "^11.1.0",
|
||||||
"concurrently": "^8.2.2",
|
"concurrently": "^9.2.1",
|
||||||
"css-loader": "^7.1.1",
|
"css-loader": "^7.1.2",
|
||||||
"dateformat": "^5.0.3",
|
"dateformat": "^5.0.3",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^17.2.2",
|
||||||
"express": "^4.19.2",
|
"express": "^5.1.0",
|
||||||
"html-webpack-plugin": "^5.6.0",
|
"html-webpack-plugin": "^5.6.4",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"mariadb": "^3.3.0",
|
"mariadb": "^3.4.5",
|
||||||
"react": "^18.3.1",
|
"react": "^19.1.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^19.1.1",
|
||||||
"react-router": "^6.3.0",
|
"react-router": "^7.7.1",
|
||||||
"react-router-dom": "^6.23.0",
|
"react-router-dom": "^7.8.2",
|
||||||
"react-select": "^5.8.0",
|
"react-select": "^5.10.2",
|
||||||
"sequelize": "^6.37.3",
|
"sequelize": "^6.37.7",
|
||||||
"socket.io-client": "^4.7.5",
|
"socket.io-client": "^4.8.1",
|
||||||
"style-loader": "^4.0.0",
|
"style-loader": "^4.0.0",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.101.3",
|
||||||
"webpack-bundle-analyzer": "^4.10.2",
|
"webpack-bundle-analyzer": "^4.10.2",
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^6.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^3.1.0",
|
"nodemon": "^3.1.10",
|
||||||
"webpack-dev-server": "^5.0.4"
|
"webpack-dev-server": "^5.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -13,14 +13,14 @@ const server = require('http').Server(app);
|
|||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
//handle compressed files (middleware)
|
//handle compressed files (middleware)
|
||||||
app.get('*.js', (req, res, next) => {
|
app.get('/{*any}.js', (req, res, next) => {
|
||||||
req.url = req.url + '.gz';
|
req.url = req.url + '.gz';
|
||||||
res.set('Content-Encoding', 'gzip');
|
res.set('Content-Encoding', 'gzip');
|
||||||
res.set('Content-Type', 'text/javascript');
|
res.set('Content-Type', 'text/javascript');
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('*.css', (req, res, next) => {
|
app.get('/{*any}.css', (req, res, next) => {
|
||||||
req.url = req.url + '.gz';
|
req.url = req.url + '.gz';
|
||||||
res.set('Content-Encoding', 'gzip');
|
res.set('Content-Encoding', 'gzip');
|
||||||
res.set('Content-Type', 'text/css');
|
res.set('Content-Type', 'text/css');
|
||||||
@@ -34,7 +34,7 @@ const database = require('./database');
|
|||||||
app.use('/', express.static(path.resolve(__dirname, '..', 'public')));
|
app.use('/', express.static(path.resolve(__dirname, '..', 'public')));
|
||||||
|
|
||||||
//fallback to the index file
|
//fallback to the index file
|
||||||
app.get('*', (req, res) => {
|
app.get('/{*any}', (req, res) => {
|
||||||
res.sendFile(path.resolve(__dirname, '..', 'public' , 'index.html'));
|
res.sendFile(path.resolve(__dirname, '..', 'public' , 'index.html'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -9,7 +9,7 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
//the exported config function
|
//the exported config function
|
||||||
module.exports = ({ production, development, local, analyze }) => {
|
module.exports = ({ production, analyze }) => {
|
||||||
return {
|
return {
|
||||||
mode: production ? "production" : "development",
|
mode: production ? "production" : "development",
|
||||||
entry: path.resolve(__dirname, 'client', 'client.jsx'),
|
entry: path.resolve(__dirname, 'client', 'client.jsx'),
|
||||||
@@ -33,7 +33,6 @@ module.exports = ({ production, development, local, analyze }) => {
|
|||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
presets: ['@babel/preset-env', '@babel/preset-react'],
|
presets: ['@babel/preset-env', '@babel/preset-react'],
|
||||||
plugins: ['@babel/plugin-syntax-dynamic-import']
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -48,9 +47,9 @@ module.exports = ({ production, development, local, analyze }) => {
|
|||||||
new DefinePlugin({
|
new DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'PRODUCTION': production,
|
'PRODUCTION': production,
|
||||||
'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : development ? '"https://dev-news.krgamestudios.com"' : '"http://localhost:3100"',
|
'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"http://localhost:3100"',
|
||||||
'AUTH_URI': production ? `"${process.env.AUTH_URI}"` : development ? '"https://dev-auth.krgamestudios.com"' : '"http://localhost:3200"',
|
'AUTH_URI': production ? `"${process.env.AUTH_URI}"` : '"http://localhost:3200"',
|
||||||
'CHAT_URI': production ? `"${process.env.CHAT_URI}"` : development ? '"https://dev-chat.krgamestudios.com"' : '"http://localhost:3300"',
|
'CHAT_URI': production ? `"${process.env.CHAT_URI}"` : '"http://localhost:3300"',
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new CleanWebpackPlugin({
|
new CleanWebpackPlugin({
|
||||||
|
|||||||
Reference in New Issue
Block a user