Initialisation du projet : Electron + Vite + React + TypeScript, Vitest, CI Windows
Some checks are pending
CI / windows (push) Waiting to run
Some checks are pending
CI / windows (push) Waiting to run
This commit is contained in:
commit
afb305b3e8
15 changed files with 6166 additions and 0 deletions
26
src/main/index.ts
Normal file
26
src/main/index.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { join } from 'node:path'
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
|
||||
function createWindow(): BrowserWindow {
|
||||
const win = new BrowserWindow({
|
||||
width: 1600,
|
||||
height: 900,
|
||||
fullscreen: !process.env.ELECTRON_RENDERER_URL,
|
||||
backgroundColor: '#0a0a0a',
|
||||
autoHideMenuBar: true,
|
||||
show: false,
|
||||
webPreferences: {
|
||||
preload: join(__dirname, '../preload/index.js'),
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
sandbox: true
|
||||
}
|
||||
})
|
||||
win.once('ready-to-show', () => win.show())
|
||||
if (process.env.ELECTRON_RENDERER_URL) win.loadURL(process.env.ELECTRON_RENDERER_URL)
|
||||
else win.loadFile(join(__dirname, '../renderer/index.html'))
|
||||
return win
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
app.on('window-all-closed', () => app.quit())
|
||||
3
src/preload/index.ts
Normal file
3
src/preload/index.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { contextBridge } from 'electron'
|
||||
|
||||
contextBridge.exposeInMainWorld('orbe', { version: process.versions.electron })
|
||||
12
src/renderer/index.html
Normal file
12
src/renderer/index.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' data: orbe-media: orbe-theme:; media-src 'self' orbe-theme:; font-src 'self' orbe-theme:; style-src 'self' 'unsafe-inline' orbe-theme:; script-src 'self'; connect-src 'self' orbe-theme:">
|
||||
<title>Orbe Launcher</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
3
src/renderer/src/App.tsx
Normal file
3
src/renderer/src/App.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export function App() {
|
||||
return <main>Orbe Launcher</main>
|
||||
}
|
||||
4
src/renderer/src/main.tsx
Normal file
4
src/renderer/src/main.tsx
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { createRoot } from 'react-dom/client'
|
||||
import { App } from './App'
|
||||
|
||||
createRoot(document.getElementById('root')!).render(<App />)
|
||||
Loading…
Add table
Add a link
Reference in a new issue