-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
6,590 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pnpm-lock.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# generated assets | ||
public/affine-out | ||
public/preload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
*.autogen.* | ||
dist | ||
|
||
resources/web-static | ||
|
||
# yarn (3) | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
yarnPath: .yarn/releases/yarn-3.4.1.cjs | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# AFFiNE Electron App | ||
|
||
# ⚠️ NOTE ⚠️ | ||
|
||
Due to PNPM related issues, this project is currently using **yarn 3**. | ||
See https://github.com/electron/forge/issues/2633 | ||
|
||
## Development | ||
|
||
``` | ||
# in project root, start web app at :8080 | ||
pnpm dev | ||
# in /apps/electron, start electron app | ||
pnpm dev | ||
``` | ||
|
||
## Credits | ||
|
||
Most of the boilerplate code is generously borrowed from the following | ||
|
||
- [vite-electron-builder](https://github.com/cawa-93/vite-electron-builder) | ||
- [Turborepo basic example](https://github.com/vercel/turborepo/tree/main/examples/basic) | ||
- [yerba](https://github.com/t3dotgg/yerba) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = { | ||
packagerConfig: { | ||
name: 'AFFiNE', | ||
icon: './resources/icons/icon.icns', | ||
}, | ||
makers: [ | ||
{ | ||
name: '@electron-forge/maker-dmg', | ||
config: { | ||
format: 'ULFO', | ||
icon: './resources/icons/icon.icns', | ||
name: 'AFFiNE', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import './security-restrictions'; | ||
|
||
import { app } from 'electron'; | ||
|
||
import { restoreOrCreateWindow } from './main-window'; | ||
import { registerProtocol } from './protocol'; | ||
|
||
/** | ||
* Prevent multiple instances | ||
*/ | ||
const isSingleInstance = app.requestSingleInstanceLock(); | ||
if (!isSingleInstance) { | ||
app.quit(); | ||
process.exit(0); | ||
} | ||
|
||
app.on('second-instance', restoreOrCreateWindow); | ||
|
||
/** | ||
* Disable Hardware Acceleration for more power-save | ||
*/ | ||
app.disableHardwareAcceleration(); | ||
|
||
/** | ||
* Shout down background process if all windows was closed | ||
*/ | ||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
/** | ||
* @see https://www.electronjs.org/docs/v14-x-y/api/app#event-activate-macos Event: 'activate' | ||
*/ | ||
app.on('activate', restoreOrCreateWindow); | ||
|
||
/** | ||
* Create app window when background process will be ready | ||
*/ | ||
app | ||
.whenReady() | ||
.then(registerProtocol) | ||
.then(restoreOrCreateWindow) | ||
.catch(e => console.error('Failed create window:', e)); | ||
|
||
/** | ||
* Check new app version in production mode only | ||
*/ | ||
// FIXME: add me back later | ||
// if (import.meta.env.PROD) { | ||
// app | ||
// .whenReady() | ||
// .then(() => import('electron-updater')) | ||
// .then(({ autoUpdater }) => autoUpdater.checkForUpdatesAndNotify()) | ||
// .catch(e => console.error('Failed check updates:', e)); | ||
// } |
Oops, something went wrong.
88f662e
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.
Successfully deployed to the following URLs:
affine-preview – ./apps/web
affine-preview-git-master-toeverything.vercel.app
affine-preview-toeverything.vercel.app
affine-preview.vercel.app
88f662e
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.
Successfully deployed to the following URLs:
affine-storybook – ./packages/component
affine-storybook.vercel.app
affine-storybook-git-master-toeverything.vercel.app
affine-storybook-toeverything.vercel.app