AFFiNE/packages/frontend/apps/electron
pengx17 df99e2ca97
fix(electron): potential crash on quit (#8829)
fix AF-1696

Related log:
```
Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0   Electron Framework            	       0x10c3bb09c electron::MessagePort::Close()
1   Electron Framework            	       0x10c3bcb78 gin::internal::Dispatcher<void (electron::MessagePort*)>::DispatchToCallbackImpl(gin::Arguments*)
2   Electron Framework            	       0x10c3bc984 gin::internal::Dispatcher<void (electron::MessagePort*)>::DispatchToCallback(v8::FunctionCallbackInfo<v8::Value> const&)
3   ???                           	       0x147e0f58c ???
4   ???                           	       0x147e0d45c ???
5   ???                           	       0x147e0d45c ???
6   ???                           	       0x147e0d45c ???
7   ???                           	       0x1401743b8 ???
8   ???                           	       0x147e0b088 ???
9   ???                           	       0x147e0acd4 ???
10  Electron Framework            	       0x10d657578 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*)
11  Electron Framework            	       0x10d53e478 v8::Function::Call(v8::Isolate*, v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*)
12  Electron Framework            	       0x11337ad34 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context)
13  Electron Framework            	       0x11337b0b0 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context)
14  Electron Framework            	       0x10c46d9dc gin_helper::internal::CallMethodWithArgs(v8::Isolate*, v8::Local<v8::Object>, char const*, base::span<v8::Local<v8::Value>, 18446744073709551615ul, v8::Local<v8::Value>*>)
15  Electron Framework            	       0x10c3833b0 bool gin_helper::EventEmitterMixin<electron::api::WebContents>::Emit<>(std::__Cr::basic_string_view<char, std::__Cr::char_traits<char>>)
16  Electron Framework            	       0x10c38324c electron::api::WebContents::WebContentsDestroyed()
17  Electron Framework            	       0x10ebc2ee8 void content::WebContentsImpl::WebContentsObserverList::NotifyObservers<void (content::WebContentsObserver::*)()>(void (content::WebContentsObserver::*)())
18  Electron Framework            	       0x10ebc229c content::WebContentsImpl::~WebContentsImpl()
19  Electron Framework            	       0x10ebc32b0 content::WebContentsImpl::~WebContentsImpl()
20  Electron Framework            	       0x10c4212dc electron::InspectableWebContents::~InspectableWebContents()
21  Electron Framework            	       0x10c4213ac electron::InspectableWebContents::~InspectableWebContents()
22  Electron Framework            	       0x10c382ffc electron::api::WebContents::~WebContents()
23  Electron Framework            	       0x10c383498 non-virtual thunk to electron::api::WebContents::~WebContents()
24  Electron Framework            	       0x10c46cb80 gin_helper::CleanedUpAtExit::DoCleanup()
25  Electron Framework            	       0x10c3ec994 electron::JavascriptEnvironment::DestroyMicrotasksRunner()
26  Electron Framework            	       0x10c3d2828 electron::ElectronBrowserMainParts::PostMainMessageLoopRun()
27  Electron Framework            	       0x10e663458 content::BrowserMainLoop::ShutdownThreadsAndCleanUp()
28  Electron Framework            	       0x10e664a80 content::BrowserMainRunnerImpl::Shutdown()
29  Electron Framework            	       0x10e661098 content::BrowserMain(content::MainFunctionParams)
30  Electron Framework            	       0x10c6339a4 content::RunBrowserProcessMain(content::MainFunctionParams, content::ContentMainDelegate*)
31  Electron Framework            	       0x10c634968 content::ContentMainRunnerImpl::RunBrowser(content::MainFunctionParams, bool)
32  Electron Framework            	       0x10c6347e8 content::ContentMainRunnerImpl::Run()
33  Electron Framework            	       0x10c633208 content::RunContentProcess(content::ContentMainParams, content::ContentMainRunner*)
34  Electron Framework            	       0x10c6332f0 content::ContentMain(content::ContentMainParams)
35  Electron Framework            	       0x10c2e98c0 ElectronMain
36  dyld                          	       0x18b5a8274 start
```
2024-11-15 02:58:19 +00:00
..
renderer feat(electron): spellcheck setting (#8730) 2024-11-11 13:03:33 +00:00
resources refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00
scripts fix(electron): make sure updater receive correct installer files (#8798) 2024-11-13 07:48:37 +00:00
src fix(electron): potential crash on quit (#8829) 2024-11-15 02:58:19 +00:00
test fix(electron): make sure updater receive correct installer files (#8798) 2024-11-13 07:48:37 +00:00
.gitignore refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00
dev-app-update.yml refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00
forge.config.mjs build(electron): flatpak support for linux (#8439) 2024-10-10 09:51:33 +00:00
package.json chore: bump base version to 0.18.0 2024-11-14 11:41:51 +08:00
project.json refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00
README.md refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00
tsconfig.json refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00
tsconfig.node.json refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00
tsconfig.test.json refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00
vitest.config.ts refactor: new project struct (#8199) 2024-09-12 07:42:57 +00:00

AFFiNE Electron App

Development

To run AFFiNE Desktop Client Application locally, run the following commands:

# in repo root
yarn install
yarn workspace @affine/native build
yarn dev

# in packages/frontend/apps/electron
yarn generate-assets
yarn dev # or yarn prod for production build

Troubleshooting

If you have trouble building electron during yarn install, try setting mirror environment variable:

export ELECTRON_MIRROR="https://registry.npmmirror.com/-/binary/electron/"

Credits

Most of the boilerplate code is generously borrowed from the following