Skip to content

Build your personal knowledge base with Trilium Notes

chore(edit-docs): get it to start partially

Elian Doran52d6efedff70
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index 8b32670c3c..3e59e259e2 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -53,18 +53,21 @@
"cache": true,
"configurations": {
"default": {
- "command": "electron-rebuild apps/desktop/dist/main.js -m apps/desktop/dist"
+ "command": "electron-rebuild {projectRoot}/dist/main.js -m {projectRoot}/dist"
},
"nixos": {
- "command": "electron-rebuild -v $(nix-shell -p electron_35 --run \"electron --version\") apps/desktop/dist/main.js -m apps/desktop/dist"
+ "command": "electron-rebuild -v $(nix-shell -p electron_35 --run \"electron --version\") ${projectRoot}/dist/main.js -m ${projectRoot}/dist"
}
}
},
"serve": {
+ "executor": "nx:run-commands",
"dependsOn": [ "postbuild" ],
+ "defaultConfiguration": "default",
"configurations": {
"default": {
- "command": "electron apps/desktop/dist/main.js"
+ "command": "electron .",
+ "cwd": "{projectRoot}/dist"
},
"nixos": {
"command": "nix-shell -p electron_35 --run \"electron {projectRoot}/dist/main.js\"",
diff --git a/apps/edit-docs/.env b/apps/edit-docs/.env
index 9ca8764058..9405208def 100644
--- a/apps/edit-docs/.env
+++ b/apps/edit-docs/.env
@@ -1,4 +1,4 @@
-TRILIUM_DATA_DIR=./data-docs
+TRILIUM_DATA_DIR=../data
TRILIUM_ENV=dev
TRILIUM_INTEGRATION_TEST=memory-no-store
TRILIUM_PORT=37741
\ No newline at end of file
diff --git a/apps/edit-docs/package.json b/apps/edit-docs/package.json
index 0536e8a801..f5b99957c3 100644
--- a/apps/edit-docs/package.json
+++ b/apps/edit-docs/package.json
@@ -6,14 +6,45 @@
"@triliumnext/client": "workspace:*",
"@triliumnext/desktop": "workspace:*",
"@types/fs-extra": "11.0.4",
+ "copy-webpack-plugin": "13.0.0",
"fs-extra": "11.3.0"
},
"nx": {
"name": "edit-docs",
"targets": {
+ "postbuild": {
+ "executor": "nx:run-commands",
+ "dependsOn": [
+ "build"
+ ],
+ "defaultConfiguration": "default",
+ "cache": true,
+ "configurations": {
+ "default": {
+ "command": "electron-rebuild -f {projectRoot}/dist/main.js -m {projectRoot}/dist"
+ },
+ "nixos": {
+ "command": "electron-rebuild -f -v $(nix-shell -p electron_35 --run \"electron --version\") ${projectRoot}/dist/main.js -m ${projectRoot}/dist"
+ }
+ }
+ },
"serve": {
- "dependsOn": [ "build" ],
- "command": "electron {projectRoot}/dist/main"
+ "executor": "nx:run-commands",
+ "dependsOn": [
+ "postbuild"
+ ],
+ "defaultConfiguration": "default",
+ "configurations": {
+ "default": {
+ "command": "electron .",
+ "cwd": "{projectRoot}/dist"
+ },
+ "nixos": {
+ "command": "nix-shell -p electron_35 --run \"electron {projectRoot}/dist/main.js\"",
+ "cwd": ".",
+ "forwardAllArgs": false
+ }
+ }
}
}
}
diff --git a/apps/edit-docs/webpack.config.cjs b/apps/edit-docs/webpack.config.cjs
index 35f214573e..b78ede7f74 100644
--- a/apps/edit-docs/webpack.config.cjs
+++ b/apps/edit-docs/webpack.config.cjs
@@ -1,6 +1,9 @@
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
+const CopyPlugin = require('copy-webpack-plugin');
const { join } = require('path');
+const outputDir = join(__dirname, 'dist');
+
module.exports = {
output: {
path: join(__dirname, 'dist'),
@@ -14,6 +17,17 @@ module.exports = {
optimization: false,
outputHashing: 'none',
generatePackageJson: true,
+ externalDependencies: [
+ "better-sqlite3"
+ ]
+ }),
+ new CopyPlugin({
+ patterns: [
+ {
+ from: "../desktop/dist/node_modules",
+ to: join(outputDir, "node_modules")
+ },
+ ]
})
],
};
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index accaab7dba..8a2c0e695c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -349,7 +349,7 @@ importers:
version: 1.0.2
copy-webpack-plugin:
specifier: 13.0.0
electron:
specifier: 35.1.5
version: 35.1.5
@@ -396,6 +396,9 @@ importers:
'@types/fs-extra':
specifier: 11.0.4
version: 11.0.4
+ copy-webpack-plugin:
+ specifier: 13.0.0
fs-extra:
specifier: 11.3.0
version: 11.3.0
@@ -570,7 +573,7 @@ importers:
version: 1.4.7
copy-webpack-plugin:
specifier: 13.0.0
csrf-csrf:
specifier: 3.1.0
version: 3.1.0
@@ -741,7 +744,7 @@ importers:
version: 1.0.1
webpack:
specifier: 5.99.6
ws:
specifier: 8.18.1
@@ -15785,14 +15788,14 @@ snapshots:
serialize-javascript: 6.0.2
dependencies:
glob-parent: 6.0.2
normalize-path: 3.0.0
schema-utils: 4.3.2
serialize-javascript: 6.0.2
tinyglobby: 0.2.13
dependencies:
@@ -21498,14 +21501,14 @@ snapshots:
'@swc/core': 1.5.29(@swc/[email protected])
esbuild: 0.19.12
dependencies:
'@jridgewell/trace-mapping': 0.3.25
jest-worker: 27.5.1
schema-utils: 4.3.2
serialize-javascript: 6.0.2
terser: 5.39.0
optionalDependencies:
'@swc/core': 1.5.29(@swc/[email protected])
esbuild: 0.19.12
@@ -22246,7 +22249,7 @@ snapshots:
- esbuild
- uglify-js
dependencies:
'@types/eslint-scope': 3.7.7
'@types/estree': 1.0.7
@@ -22268,7 +22271,7 @@ snapshots:
neo-async: 2.6.2
schema-utils: 4.3.2
tapable: 2.2.1
watchpack: 2.4.2
webpack-sources: 3.2.3
optionalDependencies: