Skip to content

feat: electron app init & setup #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apps/electron/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import", "prettier"],
"rules": {
"prettier/prettier": "error"
},
"settings": {
"import/resolver": {
"typescript": {}
}
}
}
96 changes: 96 additions & 0 deletions apps/electron/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# 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
.DS_Store

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Webpack
.webpack/

# Vite
.vite/

# Electron-Forge
out/

# Swift Build
.build/
bin/
1 change: 1 addition & 0 deletions apps/electron/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node-linker = hoisted
9 changes: 9 additions & 0 deletions apps/electron/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"endOfLine": "auto"
}
22 changes: 22 additions & 0 deletions apps/electron/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"configurations": [
{
"type": "swift",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:amical-app}/src/helper/swift/KeyTapHelper",
"name": "Debug KeyTapHelper (src/helper/swift/KeyTapHelper)",
"program": "${workspaceFolder:amical-app}/src/helper/swift/KeyTapHelper/.build/debug/KeyTapHelper",
"preLaunchTask": "swift: Build Debug KeyTapHelper (src/helper/swift/KeyTapHelper)"
},
{
"type": "swift",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:amical-app}/src/helper/swift/KeyTapHelper",
"name": "Release KeyTapHelper (src/helper/swift/KeyTapHelper)",
"program": "${workspaceFolder:amical-app}/src/helper/swift/KeyTapHelper/.build/release/KeyTapHelper",
"preLaunchTask": "swift: Build Release KeyTapHelper (src/helper/swift/KeyTapHelper)"
}
]
}
3 changes: 3 additions & 0 deletions apps/electron/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
21 changes: 21 additions & 0 deletions apps/electron/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/styles/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
10 changes: 10 additions & 0 deletions apps/electron/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Config } from 'drizzle-kit';

export default {
schema: './src/db/schema.ts',
out: './src/db/migrations',
dialect: 'sqlite',
dbCredentials: {
url: 'file:./db.sqlite',
},
} satisfies Config;
27 changes: 27 additions & 0 deletions apps/electron/fab.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Floating Button</title>
<style>
body {
margin: 0;
overflow: hidden; /* Prevent scrollbars on the tiny window */
background-color: transparent; /* Ensure body is transparent */
font-family: sans-serif;
}
#root {
width: 100%;
height: 100%;
display: flex;
align-items: flex-end; /* Align to bottom */
justify-content: center; /* Center horizontally */
}
</style>
</head>
<body>
<div id="root" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0;"></div>
<!-- This script tag will point to the TSX file for Vite to process -->
<script type="module" src="src/renderer/fab.tsx"></script>
</body>
</html>
68 changes: 68 additions & 0 deletions apps/electron/forge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import type { ForgeConfig } from '@electron-forge/shared-types';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
import { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { MakerDMG } from '@electron-forge/maker-dmg';
import { VitePlugin } from '@electron-forge/plugin-vite';
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';

const config: ForgeConfig = {
packagerConfig: {
asar: true,
extraResource: ['src/helper/bin'],
extendInfo: {
NSMicrophoneUsageDescription: "This app needs access to your microphone to record audio for transcription.",
},
},
rebuildConfig: {},
makers: [
new MakerSquirrel({}),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerDeb({}),
],
plugins: [
new VitePlugin({
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
// If you are familiar with Vite configuration, it will look really familiar.
build: [
{
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
entry: 'src/main/main.ts',
config: 'vite.main.config.ts',
target: 'main',
},
{
entry: 'src/main/preload.ts',
config: 'vite.preload.config.ts',
target: 'preload',
},
],
renderer: [
{
name: 'main_window',
config: 'vite.renderer.config.ts',
},
{
name: 'widget_window',
config: 'vite.widget.config.ts',
},
],
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};

export default config;
1 change: 1 addition & 0 deletions apps/electron/forge.env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@electron-forge/plugin-vite/forge-vite-env" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$ref": "#/definitions/RpcRequest",
"definitions": {
"RpcRequest": {
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"method": {
"type": "string",
"enum": [
"getAccessibilityTreeDetails",
"pasteText",
"muteSystemAudio",
"restoreSystemAudio"
]
},
"params": {}
},
"required": [
"id",
"method"
],
"additionalProperties": false
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$ref": "#/definitions/RpcResponse",
"definitions": {
"RpcResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"result": {},
"error": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"message": {
"type": "string"
},
"data": {}
},
"required": [
"code",
"message"
],
"additionalProperties": false
}
},
"required": [
"id"
],
"additionalProperties": false
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
Loading
Loading