mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	chore(edit-docs): switch to esbuild
This commit is contained in:
		| @@ -17,6 +17,51 @@ | ||||
|       "server" | ||||
|     ], | ||||
|     "targets": { | ||||
|       "build": { | ||||
|         "executor": "@nx/esbuild:esbuild", | ||||
|         "outputs": [ | ||||
|           "{options.outputPath}" | ||||
|         ], | ||||
|         "options": { | ||||
|           "main": "apps/edit-docs/src/electron-edit-demo.ts", | ||||
|           "outputPath": "apps/edit-docs/dist", | ||||
|           "outputFileName": "main.js", | ||||
|           "tsConfig": "apps/edit-docs/tsconfig.app.json", | ||||
|           "platform": "node", | ||||
|           "external": [ | ||||
|             "electron", | ||||
|             "@electron/remote", | ||||
|             "better-sqlite3", | ||||
|             "./xhr-sync-worker.js" | ||||
|           ], | ||||
|           "format": [ | ||||
|             "cjs" | ||||
|           ], | ||||
|           "assets": [ | ||||
|             { | ||||
|               "glob": "**/*", | ||||
|               "input": "apps/server/dist/node_modules", | ||||
|               "output": "node_modules" | ||||
|             }, | ||||
|             { | ||||
|               "glob": "**/*", | ||||
|               "input": "apps/server/dist/assets", | ||||
|               "output": "assets" | ||||
|             }, | ||||
|             { | ||||
|               "glob": "**/*", | ||||
|               "input": "apps/server/dist/public", | ||||
|               "output": "public" | ||||
|             }, | ||||
|             { | ||||
|               "glob": "xhr-sync-worker.js", | ||||
|               "input": "apps/server/node_modules/jsdom/lib/jsdom/living/xhr", | ||||
|               "output": "" | ||||
|             } | ||||
|           ], | ||||
|           "declarationRootDir": "apps/edit-docs/src" | ||||
|         } | ||||
|       }, | ||||
|       "rebuild-deps": { | ||||
|         "executor": "nx:run-commands", | ||||
|         "dependsOn": [ | ||||
| @@ -41,13 +86,31 @@ | ||||
|         "defaultConfiguration": "default", | ||||
|         "configurations": { | ||||
|           "default": { | ||||
|             "command": "electron .", | ||||
|             "cwd": "./apps/edit-docs/dist" | ||||
|             "command": "electron main.cjs", | ||||
|             "cwd": "{projectRoot}/dist" | ||||
|           }, | ||||
|           "nixos": { | ||||
|             "command": "nix-shell -p electron_35 --run \"electron .\"", | ||||
|             "forwardAllArgs": false, | ||||
|             "cwd": "./apps/edit-docs/dist" | ||||
|             "command": "nix-shell -p electron_35 --run \"electron {projectRoot}/dist/main.cjs\"", | ||||
|             "cwd": ".", | ||||
|             "forwardAllArgs": false | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       "serve-nodir": { | ||||
|         "executor": "nx:run-commands", | ||||
|         "dependsOn": [ | ||||
|           "rebuild-deps" | ||||
|         ], | ||||
|         "defaultConfiguration": "default", | ||||
|         "configurations": { | ||||
|           "default": { | ||||
|             "command": "electron main.cjs", | ||||
|             "cwd": "{projectRoot}/dist" | ||||
|           }, | ||||
|           "nixos": { | ||||
|             "command": "nix-shell -p electron_35 --run \"electron {projectRoot}/dist/main.cjs\"", | ||||
|             "cwd": ".", | ||||
|             "forwardAllArgs": false | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|   | ||||
| @@ -15,6 +15,7 @@ import { parseNoteMetaFile } from "@triliumnext/server/src/services/in_app_help. | ||||
| import { resolve } from "path"; | ||||
| import electron from "electron"; | ||||
| import { onReady } from "@triliumnext/desktop/src/electron-main.js"; | ||||
| import type NoteMeta from "@triliumnext/server/src/services/meta/note_meta.js"; | ||||
|  | ||||
| interface NoteMapping { | ||||
|     rootNoteId: string; | ||||
|   | ||||
| @@ -40,4 +40,4 @@ async function exportData() { | ||||
|     await exportToZipFile("root", "html", DEMO_ZIP_PATH); | ||||
| } | ||||
|  | ||||
| await main(); | ||||
| main(); | ||||
|   | ||||
| @@ -1,16 +1,21 @@ | ||||
| { | ||||
|   "extends": "../../tsconfig.base.json", | ||||
|   "compilerOptions": { | ||||
|     "module": "ESNext", | ||||
|     "moduleResolution": "bundler", | ||||
|     "target": "ES2020", | ||||
|     "outDir": "dist", | ||||
|     "strict": false, | ||||
|     "types": [ | ||||
|       "node" | ||||
|       "node", | ||||
|       "express" | ||||
|     ], | ||||
|     "rootDir": "src", | ||||
|     "tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo", | ||||
|     "verbatimModuleSyntax": false | ||||
|     "tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo" | ||||
|   }, | ||||
|   "include": [ | ||||
|     "src/**/*.ts" | ||||
|     "src/**/*.ts", | ||||
|     "../server/src/*.d.ts" | ||||
|   ], | ||||
|   "exclude": [ | ||||
|     "eslint.config.js", | ||||
|   | ||||
| @@ -1,53 +0,0 @@ | ||||
| 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'), | ||||
|   }, | ||||
|   module: { | ||||
|     rules: [ | ||||
|       { | ||||
|         test: /\.css$/i, | ||||
|         type: "asset/source" | ||||
|       } | ||||
|     ] | ||||
|   }, | ||||
|   plugins: [ | ||||
|     new NxAppWebpackPlugin({ | ||||
|       target: 'node', | ||||
|       compiler: 'tsc', | ||||
|       main: './src/electron-docs-main.ts', | ||||
|       tsConfig: './tsconfig.app.json', | ||||
|       optimization: false, | ||||
|       outputHashing: 'none', | ||||
|       generatePackageJson: true, | ||||
|       externalDependencies: [ | ||||
|         "electron/main", | ||||
|         "@electron/remote/main", | ||||
|         "electron", | ||||
|         "@electron/remote",         | ||||
|         "better-sqlite3" | ||||
|       ] | ||||
|     }), | ||||
|     new CopyPlugin({ | ||||
|       patterns: [ | ||||
|         { | ||||
|           from: "../desktop/dist/node_modules", | ||||
|           to: join(outputDir, "node_modules") | ||||
|         }, | ||||
|         { | ||||
|           from: "../desktop/dist/assets", | ||||
|           to: join(outputDir, "assets") | ||||
|         }, | ||||
|         { | ||||
|           from: "../desktop/dist/public", | ||||
|           to: join(outputDir, "public") | ||||
|         }, | ||||
|       ] | ||||
|     }) | ||||
|   ], | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user