Skip to content

Commit

Permalink
updated frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
jskonst committed Feb 10, 2024
1 parent 45eedf2 commit 3fb7edb
Show file tree
Hide file tree
Showing 10 changed files with 38,912 additions and 16,683 deletions.
7 changes: 7 additions & 0 deletions onlineshop/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
HELLO=app
HTTPS=true
NODE_ENV=development
SERVER_HOST=localhost
SERVER_PORT=3000
SERVER_WEB_HOST=localhost
SERVER_WEB_PORT=4000
36,002 changes: 21,900 additions & 14,102 deletions onlineshop/source/client/package-lock.json

Large diffs are not rendered by default.

30 changes: 17 additions & 13 deletions onlineshop/source/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.9",
"@mui/material": "^5.15.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.0",
"react-scripts": "5.0.1",
"web-vitals": "^3.5.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint src --ext .js --ext .jsx --ext .ts --ext .tsx",
"lint:fix": "npm run lint -- --fix"
"build": "webpack",
"dev": "env-cmd -f ./../../.env npm run start:dev",
"start:dev": "webpack serve --color",
"test": "jest",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -42,13 +47,12 @@
"@types/node": "^20.11.17",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^3.2.5",
"typescript": "^5.3.3"
"env-cmd": "^10.1.0",
"sass": "^1.70.0",
"sass-loader": "^14.1.0",
"ts-loader": "^9.5.1",
"typescript": "^5.3.3",
"webpack": "^5.90.1",
"webpack-cli": "^5.1.4"
}
}
2 changes: 0 additions & 2 deletions onlineshop/source/client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React from 'react';

import logo from './logo.svg';
import './App.css';

const App: React.FC = () => (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
Expand Down
4 changes: 2 additions & 2 deletions onlineshop/source/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"esnext"
],
"allowJs": true,
"sourceMap": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
Expand All @@ -18,8 +19,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": ".",
"jsx": "react-jsx"
},
"include": [
"src"
Expand Down
98 changes: 98 additions & 0 deletions onlineshop/source/client/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

const {
NODE_ENV,
SERVER_HOST,
SERVER_PORT,
SERVER_WEB_HOST,
SERVER_WEB_PORT,
} = process.env;

const proxy = `http://${SERVER_HOST}:${SERVER_PORT}`;
console.log(proxy);

module.exports = {
mode: NODE_ENV || 'production',
entry: "./src/index.tsx",
devtool: NODE_ENV !== 'production' ? 'inline-source-map' : '',
output: {
publicPath: "/",
filename: "bundle.js",
path: path.resolve(__dirname, "dist")
},

resolve: {
extensions: [".ts", ".tsx", ".js", ".json"]
},

module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
compilerOptions: {noEmit: false},
}
}
],
exclude: /node_modules/,
},
{
test: /\.(css|s[ac]ss)$/i,
use: [
{ loader: 'style-loader' },
{
loader: "css-loader", options: {
importLoaders: 1,
// modules: true
}
},
"sass-loader"
]
},
{
test: /\.(png|jpe?g|gif|svg$)$/i,
use: [
{
loader: 'file-loader',
},
],
},
]
},

plugins: [
new HtmlWebpackPlugin({
template: "./public/index.html",
favicon: "./public/favicon.ico",
filename: "index.html",
inject: "body",
hash: true
})
],

devServer: {
allowedHosts: [
SERVER_HOST,
'localhost',
],
historyApiFallback: true,
open: true,
hot: true,
host: SERVER_WEB_HOST,
port: SERVER_WEB_PORT,
proxy: {
'/api': proxy,
'/acc': proxy,
'/auth': proxy,
'/socket.io': {
target: proxy,
ws: true
},
'/images': proxy
}
}
};
Loading

0 comments on commit 3fb7edb

Please sign in to comment.