Skip to content

Commit 42f9fdd

Browse files
committed
.
1 parent 1dd3f08 commit 42f9fdd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1601
-2355
lines changed

.eslintrc.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

AGENTS.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
5+
- Source lives in `src/`:
6+
- `src/app/main` (Electron main process)
7+
- `src/app/preload` (context bridge, `electronAPI.ts`)
8+
- `src/app/renderer` (Vue 3 UI, components in `components/`)
9+
- Shared utilities: `src/utils/`, domain libs: `src/lib/`, types: `src/types/`.
10+
- Static assets: `public/assets/`. Built‑in widgets and config: `public/widgets/` + `public/widgets/widgets.json` (update when adding a widget). Example: add `public/widgets/my widget/` and append an entry in `widgets.json` with size/position fields.
11+
- Build/packaging config: `forge.config.ts`, `vite.*.config.ts`, Tailwind: `tailwind.config.js`.
12+
13+
## Build, Test, and Development Commands
14+
15+
- `npm install` — install dependencies.
16+
- `npm start` — run app in dev with Vite HMR + Electron Forge.
17+
- `npm run make` — create installers/bundles for the host OS.
18+
- `npm run package` — package app without creating installers.
19+
- `npm run publish` — publish via GitHub (used by CI on tags `v*`).
20+
- `npm run lint` — ESLint for TS/JS.
21+
22+
CI: Push/PR runs `.github/workflows/build.yml`. Tags `v*` trigger publish.
23+
24+
## Coding Style & Naming Conventions
25+
26+
- Language: TypeScript (strict). Lint with ESLint (`@typescript-eslint`, import rules). Fix issues before PR.
27+
- Format with Prettier 3 (honor repo config). Keep Vue components PascalCase (e.g., `Navbar.vue`), variables/function names camelCase, constants UPPER_SNAKE_CASE.
28+
- Place shared types in `src/types/`. Keep renderer‑safe code out of `main`.
29+
30+
## Testing Guidelines
31+
32+
- No formal test suite yet. Prefer adding: Vitest (renderer/utils) and lightweight smoke tests for `main`/preload.
33+
- Suggested layout: `src/**/__tests__` or `tests/`.
34+
- Ensure `npm start` works locally and core flows are exercised.
35+
36+
## Commit & Pull Request Guidelines
37+
38+
- Use Conventional Commits when possible: `feat:`, `fix:`, `chore:`, `docs:` (e.g., `feat(renderer): add settings menu`).
39+
- Keep subjects imperative and ≤72 chars. Reference issues (`#123`).
40+
- PRs: clear description, reproduction/testing notes, and screenshots/GIFs for UI changes. Require `npm run lint` clean and a local `npm run make` sanity check.
41+
42+
## Security & Configuration Tips
43+
44+
- Do not expose Node APIs directly to the renderer; route via preload (`src/app/preload/`).
45+
- Do not commit secrets. Releases use `GITHUB_TOKEN` in CI only.

biome.json

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.7/schema.json",
3+
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4+
"files": { "ignoreUnknown": false },
5+
"formatter": {
6+
"enabled": true,
7+
"formatWithErrors": false,
8+
"indentStyle": "space",
9+
"indentWidth": 2,
10+
"lineEnding": "lf",
11+
"lineWidth": 80,
12+
"attributePosition": "auto",
13+
"bracketSameLine": false,
14+
"bracketSpacing": true,
15+
"expand": "auto",
16+
"useEditorconfig": true
17+
},
18+
"linter": {
19+
"enabled": true,
20+
"rules": {
21+
"recommended": false,
22+
"complexity": {
23+
"noAdjacentSpacesInRegex": "error",
24+
"noExtraBooleanCast": "error",
25+
"noUselessCatch": "error",
26+
"noUselessEscapeInRegex": "error",
27+
"noUselessThisAlias": "error",
28+
"noUselessTypeConstraint": "error"
29+
},
30+
"correctness": {
31+
"noConstAssign": "error",
32+
"noConstantCondition": "error",
33+
"noEmptyCharacterClassInRegex": "error",
34+
"noEmptyPattern": "error",
35+
"noGlobalObjectCalls": "error",
36+
"noInnerDeclarations": "error",
37+
"noInvalidConstructorSuper": "error",
38+
"noNonoctalDecimalEscape": "error",
39+
"noPrecisionLoss": "error",
40+
"noSelfAssign": "error",
41+
"noSetterReturn": "error",
42+
"noSwitchDeclarations": "error",
43+
"noUndeclaredVariables": "error",
44+
"noUnreachable": "error",
45+
"noUnreachableSuper": "error",
46+
"noUnsafeFinally": "error",
47+
"noUnsafeOptionalChaining": "error",
48+
"noUnusedLabels": "error",
49+
"noUnusedVariables": "error",
50+
"useIsNan": "error",
51+
"useValidForDirection": "error",
52+
"useValidTypeof": "error",
53+
"useYield": "error"
54+
},
55+
"style": {
56+
"noCommonJs": "error",
57+
"noNamespace": "error",
58+
"useArrayLiterals": "error",
59+
"useAsConstAssertion": "error"
60+
},
61+
"suspicious": {
62+
"noAssignInExpressions": "error",
63+
"noAsyncPromiseExecutor": "error",
64+
"noCatchAssign": "error",
65+
"noClassAssign": "error",
66+
"noCompareNegZero": "error",
67+
"noControlCharactersInRegex": "error",
68+
"noDebugger": "error",
69+
"noDuplicateCase": "error",
70+
"noDuplicateClassMembers": "error",
71+
"noDuplicateElseIf": "error",
72+
"noDuplicateObjectKeys": "error",
73+
"noDuplicateParameters": "error",
74+
"noEmptyBlockStatements": "error",
75+
"noExplicitAny": "error",
76+
"noExtraNonNullAssertion": "error",
77+
"noFallthroughSwitchClause": "error",
78+
"noFunctionAssign": "error",
79+
"noGlobalAssign": "error",
80+
"noImportAssign": "error",
81+
"noIrregularWhitespace": "error",
82+
"noMisleadingCharacterClass": "error",
83+
"noMisleadingInstantiator": "error",
84+
"noPrototypeBuiltins": "error",
85+
"noRedeclare": "error",
86+
"noShadowRestrictedNames": "error",
87+
"noSparseArray": "error",
88+
"noTsIgnore": "error",
89+
"noUnsafeDeclarationMerging": "error",
90+
"noUnsafeNegation": "error",
91+
"noUselessRegexBackrefs": "error",
92+
"noWith": "error",
93+
"useGetterReturn": "error",
94+
"useNamespaceKeyword": "error"
95+
}
96+
}
97+
},
98+
"javascript": {
99+
"formatter": {
100+
"jsxQuoteStyle": "double",
101+
"quoteProperties": "asNeeded",
102+
"trailingCommas": "all",
103+
"semicolons": "asNeeded",
104+
"arrowParentheses": "always",
105+
"bracketSameLine": false,
106+
"quoteStyle": "single",
107+
"attributePosition": "auto",
108+
"bracketSpacing": true
109+
}
110+
},
111+
"html": { "formatter": { "selfCloseVoidElements": "always" } },
112+
"overrides": [
113+
{
114+
"includes": ["*.ts", "*.tsx", "*.mts", "*.cts"],
115+
"linter": {
116+
"rules": {
117+
"complexity": { "noArguments": "error" },
118+
"correctness": {
119+
"noConstAssign": "off",
120+
"noGlobalObjectCalls": "off",
121+
"noInvalidBuiltinInstantiation": "off",
122+
"noInvalidConstructorSuper": "off",
123+
"noSetterReturn": "off",
124+
"noUndeclaredVariables": "off",
125+
"noUnreachable": "off",
126+
"noUnreachableSuper": "off"
127+
},
128+
"style": { "useConst": "error" },
129+
"suspicious": {
130+
"noDuplicateClassMembers": "off",
131+
"noDuplicateObjectKeys": "off",
132+
"noDuplicateParameters": "off",
133+
"noFunctionAssign": "off",
134+
"noImportAssign": "off",
135+
"noRedeclare": "off",
136+
"noUnsafeNegation": "off",
137+
"noVar": "error",
138+
"useGetterReturn": "off"
139+
}
140+
}
141+
}
142+
},
143+
{
144+
"includes": ["*.ts", "*.tsx", "*.mts", "*.cts"],
145+
"linter": {
146+
"rules": {
147+
"complexity": { "noArguments": "error" },
148+
"correctness": {
149+
"noConstAssign": "off",
150+
"noGlobalObjectCalls": "off",
151+
"noInvalidBuiltinInstantiation": "off",
152+
"noInvalidConstructorSuper": "off",
153+
"noSetterReturn": "off",
154+
"noUndeclaredVariables": "off",
155+
"noUnreachable": "off",
156+
"noUnreachableSuper": "off"
157+
},
158+
"style": { "useConst": "error" },
159+
"suspicious": {
160+
"noDuplicateClassMembers": "off",
161+
"noDuplicateObjectKeys": "off",
162+
"noDuplicateParameters": "off",
163+
"noFunctionAssign": "off",
164+
"noImportAssign": "off",
165+
"noRedeclare": "off",
166+
"noUnsafeNegation": "off",
167+
"noVar": "error",
168+
"useGetterReturn": "off"
169+
}
170+
}
171+
}
172+
}
173+
],
174+
"assist": {
175+
"enabled": true,
176+
"actions": { "source": { "organizeImports": "on" } }
177+
}
178+
}

forge.config.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import type { ForgeConfig } from "@electron-forge/shared-types";
2-
import { MakerSquirrel } from "@electron-forge/maker-squirrel";
3-
import { MakerZIP } from "@electron-forge/maker-zip";
4-
import { MakerDeb } from "@electron-forge/maker-deb";
5-
import { MakerRpm } from "@electron-forge/maker-rpm";
6-
import { VitePlugin } from "@electron-forge/plugin-vite";
7-
import { FusesPlugin } from "@electron-forge/plugin-fuses";
8-
import { FuseV1Options, FuseVersion } from "@electron/fuses";
1+
import type { ForgeConfig } from '@electron-forge/shared-types'
2+
import { MakerSquirrel } from '@electron-forge/maker-squirrel'
3+
import { MakerZIP } from '@electron-forge/maker-zip'
4+
import { MakerDeb } from '@electron-forge/maker-deb'
5+
import { MakerRpm } from '@electron-forge/maker-rpm'
6+
import { VitePlugin } from '@electron-forge/plugin-vite'
7+
import { FusesPlugin } from '@electron-forge/plugin-fuses'
8+
import { FuseV1Options, FuseVersion } from '@electron/fuses'
99

1010
const config: ForgeConfig = {
1111
publishers: [
1212
{
13-
name: "@electron-forge/publisher-github",
13+
name: '@electron-forge/publisher-github',
1414
config: {
1515
repository: {
16-
owner: "sametcn99",
17-
name: "electron-widgets",
16+
owner: 'sametcn99',
17+
name: 'electron-widgets',
1818
},
1919
draft: true,
2020
},
@@ -24,8 +24,8 @@ const config: ForgeConfig = {
2424
asar: true,
2525
protocols: [
2626
{
27-
name: "electron-widgets",
28-
schemes: ["electron-widgets"],
27+
name: 'electron-widgets',
28+
schemes: ['electron-widgets'],
2929
},
3030
],
3131
},
@@ -44,18 +44,18 @@ const config: ForgeConfig = {
4444
build: [
4545
{
4646
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
47-
entry: "src/app/main/main.ts",
48-
config: "vite.main.config.ts",
47+
entry: 'src/app/main/main.ts',
48+
config: 'vite.main.config.ts',
4949
},
5050
{
51-
entry: "src/app/preload/preload.ts",
52-
config: "vite.preload.config.ts",
51+
entry: 'src/app/preload/preload.ts',
52+
config: 'vite.preload.config.ts',
5353
},
5454
],
5555
renderer: [
5656
{
57-
name: "main_window",
58-
config: "vite.renderer.config.ts",
57+
name: 'main_window',
58+
config: 'vite.renderer.config.ts',
5959
},
6060
],
6161
}),
@@ -71,6 +71,6 @@ const config: ForgeConfig = {
7171
[FuseV1Options.OnlyLoadAppFromAsar]: true,
7272
}),
7373
],
74-
};
74+
}
7575

76-
export default config;
76+
export default config

forge.env.d.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
1-
export {}; // Make this a module
1+
export {} // Make this a module
22

33
declare global {
44
// This allows TypeScript to pick up the magic constants that's auto-generated by Forge's Vite
55
// plugin that tells the Electron app where to look for the Vite-bundled app code (depending on
66
// whether you're running in development or production).
7-
const MAIN_WINDOW_VITE_DEV_SERVER_URL: string;
8-
const MAIN_WINDOW_VITE_NAME: string;
7+
const MAIN_WINDOW_VITE_DEV_SERVER_URL: string
8+
const MAIN_WINDOW_VITE_NAME: string
99

1010
namespace NodeJS {
1111
interface Process {
1212
// Used for hot reload after preload scripts.
13-
viteDevServers: Record<string, import('vite').ViteDevServer>;
13+
viteDevServers: Record<string, import('vite').ViteDevServer>
1414
}
1515
}
1616

17-
type VitePluginConfig = ConstructorParameters<typeof import('@electron-forge/plugin-vite').VitePlugin>[0];
17+
type VitePluginConfig = ConstructorParameters<
18+
typeof import('@electron-forge/plugin-vite').VitePlugin
19+
>[0]
1820

1921
interface VitePluginRuntimeKeys {
20-
VITE_DEV_SERVER_URL: `${string}_VITE_DEV_SERVER_URL`;
21-
VITE_NAME: `${string}_VITE_NAME`;
22+
VITE_DEV_SERVER_URL: `${string}_VITE_DEV_SERVER_URL`
23+
VITE_NAME: `${string}_VITE_NAME`
2224
}
2325
}
2426

2527
declare module 'vite' {
26-
interface ConfigEnv<K extends keyof VitePluginConfig = keyof VitePluginConfig> {
27-
root: string;
28-
forgeConfig: VitePluginConfig;
29-
forgeConfigSelf: VitePluginConfig[K][number];
28+
interface ConfigEnv<
29+
K extends keyof VitePluginConfig = keyof VitePluginConfig,
30+
> {
31+
root: string
32+
forgeConfig: VitePluginConfig
33+
forgeConfigSelf: VitePluginConfig[K][number]
3034
}
3135
}

0 commit comments

Comments
 (0)