diff --git a/.github/instructions/nx.instructions.md b/.github/instructions/nx.instructions.md deleted file mode 100644 index d5894c44d..000000000 --- a/.github/instructions/nx.instructions.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -applyTo: '**' ---- - -// This file is automatically generated by Nx Console - -You are in an nx workspace using Nx 21.3.9 and pnpm as the package manager. - -You have access to the Nx MCP server and the tools it provides. Use them. Follow these guidelines in order to best help the user: - -# General Guidelines -- When answering questions, use the nx_workspace tool first to gain an understanding of the workspace architecture -- For questions around nx configuration, best practices or if you're unsure, use the nx_docs tool to get relevant, up-to-date docs!! Always use this instead of assuming things about nx configuration -- If the user needs help with an Nx configuration or project graph error, use the 'nx_workspace' tool to get any errors -- To help answer questions about the workspace structure or simply help with demonstrating how tasks depend on each other, use the 'nx_visualize_graph' tool - -# Generation Guidelines -If the user wants to generate something, use the following flow: - -- learn about the nx workspace and any specifics the user needs by using the 'nx_workspace' tool and the 'nx_project_details' tool if applicable -- get the available generators using the 'nx_generators' tool -- decide which generator to use. If no generators seem relevant, check the 'nx_available_plugins' tool to see if the user could install a plugin to help them -- get generator details using the 'nx_generator_schema' tool -- you may use the 'nx_docs' tool to learn more about a specific generator or technology if you're unsure -- decide which options to provide in order to best complete the user's request. Don't make any assumptions and keep the options minimalistic -- open the generator UI using the 'nx_open_generate_ui' tool -- wait for the user to finish the generator -- read the generator log file using the 'nx_read_generator_log' tool -- use the information provided in the log file to answer the user's question or continue with what they were doing - -# Running Tasks Guidelines -If the user wants help with tasks or commands (which include keywords like "test", "build", "lint", or other similar actions), use the following flow: -- Use the 'nx_current_running_tasks_details' tool to get the list of tasks (this can include tasks that were completed, stopped or failed). -- If there are any tasks, ask the user if they would like help with a specific task then use the 'nx_current_running_task_output' tool to get the terminal output for that task/command -- Use the terminal output from 'nx_current_running_task_output' to see what's wrong and help the user fix their problem. Use the appropriate tools if necessary -- If the user would like to rerun the task or command, always use `nx run ` to rerun in the terminal. This will ensure that the task will run in the nx context and will be run the same way it originally executed -- If the task was marked as "continuous" do not offer to rerun the task. This task is already running and the user can see the output in the terminal. You can use 'nx_current_running_task_output' to get the output of the task to verify the output. - - - diff --git a/.gitignore b/.gitignore index 2981e8b0e..1988bc8ca 100644 --- a/.gitignore +++ b/.gitignore @@ -33,9 +33,6 @@ testem.log .DS_Store Thumbs.db -.nx/cache -.nx/workspace-data - vite.config.*.timestamp* vitest.config.*.timestamp* test-output diff --git a/CLAUDE.md b/CLAUDE.md index 942ad06e3..5e7089895 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Overview -Trilium Notes is a hierarchical note-taking application with advanced features like synchronization, scripting, and rich text editing. It's built as a TypeScript monorepo using NX, with multiple applications and shared packages. +Trilium Notes is a hierarchical note-taking application with advanced features like synchronization, scripting, and rich text editing. It's built as a TypeScript monorepo using pnpm, with multiple applications and shared packages. ## Development Commands @@ -14,12 +14,9 @@ Trilium Notes is a hierarchical note-taking application with advanced features l ### Running Applications - `pnpm run server:start` - Start development server (http://localhost:8080) -- `pnpm nx run server:serve` - Alternative server start command -- `pnpm nx run desktop:serve` - Run desktop Electron app - `pnpm run server:start-prod` - Run server in production mode ### Building -- `pnpm nx build ` - Build specific project (server, client, desktop, etc.) - `pnpm run client:build` - Build client application - `pnpm run server:build` - Build server application - `pnpm run electron:build` - Build desktop application @@ -28,13 +25,8 @@ Trilium Notes is a hierarchical note-taking application with advanced features l - `pnpm test:all` - Run all tests (parallel + sequential) - `pnpm test:parallel` - Run tests that can run in parallel - `pnpm test:sequential` - Run tests that must run sequentially (server, ckeditor5-mermaid, ckeditor5-math) -- `pnpm nx test ` - Run tests for specific project - `pnpm coverage` - Generate coverage reports -### Linting & Type Checking -- `pnpm nx run :lint` - Lint specific project -- `pnpm nx run :typecheck` - Type check specific project - ## Architecture Overview ### Monorepo Structure @@ -94,7 +86,6 @@ Frontend uses a widget system (`apps/client/src/widgets/`): - `apps/server/src/assets/db/schema.sql` - Core database structure 4. **Configuration**: - - `nx.json` - NX workspace configuration - `package.json` - Project dependencies and scripts ## Note Types and Features @@ -154,7 +145,7 @@ Trilium provides powerful user scripting capabilities: - Update schema in `apps/server/src/assets/db/schema.sql` ## Build System Notes -- Uses NX for monorepo management with build caching +- Uses pnpm for monorepo management - Vite for fast development builds - ESBuild for production optimization - pnpm workspaces for dependency management diff --git a/README.md b/README.md index 0d6626f6e..d76005478 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ Download the repository, install dependencies using `pnpm` and then run the envi git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install -pnpm nx run edit-docs:edit-docs +pnpm edit-docs:edit-docs ``` ### Building the Executable @@ -151,7 +151,7 @@ Download the repository, install dependencies using `pnpm` and then build the de git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install -pnpm nx --project=desktop electron-forge:make -- --arch=x64 --platform=win32 +pnpm run --filter desktop electron-forge:make --arch=x64 --platform=win32 ``` For more details, see the [development docs](https://github.com/TriliumNext/Trilium/tree/main/docs/Developer%20Guide/Developer%20Guide). diff --git a/apps/db-compare/README.md b/apps/db-compare/README.md index 4cc13218a..c63f49b0a 100644 --- a/apps/db-compare/README.md +++ b/apps/db-compare/README.md @@ -6,12 +6,12 @@ To build and run manually: ```sh -nx build db-compare +pnpm build db-compare node ./apps/db-compare/dist/compare.js ``` To serve development build with arguments: ```sh -nx serve db-compare --args "apps/server/spec/db/document_v214.db" --args "apps/server/spec/db/document_v214_migrated.db" +pnpm dev --args "apps/server/spec/db/document_v214.db" --args "apps/server/spec/db/document_v214_migrated.db" ``` \ No newline at end of file diff --git a/apps/website/README.md b/apps/website/README.md index 9d692a9c0..88ad0a1c6 100644 --- a/apps/website/README.md +++ b/apps/website/README.md @@ -4,8 +4,8 @@ Landing page for Trilium Notes powered by [Svelte](https://github.com/sveltejs/c ## Developing -To run a dev server that will hot-reload changes: `pnpm nx run website:dev` +To run a dev server that will hot-reload changes: `pnpm dev` ## Building -To create a production build: `pnpm nx run website:build` +To create a production build: `pnpm build` diff --git a/docs/README-ZH_CN.md b/docs/README-ZH_CN.md index a23a24acd..818aa71aa 100644 --- a/docs/README-ZH_CN.md +++ b/docs/README-ZH_CN.md @@ -139,7 +139,7 @@ pnpm run server:start git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install -pnpm nx run edit-docs:edit-docs +pnpm run edit-docs:edit-docs ``` ### 建置桌面可执行文件 @@ -149,7 +149,7 @@ pnpm nx run edit-docs:edit-docs git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install -pnpm nx --project=desktop electron-forge:make -- --arch=x64 --platform=win32 +pnpm --filter=desktop electron-forge:make --arch=x64 --platform=win32 ``` 更多细节请参见[开发文件](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Building%20and%20deployment/Running%20a%20development%20build.md)。 diff --git a/docs/README-ZH_TW.md b/docs/README-ZH_TW.md index d471bfce3..085871d61 100644 --- a/docs/README-ZH_TW.md +++ b/docs/README-ZH_TW.md @@ -139,7 +139,7 @@ pnpm run server:start git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install -pnpm nx run edit-docs:edit-docs +pnpm edit-docs:edit-docs ``` ### 建置桌面可執行檔 @@ -149,7 +149,7 @@ pnpm nx run edit-docs:edit-docs git clone https://github.com/TriliumNext/Trilium.git cd Trilium pnpm install -pnpm nx --project=desktop electron-forge:make -- --arch=x64 --platform=win32 +pnpm --filter=desktop electron-forge:make --arch=x64 --platform=win32 ``` 更多細節請參見[開發文件](https://github.com/TriliumNext/Notes/blob/develop/docs/Developer%20Guide/Developer%20Guide/Building%20and%20deployment/Running%20a%20development%20build.md)。 diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 14d908731..000000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,60 +0,0 @@ -import nx from "@nx/eslint-plugin"; -import reactHooks from "eslint-plugin-react-hooks"; - -export default [ - ...nx.configs["flat/base"], - ...nx.configs["flat/typescript"], - ...nx.configs["flat/javascript"], - { - files: ['**/*.{ts,tsx}'], - plugins: { 'react-hooks': reactHooks }, - rules: { - 'react-hooks/rules-of-hooks': 'error', - } - }, - { - "ignores": [ - "**/dist", - "**/vite.config.*.timestamp*", - "**/vitest.config.*.timestamp*" - ] - }, - { - files: [ - "**/*.tsx", - ], - rules: { - "@nx/enforce-module-boundaries": [ - "error", - { - enforceBuildableLibDependency: true, - allow: [ - "^.*/eslint(\\.base)?\\.config\\.[cm]?js$" - ], - depConstraints: [ - { - sourceTag: "*", - onlyDependOnLibsWithTags: [ - "*" - ] - } - ] - } - ] - } - }, - { - files: [ - "**/*.ts", - "**/*.tsx", - "**/*.cts", - "**/*.mts", - "**/*.js", - "**/*.jsx", - "**/*.cjs", - "**/*.mjs" - ], - // Override or add rules here - rules: {} - } -]; diff --git a/package.json b/package.json index 0d88353bc..6eafcf347 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ "chore:generate-openapi": "tsx ./scripts/generate-openapi.ts", "chore:update-build-info": "tsx ./scripts/update-build-info.ts", "chore:update-version": "tsx ./scripts/update-version.ts", + "edit-docs:edit-docs": "pnpm run --filter edit-docs edit-docs", + "edit-docs:edit-demo": "pnpm run --filter edit-docs edit-demo", "test:all": "pnpm test:parallel && pnpm test:sequential", "test:parallel": "pnpm --filter=!server --filter=!ckeditor5-mermaid --filter=!ckeditor5-math --parallel test", "test:sequential": "pnpm --filter=server --filter=ckeditor5-mermaid --filter=ckeditor5-math --sequential test", diff --git a/packages/ckeditor5/README.md b/packages/ckeditor5/README.md deleted file mode 100644 index 99d7186b4..000000000 --- a/packages/ckeditor5/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# ckeditor5 - -This library was generated with [Nx](https://nx.dev). - -## Building - -Run `nx build ckeditor5` to build the library. diff --git a/packages/ckeditor5/vite.config.ts b/packages/ckeditor5/vite.config.ts index 64a0ea57a..a310ff5c9 100644 --- a/packages/ckeditor5/vite.config.ts +++ b/packages/ckeditor5/vite.config.ts @@ -7,12 +7,6 @@ export default defineConfig(() => ({ root: __dirname, cacheDir: '../../node_modules/.vite/packages/ckeditor5', plugins: [dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })], - // Uncomment this if you are using workers. - // worker: { - // plugins: [ nxViteTsPaths() ], - // }, - // Configuration for building your library. - // See: https://vitejs.dev/guide/build.html#library-mode build: { outDir: './dist', emptyOutDir: true, diff --git a/packages/codemirror/README.md b/packages/codemirror/README.md deleted file mode 100644 index 34cc0ce78..000000000 --- a/packages/codemirror/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# codemirror - -This library was generated with [Nx](https://nx.dev). - -## Building - -Run `nx build codemirror` to build the library. diff --git a/packages/codemirror/eslint.config.mjs b/packages/codemirror/eslint.config.mjs deleted file mode 100644 index 9ee1191ff..000000000 --- a/packages/codemirror/eslint.config.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - "files": [ - "**/*.json" - ], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": [ - "{projectRoot}/eslint.config.{js,cjs,mjs}", - "{projectRoot}/vite.config.{js,ts,mjs,mts}" - ] - } - ] - }, - "languageOptions": { - "parser": (await import('jsonc-eslint-parser')) - } - } -]; diff --git a/packages/codemirror/vite.config.ts b/packages/codemirror/vite.config.ts index c2ba7e860..cb3055d05 100644 --- a/packages/codemirror/vite.config.ts +++ b/packages/codemirror/vite.config.ts @@ -7,12 +7,6 @@ export default defineConfig(() => ({ root: __dirname, cacheDir: '../../node_modules/.vite/packages/codemirror', plugins: [dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') }), ], - // Uncomment this if you are using workers. - // worker: { - // plugins: [ nxViteTsPaths() ], - // }, - // Configuration for building your library. - // See: https://vitejs.dev/guide/build.html#library-mode build: { outDir: './dist', emptyOutDir: true, diff --git a/packages/commons/README.md b/packages/commons/README.md deleted file mode 100644 index 21a2e80a8..000000000 --- a/packages/commons/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# commons - -This library was generated with [Nx](https://nx.dev). - -## Building - -Run `nx build commons` to build the library. - -## Running unit tests - -Run `nx test commons` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/packages/commons/eslint.config.mjs b/packages/commons/eslint.config.mjs deleted file mode 100644 index 9ee1191ff..000000000 --- a/packages/commons/eslint.config.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - "files": [ - "**/*.json" - ], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": [ - "{projectRoot}/eslint.config.{js,cjs,mjs}", - "{projectRoot}/vite.config.{js,ts,mjs,mts}" - ] - } - ] - }, - "languageOptions": { - "parser": (await import('jsonc-eslint-parser')) - } - } -]; diff --git a/packages/express-partial-content/eslint.config.mjs b/packages/express-partial-content/eslint.config.mjs deleted file mode 100644 index b0d78db72..000000000 --- a/packages/express-partial-content/eslint.config.mjs +++ /dev/null @@ -1,23 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - "files": [ - "**/*.json" - ], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": [ - "{projectRoot}/eslint.config.{js,cjs,mjs}" - ] - } - ] - }, - "languageOptions": { - "parser": (await import('jsonc-eslint-parser')) - } - } -]; diff --git a/packages/express-partial-content/vite.config.ts b/packages/express-partial-content/vite.config.ts index 450381921..e813c9ac1 100644 --- a/packages/express-partial-content/vite.config.ts +++ b/packages/express-partial-content/vite.config.ts @@ -5,10 +5,6 @@ export default defineConfig(() => ({ root: __dirname, cacheDir: '../../node_modules/.vite/packages/express-partial-content', plugins: [], - // Uncomment this if you are using workers. - // worker: { - // plugins: [ nxViteTsPaths() ], - // }, test: { watch: false, globals: true, diff --git a/packages/highlightjs/README.md b/packages/highlightjs/README.md deleted file mode 100644 index d3897f3f7..000000000 --- a/packages/highlightjs/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# highlightjs - -This library was generated with [Nx](https://nx.dev). - -## Building - -Run `nx build highlightjs` to build the library. - -## Running unit tests - -Run `nx test highlightjs` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/packages/highlightjs/eslint.config.mjs b/packages/highlightjs/eslint.config.mjs deleted file mode 100644 index 9ee1191ff..000000000 --- a/packages/highlightjs/eslint.config.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import baseConfig from "../../eslint.config.mjs"; - -export default [ - ...baseConfig, - { - "files": [ - "**/*.json" - ], - "rules": { - "@nx/dependency-checks": [ - "error", - { - "ignoredFiles": [ - "{projectRoot}/eslint.config.{js,cjs,mjs}", - "{projectRoot}/vite.config.{js,ts,mjs,mts}" - ] - } - ] - }, - "languageOptions": { - "parser": (await import('jsonc-eslint-parser')) - } - } -];