mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
#12: Adapt dist copy script partially
This commit is contained in:
parent
9e27e4886e
commit
5eac21797f
90
electron/bin/copy-dist.ts
Normal file
90
electron/bin/copy-dist.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import fs = require("fs-extra");
|
||||||
|
import path = require("path");
|
||||||
|
|
||||||
|
const DEST_DIR = "./dist";
|
||||||
|
const DEST_DIR_SRC = path.join(DEST_DIR, "src");
|
||||||
|
const DEST_DIR_NODE_MODULES = path.join(DEST_DIR, "node_modules");
|
||||||
|
|
||||||
|
async function copyNodeModuleFileOrFolder(source: string) {
|
||||||
|
const adjustedSource = source.substring(source.indexOf("node_modules") + "node_modules".length);
|
||||||
|
const destination = path.join(DEST_DIR_NODE_MODULES, adjustedSource);
|
||||||
|
|
||||||
|
console.log(`Copying ${source} to ${destination}`);
|
||||||
|
await fs.ensureDir(path.dirname(destination));
|
||||||
|
await fs.copy(source, destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
function trimRelativePath(path: string) {
|
||||||
|
return path.replace(/\.\.\//g, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyFiles() {
|
||||||
|
const filesToCopy = ["config-sample.ini"];
|
||||||
|
for (const file of filesToCopy) {
|
||||||
|
console.log(`Copying ${file}`);
|
||||||
|
await fs.copy(file, path.join(DEST_DIR, file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyDirs() {
|
||||||
|
const dirsToCopy = ["../common/images", "../client/libraries", "../server/db"];
|
||||||
|
for (const dir of dirsToCopy) {
|
||||||
|
const destPath = path.join(DEST_DIR, trimRelativePath(dir));
|
||||||
|
console.log(`Copying ${dir} -> ${destPath}`);
|
||||||
|
await fs.copy(dir, destPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyClient() {
|
||||||
|
const srcDirsToCopy = ["../client/src", "../server/src/views"];
|
||||||
|
for (const dir of srcDirsToCopy) {
|
||||||
|
console.log(`Copying ${dir}`);
|
||||||
|
await fs.copy(dir, path.join(DEST_DIR_SRC, trimRelativePath(dir)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyNodeModules() {
|
||||||
|
const nodeModulesFile = [
|
||||||
|
"../client/node_modules/react/umd/react.production.min.js",
|
||||||
|
"../client/node_modules/react/umd/react.development.js",
|
||||||
|
"../client/node_modules/react-dom/umd/react-dom.production.min.js",
|
||||||
|
"../client/node_modules/react-dom/umd/react-dom.development.js",
|
||||||
|
"../client/node_modules/katex/dist/katex.min.js",
|
||||||
|
"../client/node_modules/katex/dist/contrib/mhchem.min.js",
|
||||||
|
"../client/node_modules/katex/dist/contrib/auto-render.min.js",
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const file of nodeModulesFile) {
|
||||||
|
await copyNodeModuleFileOrFolder(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
const nodeModulesFolder = [
|
||||||
|
"../client/node_modules/@excalidraw/excalidraw/dist/",
|
||||||
|
"../client/node_modules/katex/dist/",
|
||||||
|
"../client/node_modules/dayjs/",
|
||||||
|
"../client/node_modules/force-graph/dist/",
|
||||||
|
"../client/node_modules/boxicons/css/",
|
||||||
|
"../client/node_modules/boxicons/fonts/",
|
||||||
|
"../client/node_modules/mermaid/dist/",
|
||||||
|
"../client/node_modules/jquery/dist/",
|
||||||
|
"../client/node_modules/jquery-hotkeys/",
|
||||||
|
"../client/node_modules/print-this/",
|
||||||
|
"../client/node_modules/split.js/dist/",
|
||||||
|
"../client/node_modules/panzoom/dist/",
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const folder of nodeModulesFolder) {
|
||||||
|
await copyNodeModuleFileOrFolder(folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
copyFiles();
|
||||||
|
copyDirs();
|
||||||
|
copyClient();
|
||||||
|
copyNodeModules();
|
||||||
|
console.log("Copying complete!");
|
||||||
|
} catch (err: unknown) {
|
||||||
|
console.error("Error during copy:", err);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
29
electron/config-sample.ini
Normal file
29
electron/config-sample.ini
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
[General]
|
||||||
|
# Instance name can be used to distinguish between different instances using backend api.getInstanceName()
|
||||||
|
instanceName=
|
||||||
|
|
||||||
|
# set to true to allow using Trilium without authentication (makes sense for server build only, desktop build doesn't need password)
|
||||||
|
noAuthentication=false
|
||||||
|
|
||||||
|
# set to true to disable backups (e.g. because of limited space on server)
|
||||||
|
noBackup=false
|
||||||
|
|
||||||
|
# Disable automatically generating desktop icon
|
||||||
|
# noDesktopIcon=true
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
# host setting is relevant only for web deployments - set the host on which the server will listen
|
||||||
|
# host=0.0.0.0
|
||||||
|
# port setting is relevant only for web deployments, desktop builds run on a fixed port (changeable with TRILIUM_PORT environment variable)
|
||||||
|
port=8080
|
||||||
|
# true for TLS/SSL/HTTPS (secure), false for HTTP (insecure).
|
||||||
|
https=false
|
||||||
|
# path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true
|
||||||
|
certPath=
|
||||||
|
keyPath=
|
||||||
|
# setting to give trust to reverse proxies, a comma-separated list of trusted rev. proxy IPs can be specified (CIDR notation is permitted),
|
||||||
|
# alternatively 'true' will make use of the leftmost IP in X-Forwarded-For, ultimately an integer can be used to tell about the number of hops between
|
||||||
|
# Trilium (which is hop 0) and the first trusted rev. proxy.
|
||||||
|
# once set, expressjs will use the X-Forwarded-For header set by the rev. proxy to determinate the real IPs of clients.
|
||||||
|
# expressjs shortcuts are supported: loopback(127.0.0.1/8, ::1/128), linklocal(169.254.0.0/16, fe80::/10), uniquelocal(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7)
|
||||||
|
trustedReverseProxy=false
|
29
server/config-sample.ini
Normal file
29
server/config-sample.ini
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
[General]
|
||||||
|
# Instance name can be used to distinguish between different instances using backend api.getInstanceName()
|
||||||
|
instanceName=
|
||||||
|
|
||||||
|
# set to true to allow using Trilium without authentication (makes sense for server build only, desktop build doesn't need password)
|
||||||
|
noAuthentication=false
|
||||||
|
|
||||||
|
# set to true to disable backups (e.g. because of limited space on server)
|
||||||
|
noBackup=false
|
||||||
|
|
||||||
|
# Disable automatically generating desktop icon
|
||||||
|
# noDesktopIcon=true
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
# host setting is relevant only for web deployments - set the host on which the server will listen
|
||||||
|
# host=0.0.0.0
|
||||||
|
# port setting is relevant only for web deployments, desktop builds run on a fixed port (changeable with TRILIUM_PORT environment variable)
|
||||||
|
port=8080
|
||||||
|
# true for TLS/SSL/HTTPS (secure), false for HTTP (insecure).
|
||||||
|
https=false
|
||||||
|
# path to certificate (run "bash bin/generate-cert.sh" to generate self-signed certificate). Relevant only if https=true
|
||||||
|
certPath=
|
||||||
|
keyPath=
|
||||||
|
# setting to give trust to reverse proxies, a comma-separated list of trusted rev. proxy IPs can be specified (CIDR notation is permitted),
|
||||||
|
# alternatively 'true' will make use of the leftmost IP in X-Forwarded-For, ultimately an integer can be used to tell about the number of hops between
|
||||||
|
# Trilium (which is hop 0) and the first trusted rev. proxy.
|
||||||
|
# once set, expressjs will use the X-Forwarded-For header set by the rev. proxy to determinate the real IPs of clients.
|
||||||
|
# expressjs shortcuts are supported: loopback(127.0.0.1/8, ::1/128), linklocal(169.254.0.0/16, fe80::/10), uniquelocal(10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, fc00::/7)
|
||||||
|
trustedReverseProxy=false
|
Loading…
x
Reference in New Issue
Block a user