Compare commits
3 commits
acdb23ab72
...
14e932a44c
| Author | SHA1 | Date | |
|---|---|---|---|
|
14e932a44c |
|||
|
6c8ea122cd |
|||
|
73cb54ad4f |
10 changed files with 3269 additions and 0 deletions
152
.gitignore
vendored
Normal file
152
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
# From https://raw.githubusercontent.com/github/gitignore/refs/heads/main/Node.gitignore
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
.output
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp directory
|
||||
.temp
|
||||
|
||||
# Sveltekit cache directory
|
||||
.svelte-kit/
|
||||
|
||||
# vitepress build output
|
||||
**/.vitepress/dist
|
||||
|
||||
# vitepress cache directory
|
||||
**/.vitepress/cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# Firebase cache directory
|
||||
.firebase/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores Visual Studio Code versions used for testing Visual Studio Code extensions
|
||||
.vscode-test
|
||||
|
||||
# pnpm
|
||||
.pnpm-store
|
||||
|
||||
# yarn v3
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
# Vite files
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
.vite/
|
||||
|
||||
# Astro generated types
|
||||
.astro/
|
||||
|
||||
# Turbo Repo
|
||||
.turbo
|
||||
|
||||
22
eslint.config.js
Normal file
22
eslint.config.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import reactHooks from 'eslint-plugin-react-hooks'
|
||||
import reactRefresh from 'eslint-plugin-react-refresh'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import { defineConfig, globalIgnores } from 'eslint/config'
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
reactHooks.configs.flat.recommended,
|
||||
reactRefresh.configs.vite,
|
||||
],
|
||||
languageOptions: {
|
||||
globals: globals.browser,
|
||||
},
|
||||
},
|
||||
])
|
||||
2905
package-lock.json
generated
Normal file
2905
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
30
package.json
Normal file
30
package.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev:render": "vite --mode renderer",
|
||||
"dev:build": "vite build --mode renderer",
|
||||
"dev:electron": "NODE_NO_WARNINGS=1 electron src/main/main.ts",
|
||||
"dev": "NODE_NO_WARNINGS=1 npm run dev:render & npm run dev:electron"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.3.1",
|
||||
"react-dom": "^19.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@types/node": "^24.19.2",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@vitejs/plugin-react": "^6.1.2",
|
||||
"electron": "^45.0.0",
|
||||
"eslint": "^10.13.0",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.7",
|
||||
"globals": "^17.13.0",
|
||||
"typescript": "~6.0.3",
|
||||
"typescript-eslint": "^8.71.2",
|
||||
"vite": "^8.3.4"
|
||||
}
|
||||
}
|
||||
39
src/main/main.ts
Normal file
39
src/main/main.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { app, BrowserWindow } from "electron"
|
||||
import { fileURLToPath, format } from "node:url"
|
||||
import path from "node:path"
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
||||
const distRendererPath = path.join(__dirname, "../../release/app/dist/renderer/")
|
||||
//console.log(distRendererPath)
|
||||
|
||||
// Reference: https://www.electronjs.org/docs/latest/api/browser-window
|
||||
const fileURL = format({
|
||||
protocol: "file",
|
||||
slashes: true,
|
||||
pathname: path.join(distRendererPath, "index.html")
|
||||
})
|
||||
|
||||
const mainWindowInit = () => {
|
||||
const window = new BrowserWindow({
|
||||
width: 1280,
|
||||
height: 720
|
||||
})
|
||||
|
||||
window.loadURL("http://localhost:5173").then(
|
||||
// NOTE: On reject...
|
||||
() => {
|
||||
console.log("Using vite server...")
|
||||
}),
|
||||
// NOTE: On fulfill...
|
||||
() => {
|
||||
console.log("No vite server found!\nUsing dist files...")
|
||||
window.loadURL(fileURL)
|
||||
}
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
mainWindowInit()
|
||||
})
|
||||
|
||||
18
src/renderer/index.html
Normal file
18
src/renderer/index.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<!-- NOTE: Remember to add an icon for this evetually -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="A sample electron app" />
|
||||
<title>Sample Electron App</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>Javascript is NOT enabled! Please enable it to ensure functionality</noscript>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./src/main.tsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
11
src/renderer/src/app/index.tsx
Normal file
11
src/renderer/src/app/index.tsx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function App() {
|
||||
return (
|
||||
<>
|
||||
<body>
|
||||
hello this is a new test!
|
||||
</body>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
||||
10
src/renderer/src/main.tsx
Normal file
10
src/renderer/src/main.tsx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { createRoot } from "react-dom/client"
|
||||
import App from "@/src/app"
|
||||
|
||||
const root = document.getElementById("root")
|
||||
|
||||
if (!root) throw new Error("Root element NOT found!")
|
||||
|
||||
createRoot(root).render(
|
||||
<App />
|
||||
)
|
||||
39
tsconfig.json
Normal file
39
tsconfig.json
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2023",
|
||||
"lib": ["ES2023", "DOM"],
|
||||
"module": "esnext",
|
||||
"types": ["vite/client", "react", "node"],
|
||||
"allowArbitraryExtensions": true,
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
||||
/* Other */
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"allowJs": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"strict": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
|
||||
"paths": {
|
||||
"@/*": ["./src/renderer/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
43
vite.config.ts
Normal file
43
vite.config.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import path from "node:path"
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
const rootDirectory = import.meta.dirname
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
if (mode === "renderer") {
|
||||
return {
|
||||
root: path.join(rootDirectory, "/src/renderer"),
|
||||
base: path.join(rootDirectory, "/release/app/dist/renderer"),
|
||||
input: "index.html",
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
// NOTE: Very important to set tsconfigPaths = true
|
||||
// For compatibility with pathing of your web program
|
||||
tsconfigPaths: true
|
||||
},
|
||||
build: {
|
||||
outDir: path.join(rootDirectory, "/release/app/dist/renderer"),
|
||||
emptyOutDir: true,
|
||||
rolldownOptions: {
|
||||
cwd: path.join(rootDirectory, "/src/renderer/"),
|
||||
output: { entryFileNames: "renderer.js" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
/*
|
||||
return {
|
||||
renderer: {
|
||||
root: path.join(rootDirectory, "src/renderer"),
|
||||
base: "./"
|
||||
}
|
||||
}
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue