Add react

This commit is contained in:
Tobias Hopp 2024-03-26 19:30:49 +01:00
parent 35e36a7bbb
commit 6e163f67d5
11 changed files with 12640 additions and 1131 deletions

View File

@ -16,7 +16,11 @@ const config: ForgeConfig = {
asar: true, asar: true,
}, },
rebuildConfig: {}, rebuildConfig: {},
makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin']), new MakerRpm({}), new MakerDeb({})], makers: [
new MakerSquirrel({}),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerDeb({})],
plugins: [ plugins: [
new AutoUnpackNativesPlugin({}), new AutoUnpackNativesPlugin({}),
new WebpackPlugin({ new WebpackPlugin({

11479
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
{ {
"name": "my-app", "name": "smart-monopoly",
"productName": "my-app", "productName": "Smart Monopoly",
"version": "1.0.0", "version": "1.0.0",
"description": "My Electron application description", "description": "Make Monopoly Game Smart - Make paper obsolete!",
"main": ".webpack/main", "main": ".webpack/main",
"scripts": { "scripts": {
"start": "electron-forge start", "start": "electron-forge start",
@ -21,6 +21,8 @@
"@electron-forge/plugin-fuses": "^7.2.0", "@electron-forge/plugin-fuses": "^7.2.0",
"@electron-forge/plugin-webpack": "^7.3.1", "@electron-forge/plugin-webpack": "^7.3.1",
"@electron/fuses": "^1.7.0", "@electron/fuses": "^1.7.0",
"@types/react": "^18.2.71",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0", "@typescript-eslint/parser": "^5.0.0",
"@vercel/webpack-asset-relocator-loader": "1.7.3", "@vercel/webpack-asset-relocator-loader": "1.7.3",
@ -42,6 +44,8 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"electron-squirrel-startup": "^1.0.0" "electron-squirrel-startup": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
} }
} }

4
src/App.tsx Normal file
View File

@ -0,0 +1,4 @@
import { createRoot } from 'react-dom/client';
const root = createRoot(document.getElementById("root"));
root.render(<h2>Hello from React!</h2>);

View File

@ -2,6 +2,6 @@ body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
Arial, sans-serif; Arial, sans-serif;
margin: auto; margin: auto;
max-width: 38rem; /*max-width: 38rem;*/
padding: 2rem; padding: 1rem;
} }

View File

@ -1,12 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="de">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Hello World!</title> <title>SmartMonopoly</title>
</head> </head>
<body> <body>
<h1>💖 Hello World!</h1> <div id="root">
<p>Welcome to your Electron application.</p> <!-- This element's contents will be replaced with your component. -->
</div>
</body> </body>
</html> </html>

View File

@ -13,8 +13,9 @@ if (require('electron-squirrel-startup')) {
const createWindow = (): void => { const createWindow = (): void => {
// Create the browser window. // Create the browser window.
const mainWindow = new BrowserWindow({ const mainWindow = new BrowserWindow({
height: 600, height: 1920,
width: 800, width: 1080,
center: true,
webPreferences: { webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY, preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
}, },
@ -22,9 +23,6 @@ const createWindow = (): void => {
// and load the index.html of the app. // and load the index.html of the app.
mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY); mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);
// Open the DevTools.
mainWindow.webContents.openDevTools();
}; };
// This method will be called when Electron has finished // This method will be called when Electron has finished

View File

@ -26,6 +26,10 @@
* ``` * ```
*/ */
import './reset.css';
import './index.css'; import './index.css';
console.log('👋 This message is being logged by "renderer.js", included via webpack'); //console.log('👋 This message is being logged by "renderer.js", included via webpack');
// Add this to the end of the existing file
import './App';

48
src/reset.css Normal file
View File

@ -0,0 +1,48 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}

View File

@ -13,7 +13,8 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"paths": { "paths": {
"*": ["node_modules/*"] "*": ["node_modules/*"]
} },
"jsx": "react-jsx"
}, },
"include": ["src/**/*"] "include": ["src/**/*"]
} }

2104
yarn.lock

File diff suppressed because it is too large Load Diff