-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: electron integrate with react (for basic setting)
- Loading branch information
Showing
16 changed files
with
6,955 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,51 @@ | ||
{ | ||
"private": true, | ||
"main": "main/index.js", | ||
"main": "dist/index.js", | ||
"productName": "huntly", | ||
"scripts": { | ||
"clean": "rimraf dist main", | ||
"dev": "npm run build-electron && electron .", | ||
"build-electron": "tsc -p src", | ||
"clean": "rimraf dist", | ||
"start:renderer": "webpack --config webpack/webpack.dev.js --watch", | ||
"dev": "webpack --config webpack/webpack.dev.js && npm run build-electron && electron .", | ||
"build-electron": "tsc -p src/main", | ||
"build": "npm run build-electron", | ||
"pack-app": "npm run build && electron-builder --dir", | ||
"dist": "npm run build && electron-builder", | ||
"type-check": "tsc -p src/tsconfig.json", | ||
"type-check": "tsc -p src/main/tsconfig.json", | ||
"lint": "eslint ." | ||
}, | ||
"dependencies": { | ||
"app-root-path": "^3.1.0", | ||
"electron-is-dev": "^1.2.0", | ||
"electron-window-state": "^5.0.3" | ||
"electron-window-state": "^5.0.3", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@electron-forge/cli": "^6.0.5", | ||
"@electron-forge/plugin-webpack": "^6.0.5", | ||
"@types/node": "^17.0.40", | ||
"@types/react": "^18.0.30", | ||
"@types/react-dom": "^18.0.11", | ||
"@typescript-eslint/eslint-plugin": "^5.27.1", | ||
"@typescript-eslint/parser": "^5.27.1", | ||
"copy-webpack-plugin": "^11.0.0", | ||
"css-loader": "^6.7.3", | ||
"electron": "^19.0.3", | ||
"electron-builder": "^23.0.3", | ||
"electron-forge": "^5.2.4", | ||
"eslint": "^8.17.0", | ||
"rimraf": "^3.0.0", | ||
"typescript": "^4.7.3" | ||
"style-loader": "^3.3.2", | ||
"ts-loader": "^9.4.2", | ||
"typescript": "^4.7.3", | ||
"webpack": "^5.76.3", | ||
"webpack-cli": "^5.0.1", | ||
"webpack-merge": "^5.8.0" | ||
}, | ||
"build": { | ||
"asar": true, | ||
"files": [ | ||
"main" | ||
"dist" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Huntly Extension Options</title> | ||
<script src="vendor.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script src="app.js"></script> | ||
</body> | ||
</html> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {createRoot} from "react-dom/client"; | ||
|
||
export default function App() { | ||
//todo add basic setting modal | ||
return <div>hello</div> | ||
} | ||
|
||
const root = createRoot( | ||
document.getElementById("root") as HTMLElement | ||
); | ||
|
||
root.render( | ||
<App/> | ||
); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"incremental": true, | ||
"target": "es2021", | ||
"module": "commonjs", | ||
"lib": ["dom", "es2021"], | ||
"jsx": "react-jsx", | ||
"strict": true, | ||
"sourceMap": true, | ||
"baseUrl": "./src", | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"resolveJsonModule": true, | ||
"allowJs": true, | ||
}, | ||
"exclude": ["test", "release/build", "release/app/dist"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const webpack = require("webpack"); | ||
const path = require("path"); | ||
const CopyPlugin = require("copy-webpack-plugin"); | ||
const srcDir = path.join(__dirname, "..", "src/renderer"); | ||
|
||
module.exports = { | ||
entry: { | ||
app: path.join(srcDir, 'App.tsx'), | ||
}, | ||
output: { | ||
path: path.join(__dirname, "../dist/renderer/"), | ||
filename: "[name].js", | ||
}, | ||
optimization: { | ||
splitChunks: { | ||
name: "vendor", | ||
}, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/i, | ||
use: [ | ||
{loader: "style-loader"}, | ||
{loader: "css-loader"} | ||
] | ||
}, | ||
{ | ||
test: /\.tsx?$/, | ||
use: "ts-loader", | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: [".ts", ".tsx", ".js", ".css"], | ||
}, | ||
plugins: [ | ||
new CopyPlugin({ | ||
patterns: [{from: ".", to: "../", context: "public"}], | ||
options: {}, | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const { merge } = require('webpack-merge'); | ||
const common = require('./webpack.common.js'); | ||
|
||
module.exports = merge(common, { | ||
devtool: 'inline-source-map', | ||
mode: 'development', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { merge } = require('webpack-merge'); | ||
const common = require('./webpack.common.js'); | ||
|
||
module.exports = merge(common, { | ||
mode: 'production' | ||
}); |
Oops, something went wrong.