mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
#12: Refactor www.ts to return a method
This commit is contained in:
parent
9f8c191fef
commit
8820d10669
@ -6,6 +6,8 @@ import appIconService = require("./services/app_icon");
|
||||
import windowService = require("./services/window");
|
||||
import tray = require("./services/tray");
|
||||
|
||||
import startTrilium = require("../../server/src/www.js");
|
||||
|
||||
// Adds debug features like hotkeys for triggering dev tools and reload
|
||||
require("electron-debug")();
|
||||
|
||||
@ -60,4 +62,4 @@ electron.app.on("will-quit", () => {
|
||||
// this is to disable electron warning spam in the dev console (local development only)
|
||||
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";
|
||||
|
||||
require("../../server/src/www.js"); // path is relative to dist/electron/src as defined in package.lock main
|
||||
startTrilium();
|
@ -2,11 +2,11 @@
|
||||
"name": "server",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
"start-server": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts",
|
||||
"start-server-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts",
|
||||
"qstart-server": "npm run qswitch-server && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts"
|
||||
"start-server": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon .",
|
||||
"start-server-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon .",
|
||||
"qstart-server": "npm run qswitch-server && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "6.0.4",
|
||||
|
3
server/src/index.ts
Normal file
3
server/src/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import startTrilium = require("./www");
|
||||
|
||||
startTrilium();
|
@ -32,14 +32,12 @@ import port = require('./services/port');
|
||||
import host = require('./services/host');
|
||||
import semver = require('semver');
|
||||
|
||||
if (!semver.satisfies(process.version, ">=10.5.0")) {
|
||||
console.error("Trilium only supports node.js 10.5 and later");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
startTrilium();
|
||||
|
||||
function startTrilium() {
|
||||
if (!semver.satisfies(process.version, ">=10.5.0")) {
|
||||
console.error("Trilium only supports node.js 10.5 and later");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* The intended behavior is to detect when a second instance is running, in that case open the old instance
|
||||
* instead of the new one. This is complicated by the fact that it is possible to run multiple instances of Trilium
|
||||
@ -156,3 +154,5 @@ function startHttpServer() {
|
||||
|
||||
return httpServer;
|
||||
}
|
||||
|
||||
export = startTrilium;
|
Loading…
x
Reference in New Issue
Block a user