-
-
Notifications
You must be signed in to change notification settings - Fork 8
feat: initialize SmartNotes with Electron + React + Tailwind setup #4
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "env": { | ||
| "browser": true, | ||
| "es6": true, | ||
| "node": true | ||
| }, | ||
| "extends": [ | ||
| "eslint:recommended", | ||
| "plugin:@typescript-eslint/eslint-recommended", | ||
| "plugin:@typescript-eslint/recommended", | ||
| "plugin:import/recommended", | ||
| "plugin:import/electron", | ||
| "plugin:import/typescript" | ||
| ], | ||
| "parser": "@typescript-eslint/parser" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| 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 { 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, | ||
| }, | ||
| 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.mts', | ||
| target: 'main', | ||
| }, | ||
| { | ||
| entry: 'src/preload/preload.ts', | ||
| config: 'vite.preload.config.mts', | ||
| target: 'preload', | ||
| }, | ||
| ], | ||
| renderer: [ | ||
| { | ||
| name: 'main_window', | ||
| config: 'vite.renderer.config.mts', | ||
| }, | ||
| ], | ||
| }), | ||
| // 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; |
| 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,12 @@ | ||||||||||||||||||||||||
| <!doctype html> | ||||||||||||||||||||||||
| <html lang="en"> | ||||||||||||||||||||||||
| <head> | ||||||||||||||||||||||||
| <meta charset="UTF-8" /> | ||||||||||||||||||||||||
| <title>Smart Notes</title> | ||||||||||||||||||||||||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||||||||||||||||||||||
| </head> | ||||||||||||||||||||||||
|
Comment on lines
3
to
7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider adding a Content-Security-Policy meta tag for Electron security. Electron applications benefit from strict CSP to mitigate XSS attacks. While this can also be set in the main process, a meta tag provides defense-in-depth. 🛡️ Example CSP for development <head>
<meta charset="UTF-8" />
+ <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'" />
<title>Smart Notes</title>
</head>Note: Adjust the CSP directives based on your application's requirements. For development with Vite HMR, you may need to temporarily relax some restrictions. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| <body> | ||||||||||||||||||||||||
| <div id="root"></div> | ||||||||||||||||||||||||
| <script type="module" src="/src/renderer/renderer.tsx"></script> | ||||||||||||||||||||||||
| </body> | ||||||||||||||||||||||||
| </html> | ||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider adding React-specific ESLint plugins for a React project.
This is a React + Electron application, but the ESLint configuration doesn't include
eslint-plugin-reactoreslint-plugin-react-hooks. These plugins enforce React best practices such as rules of hooks, component naming, and JSX-specific patterns.♻️ Proposed enhancement
Add the plugins to devDependencies:
Then update .eslintrc.json:
"extends": [ "eslint:recommended", "plugin:`@typescript-eslint/eslint-recommended`", "plugin:`@typescript-eslint/recommended`", "plugin:import/recommended", "plugin:import/electron", - "plugin:import/typescript" + "plugin:import/typescript", + "plugin:react/recommended", + "plugin:react-hooks/recommended" ], - "parser": "@typescript-eslint/parser" + "parser": "@typescript-eslint/parser", + "settings": { + "react": { + "version": "detect" + } + } }🤖 Prompt for AI Agents