feat: improve electron app build
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 491 B |
|
Before Width: | Height: | Size: 768 B |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 353 KiB After Width: | Height: | Size: 353 KiB |
@@ -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/**"
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "Notesnook - A safe place to write",
|
||||
"name": "Notesnook - Your private note taking space",
|
||||
"short_name": "Notesnook",
|
||||
"icons": [
|
||||
{
|
||||
|
||||
17
apps/web/scripts/removeLocales.js
Normal file
@@ -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]);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -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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:x-oauth-basic@github.com/streetwriters/notesnook-core.git":
|
||||
version "6.6.4"
|
||||
resolved "git+https://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:x-oauth-basic@github.com/streetwriters/notesnook-core.git#11e5bf6838e79912ef68328025b2f1cd88eccaf9"
|
||||
|
||||