Skip to content

Commit

Permalink
feat: migrate to electron
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Dec 8, 2024
1 parent 786b866 commit aed2907
Show file tree
Hide file tree
Showing 81 changed files with 18,913 additions and 22,229 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/electron",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react-hooks/recommended"
Expand Down
70 changes: 0 additions & 70 deletions .github/workflows/cross-platform-release.yml

This file was deleted.

60 changes: 0 additions & 60 deletions .github/workflows/cross-platform-test.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/release-please.yml

This file was deleted.

94 changes: 82 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,91 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Editor directories and files
.idea
# Runtime data
pids
*.pid
*.seed
*.pid.lock
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# 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/

.env
3 changes: 0 additions & 3 deletions .lintstagedrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions .lintstagedrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
'src/*.{js,jsx,ts,tsx}': ['npm run format']
# 'src/*.{js,jsx,ts,tsx}': ['npm run format', 'npm run lint']
}
3 changes: 0 additions & 3 deletions .vscode/extensions.json

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Hi! We are really excited that you are interested in contributing to Hyper Chat.

## Repo Setup

To develop and test the core `Hyper Chat` package, please respect the [Tauri Guide](https://tauri.app/v1/guides/).
To develop and test the core `Hyper Chat` package, please respect the [Electron Guide](https://www.electronjs.org/) and [Electron Forge Guide](https://www.electronforge.io/).

## Pull Request Guidelines

Expand Down
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,19 @@ As Hyper Chat is not planning to be released on the App Store, you may encounter

### Prerequisites

We have chosen [Tauri](https://tauri.app/) as our cross-platform base. Please make sure that [Rust](https://www.rust-lang.org/) is installed on your system.

Then, to install Tauri CLI globally, please follow the tutorial on [create-tauri-app](https://github.com/tauri-apps/create-tauri-app). We recommend using `cargo install tauri-cli`.

Additionally, we use [React](https://react.dev/) + [Vite](https://vitejs.dev/) for rendering and packaging pages, so please install [Node.js](https://nodejs.org/en) and [pnpm](https://pnpm.io/) globally in advance.
We have chosen [Electron Forge](https://www.electronforge.io/) as our cross-platform base and use [React](https://react.dev/) + [Vite](https://vitejs.dev/) for rendering and packaging pages, so please install [Node.js](https://nodejs.org/en) globally in advance.

### Recommended IDE Setup

- [VS Code](https://code.visualstudio.com/)
- [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode)
- [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)
- [Eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)

### Available Scripts

- To start tauri development window, you can execute `cargo tauri dev`.
- To build the bundle, you can execute `cargo tauri build`.
- To start development window, you can execute `npm run start`.
- To build the bundle, you can execute `npm run make`.

## Contributing

Expand Down
60 changes: 60 additions & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { MakerDeb } from '@electron-forge/maker-deb'
import { MakerRpm } from '@electron-forge/maker-rpm'
import { MakerSquirrel } from '@electron-forge/maker-squirrel'
import { MakerZIP } from '@electron-forge/maker-zip'
import { FusesPlugin } from '@electron-forge/plugin-fuses'
import { VitePlugin } from '@electron-forge/plugin-vite'
import type { ForgeConfig } from '@electron-forge/shared-types'
import { FuseV1Options, FuseVersion } from '@electron/fuses'

const config: ForgeConfig = {
packagerConfig: {
asar: true,
icon: './public/icon'
},
rebuildConfig: {},
makers: [
new MakerSquirrel({}),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerDeb({ options: { icon: './public/icon' } })
],
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.ts',
config: 'vite.main.config.ts',
target: 'main'
},
{
entry: 'src/preload.ts',
config: 'vite.preload.config.ts',
target: 'preload'
}
],
renderer: [
{
name: 'main_window',
config: 'vite.renderer.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
Loading

0 comments on commit aed2907

Please sign in to comment.