feat: add electron app support
2
apps/web/.gitignore
vendored
@@ -25,3 +25,5 @@ yarn-error.log*
|
||||
.now
|
||||
|
||||
__diff_output__
|
||||
|
||||
dist
|
||||
10
apps/web/assets/entitlements.mac.plist
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
<key>com.apple.security.cs.allow-jit</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
apps/web/assets/icons/1024x1024.png
Normal file
|
After Width: | Height: | Size: 83 KiB |
BIN
apps/web/assets/icons/128x128.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
apps/web/assets/icons/16x16.png
Normal file
|
After Width: | Height: | Size: 491 B |
BIN
apps/web/assets/icons/24x24.png
Normal file
|
After Width: | Height: | Size: 768 B |
BIN
apps/web/assets/icons/256x256.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
apps/web/assets/icons/32x32.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
apps/web/assets/icons/48x48.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
apps/web/assets/icons/512x512.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
apps/web/assets/icons/64x64.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
apps/web/assets/icons/icon.icns
Normal file
BIN
apps/web/assets/icons/icon.ico
Normal file
|
After Width: | Height: | Size: 353 KiB |
@@ -2,6 +2,7 @@
|
||||
"name": "notes-web",
|
||||
"version": "1.3.4",
|
||||
"private": true,
|
||||
"main": "public/electron.js",
|
||||
"dependencies": {
|
||||
"@mdi/js": "^5.9.55",
|
||||
"@mdi/react": "^1.4.0",
|
||||
@@ -39,9 +40,11 @@
|
||||
"tinymce": "^5.7.0",
|
||||
"uzip": "^0.20201231.0",
|
||||
"wouter": "^2.7.3",
|
||||
"zustand": "^3.3.1"
|
||||
"zustand": "^3.3.1",
|
||||
"electron-serve": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@neutralinojs/neu": "^2.4.0",
|
||||
"@sentry/types": "^6.1.0",
|
||||
"@types/hookrouter": "^2.2.5",
|
||||
"@types/jest": "^26.0.20",
|
||||
@@ -49,6 +52,8 @@
|
||||
"@types/quill": "^2.0.5",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"chalk": "^4.1.0",
|
||||
"electron": "^12.0.0",
|
||||
"electron-builder": "^22.10.5",
|
||||
"eslint": "^7.20.0",
|
||||
"eslint-config-react-app": "^6.0.0",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
@@ -73,7 +78,10 @@
|
||||
"test": "REACT_APP_CI=true BROWSER= jest --runInBand -c jest.e2e.config.js",
|
||||
"eject": "react-scripts eject",
|
||||
"update": "npm i @streetwriters/editor@latest @streetwriters/notesnook-core@latest @streetwriters/theme@latest",
|
||||
"analyze": "source-map-explorer 'build/static/js/*.js'"
|
||||
"analyze": "source-map-explorer 'build/static/js/*.js'",
|
||||
"electron-dev": "ELECTRON_START_URL=http://localhost:3000 electron .",
|
||||
"electron-prod": "electron electron/main.js",
|
||||
"electron-build": "electron-builder"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
@@ -92,5 +100,61 @@
|
||||
"last 3 ie version",
|
||||
"last 4 edge version"
|
||||
]
|
||||
},
|
||||
"author": {
|
||||
"name": "Streetwriters (Private) Ltd.",
|
||||
"email": "support@streetwriters.co",
|
||||
"url": "https://streetwriters.co"
|
||||
},
|
||||
"build": {
|
||||
"productName": "Notesnook",
|
||||
"appId": "com.streetwriters.notesnook",
|
||||
"copyright": "Copyright © 2021 Streetwriters (Private) Ltd.",
|
||||
"files": [
|
||||
"build/",
|
||||
"node_modules/electron-serve"
|
||||
],
|
||||
"mac": {
|
||||
"target": [
|
||||
"dmg"
|
||||
],
|
||||
"type": "distribution",
|
||||
"hardenedRuntime": true,
|
||||
"entitlements": "assets/entitlements.mac.plist",
|
||||
"entitlementsInherit": "assets/entitlements.mac.plist",
|
||||
"gatekeeperAssess": false
|
||||
},
|
||||
"dmg": {
|
||||
"contents": [
|
||||
{
|
||||
"x": 130,
|
||||
"y": 220
|
||||
},
|
||||
{
|
||||
"x": 410,
|
||||
"y": 220,
|
||||
"type": "link",
|
||||
"path": "/Applications"
|
||||
}
|
||||
]
|
||||
},
|
||||
"win": {
|
||||
"target": [
|
||||
"nsis"
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"target": [
|
||||
"AppImage"
|
||||
],
|
||||
"category": "Development"
|
||||
},
|
||||
"extraResources": [
|
||||
"./assets/**"
|
||||
],
|
||||
"directories": {
|
||||
"buildResources": "assets",
|
||||
"output": "dist/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
38
apps/web/public/electron.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const { app, BrowserWindow } = require("electron");
|
||||
const serve = require("electron-serve");
|
||||
|
||||
const loadURL = serve({
|
||||
directory: __dirname,
|
||||
scheme: "nn",
|
||||
isCorsEnabled: false,
|
||||
});
|
||||
|
||||
let mainWindow;
|
||||
|
||||
async function createWindow() {
|
||||
mainWindow = new BrowserWindow({
|
||||
autoHideMenuBar: true,
|
||||
});
|
||||
|
||||
mainWindow.maximize();
|
||||
|
||||
await loadURL(mainWindow);
|
||||
|
||||
mainWindow.on("closed", () => {
|
||||
mainWindow = null;
|
||||
});
|
||||
}
|
||||
|
||||
app.on("ready", createWindow);
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin") {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
app.on("activate", () => {
|
||||
if (mainWindow === null) {
|
||||
createWindow();
|
||||
}
|
||||
});
|
||||
@@ -54,7 +54,7 @@
|
||||
-->
|
||||
<title>Notesnook - A safe place to write</title>
|
||||
<style>
|
||||
#splash img {
|
||||
#splash svg {
|
||||
transform: scale(1);
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
|
||||
@@ -47,4 +47,4 @@ initializeDatabase().then(() => {
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||
serviceWorker.unregister();
|
||||
serviceWorker.register();
|
||||
|
||||