Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: improve electron app build

thecodrrf43d6fee3cfc
diff --git a/apps/web/assets/icons/1024x1024.png b/apps/web/assets/icons/1024x1024.png
deleted file mode 100644
index 8cd517249..000000000
Binary files a/apps/web/assets/icons/1024x1024.png and /dev/null differ
diff --git a/apps/web/assets/icons/128x128.png b/apps/web/assets/icons/128x128.png
deleted file mode 100644
index 08b8ba0b3..000000000
Binary files a/apps/web/assets/icons/128x128.png and /dev/null differ
diff --git a/apps/web/assets/icons/16x16.png b/apps/web/assets/icons/16x16.png
deleted file mode 100644
index 496b08219..000000000
Binary files a/apps/web/assets/icons/16x16.png and /dev/null differ
diff --git a/apps/web/assets/icons/24x24.png b/apps/web/assets/icons/24x24.png
deleted file mode 100644
index e4814ac59..000000000
Binary files a/apps/web/assets/icons/24x24.png and /dev/null differ
diff --git a/apps/web/assets/icons/256x256.png b/apps/web/assets/icons/256x256.png
deleted file mode 100644
index 27157449b..000000000
Binary files a/apps/web/assets/icons/256x256.png and /dev/null differ
diff --git a/apps/web/assets/icons/32x32.png b/apps/web/assets/icons/32x32.png
deleted file mode 100644
index 48206178f..000000000
Binary files a/apps/web/assets/icons/32x32.png and /dev/null differ
diff --git a/apps/web/assets/icons/48x48.png b/apps/web/assets/icons/48x48.png
deleted file mode 100644
index 75788c088..000000000
Binary files a/apps/web/assets/icons/48x48.png and /dev/null differ
diff --git a/apps/web/assets/icons/512x512.png b/apps/web/assets/icons/512x512.png
deleted file mode 100644
index c8a35e9df..000000000
Binary files a/apps/web/assets/icons/512x512.png and /dev/null differ
diff --git a/apps/web/assets/icons/64x64.png b/apps/web/assets/icons/64x64.png
deleted file mode 100644
index ac53a157f..000000000
Binary files a/apps/web/assets/icons/64x64.png and /dev/null differ
diff --git a/apps/web/assets/icons/icon.icns b/apps/web/assets/icons/icon.icns
index a6b672e15..cf9d3290a 100644
Binary files a/apps/web/assets/icons/icon.icns and b/apps/web/assets/icons/icon.icns differ
diff --git a/apps/web/assets/icons/icon.ico b/apps/web/assets/icons/icon.ico
index c1d5a5d97..93c20fb5d 100644
Binary files a/apps/web/assets/icons/icon.ico and b/apps/web/assets/icons/icon.ico differ
diff --git a/apps/web/package.json b/apps/web/package.json
index 8396e766b..0a53560b9 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -1,8 +1,12 @@
{
- "name": "notes-web",
+ "name": "notesnook",
+ "productName": "Notesnook",
+ "description": "Your private note taking space",
"version": "1.3.4",
"private": true,
"main": "./build/electron.js",
+ "homepage": "https://notesnook.com/",
+ "repository": "https://github.com/streetwriters/notesnook",
"dependencies": {
"@inlightmedia/react-countdown-timer": "^1.1.2",
"@mdi/js": "^5.9.55",
@@ -16,6 +20,7 @@
"compressorjs": "^1.0.7",
"dayjs": "^1.10.4",
"electron-serve": "^1.1.0",
+ "electron-updater": "^4.3.8",
"emotion-theming": "^10.0.19",
"eventsource": "^1.0.7",
"fast-sort": "^2.1.1",
@@ -107,25 +112,46 @@
"url": "https://streetwriters.co"
},
"build": {
- "productName": "Notesnook",
"appId": "com.streetwriters.notesnook",
+ "productName": "Notesnook",
"copyright": "Copyright © 2021 Streetwriters (Private) Ltd.",
"files": [
+ "!*.chunk.js.map",
+ "!*.chunk.js.LICENSE.txt",
"build/",
- "node_modules/electron-serve"
+ "!node_modules",
+ "node_modules/electron-updater",
+ "node_modules/lazy-val",
+ "node_modules/builder-util-runtime",
+ "node_modules/fs-extra",
+ "node_modules/js-yaml",
+ "node_modules/lodash.isequal",
+ "node_modules/semver",
+ "node_modules/debug",
+ "node_modules/ms",
+ "node_modules/lru-cache",
+ "node_modules/yallist",
+ "node_modules/universalify",
+ "node_modules/graceful-fs",
+ "node_modules/at-least-node",
+ "node_modules/jsonfile",
+ "node_modules/sax"
],
"afterSign": "electron-builder-notarize",
+ "afterPack": "./scripts/removeLocales.js",
"mac": {
"target": [
"dmg"
],
+ "electronLanguages": ["en-US"],
"category": "public.app-category.productivity",
"darkModeSupport": true,
"type": "distribution",
"hardenedRuntime": true,
"entitlements": "assets/entitlements.mac.plist",
"entitlementsInherit": "assets/entitlements.mac.plist",
- "gatekeeperAssess": false
+ "gatekeeperAssess": false,
+ "icon": "assets/icons/icon.icns"
},
"dmg": {
"contents": [
@@ -139,20 +165,30 @@
"type": "link",
"path": "/Applications"
}
- ]
+ ],
+ "icon": "assets/icons/volume.icns",
+ "title": "Install Notesnook"
},
"win": {
"target": [
"nsis"
- ]
+ ],
+ "icon": "assets/icons/icon.ico"
+ },
+ "nsis": {
+ "oneClick": true,
+ "createDesktopShortcut": "always"
},
"linux": {
"target": [
"AppImage",
- "rpm",
- "deb"
+ "deb",
+ "rpm"
],
- "category": "Productivity"
+ "category": "Office",
+ "icon": "assets/icons/icon.icns",
+ "description": "Your private note taking space",
+ "executableName": "Notesnook"
},
"extraResources": [
"./assets/**"
diff --git a/apps/web/public/electron.js b/apps/web/public/electron.js
index c353d638c..468c29909 100644
--- a/apps/web/public/electron.js
+++ b/apps/web/public/electron.js
@@ -1,29 +1,52 @@
-const { app, BrowserWindow } = require("electron");
-const serve = require("electron-serve");
-
-const loadURL = serve({
- directory: __dirname,
- scheme: "nn",
- isCorsEnabled: false,
-});
+const { app, BrowserWindow, protocol } = require("electron");
+const { autoUpdater } = require("electron-updater");
+const path = require("path");
+const url = require("url");
+const os = require("os");
let mainWindow;
async function createWindow() {
mainWindow = new BrowserWindow({
autoHideMenuBar: true,
+ icon: path.join(
+ __dirname,
+ os.platform() === "win32" ? "favicon.ico" : "favicon-32x32.png"
+ ),
});
mainWindow.maximize();
- await loadURL(mainWindow);
+ // await loadURL(mainWindow);
+ mainWindow.loadURL(
+ url.format({
+ pathname:
+ "index.html" /* Attention here: origin is path.join(__dirname, 'index.html') */,
+ protocol: "file",
+ slashes: true,
+ })
+ );
mainWindow.on("closed", () => {
mainWindow = null;
});
}
-app.on("ready", createWindow);
+app.commandLine.appendSwitch("lang", "en-US");
+app.on("ready", () => {
+ protocol.interceptFileProtocol(
+ "file",
+ (request, callback) => {
+ const url = request.url.substr(7); /* all urls start with 'file://' */
+ callback({ path: path.normalize(`${__dirname}/${url}`) });
+ },
+ (err) => {
+ if (err) console.error("Failed to register protocol");
+ }
+ );
+ autoUpdater.checkForUpdatesAndNotify().catch((e) => console.log(e));
+ createWindow();
+});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
diff --git a/apps/web/public/index.html b/apps/web/public/index.html
index 57772aa67..59dfc60a8 100644
--- a/apps/web/public/index.html
+++ b/apps/web/public/index.html
@@ -45,11 +45,11 @@
-->
<meta
name="description"
- content="A safe place to write and stay organized."
+ content="Your private note taking space"
/>
<meta
property="og:title"
- content="Notesnook - A safe place to write and stay organized."
+ content="Notesnook - Your private note taking space"
/>
<meta
property="og:description"
@@ -64,7 +64,7 @@
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Notesnook by Streetwriters LLC" />
<meta name="twitter:card" content="summary_large_image" />
- <title>Notesnook - A safe place to write</title>
+ <title>Notesnook - Your private note taking space</title>
<style>
#splash svg {
diff --git a/apps/web/public/site.webmanifest b/apps/web/public/site.webmanifest
index 5580d1ce5..e7729eb59 100644
--- a/apps/web/public/site.webmanifest
+++ b/apps/web/public/site.webmanifest
@@ -1,5 +1,5 @@
{
- "name": "Notesnook - A safe place to write",
+ "name": "Notesnook - Your private note taking space",
"short_name": "Notesnook",
"icons": [
{
diff --git a/apps/web/scripts/removeLocales.js b/apps/web/scripts/removeLocales.js
new file mode 100644
index 000000000..758f0073f
--- /dev/null
+++ b/apps/web/scripts/removeLocales.js
@@ -0,0 +1,17 @@
+//https://www.electron.build/configuration/configuration#afterpack
+exports.default = async function (context) {
+ //console.log(context)
+ var fs = require("fs");
+ var localeDir = context.appOutDir + "/locales/";
+
+ fs.readdir(localeDir, function (err, files) {
+ //files is array of filenames (basename form)
+ if (!(files && files.length)) return;
+ for (var i = 0, len = files.length; i < len; i++) {
+ var match = files[i].match(/en-US\.pak/);
+ if (match === null) {
+ fs.unlinkSync(localeDir + files[i]);
+ }
+ }
+ });
+};
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index f184274a7..f1a5f6ff3 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -2274,6 +2274,11 @@
dependencies:
"@types/node" "*"
+"@types/semver@^7.3.4":
+ version "7.3.4"
+ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb"
+ integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ==
+
"@types/source-list-map@*":
version "0.1.2"
resolved "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz"
@@ -5219,6 +5224,19 @@ electron-to-chromium@^1.3.564, electron-to-chromium@^1.3.649:
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.664.tgz"
integrity sha512-yb8LrTQXQnh9yhnaIHLk6CYugF/An50T20+X0h++hjjhVfgSp1DGoMSYycF8/aD5eiqS4QwaNhiduFvK8rifRg==
+electron-updater@^4.3.8:
+ version "4.3.8"
+ resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.3.8.tgz#94f1731682a756385726183e2b04b959cb319456"
+ integrity sha512-/tB82Ogb2LqaXrUzAD8waJC+TZV52Pr0Znfj7w+i4D+jA2GgrKFI3Pxjp+36y9FcBMQz7kYsMHcB6c5zBJao+A==
+ dependencies:
+ "@types/semver" "^7.3.4"
+ builder-util-runtime "8.7.3"
+ fs-extra "^9.1.0"
+ js-yaml "^4.0.0"
+ lazy-val "^1.0.4"
+ lodash.isequal "^4.5.0"
+ semver "^7.3.4"
+
electron@^12.0.0:
version "12.0.0"
resolved "https://registry.npmjs.org/electron/-/electron-12.0.0.tgz"
@@ -9209,18 +9227,6 @@ normalize-url@^4.1.0:
resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz"
integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==
-notes-core@../notes-core/:
- version "6.6.4"
- dependencies:
- fast-sort "^2.0.1"
- fuzzysort "^1.1.4"
- lean-he "^2.1.2"
- no-internet "^1.5.2"
- qclone "^1.0.4"
- quill-delta-to-html "^0.12.0"
- spark-md5 "^3.0.1"
- turndown "^7.0.0"
-
"notes-core@git+https://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:[email protected]/streetwriters/notesnook-core.git":
version "6.6.4"
resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#11e5bf6838e79912ef68328025b2f1cd88eccaf9"