Skip to content

Build your personal knowledge base with Trilium Notes

chore(nx): clean up package JSON

Elian Doranfdcdc41ea67a
diff --git a/_regroup_monorepo/apps/client/package.json b/_regroup_monorepo/apps/client/package.json
deleted file mode 100644
index 2e28aed116..0000000000
--- a/_regroup_monorepo/apps/client/package.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "name": "@triliumnext/client",
- "version": "0.0.1",
- "description": "JQuery-based client for TriliumNext, used for both web and desktop (via Electron)",
- "homepage": "https://github.com/TriliumNext/Notes#readme",
- "bugs": {
- "url": "https://github.com/TriliumNext/Notes/issues"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/TriliumNext/Notes.git"
- },
- "license": "AGPL-3.0-only",
- "author": {
- "name": "TriliumNext Notes Team",
- "email": "[email protected]",
- "url": "https://github.com/TriliumNext/Notes"
- },
- "copyright": "",
- "type": "module",
- "main": "index.js",
- "scripts": {
- "build:webpack": "tsx ../../node_modules/webpack/bin/webpack.js -c webpack.config.ts",
- "test": "vitest"
- },
- "devDependencies": {
- "autoprefixer": "10.4.21",
- "mini-css-extract-plugin": "2.9.2",
- "ts-loader": "9.5.2",
- "tsx": "4.19.3",
- "webpack-cli": "6.0.1",
- "webpack": "5.99.6",
- "sass": "1.86.3",
- "sass-loader": "16.0.5",
- "electron": "35.1.5",
- "debounce": "2.2.0",
- "vitest": "3.1.1",
- "css-loader": "7.1.2",
- "postcss-loader": "8.1.1"
- }
-}
diff --git a/_regroup_monorepo/apps/desktop/package.json b/_regroup_monorepo/apps/desktop/package.json
deleted file mode 100644
index 5aed8a6862..0000000000
--- a/_regroup_monorepo/apps/desktop/package.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "name": "@triliumnext/electron",
- "version": "0.0.1",
- "description": "Desktop client for TriliumNext, embedding both the client and the server.",
- "homepage": "https://github.com/TriliumNext/Notes#readme",
- "bugs": {
- "url": "https://github.com/TriliumNext/Notes/issues"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/TriliumNext/Notes.git"
- },
- "license": "AGPL-3.0-only",
- "author": {
- "name": "TriliumNext Notes Team",
- "email": "[email protected]",
- "url": "https://github.com/TriliumNext/Notes"
- },
- "type": "module",
- "main": "src/electron-main.js",
- "scripts": {
- "start": "cross-env NODE_OPTIONS=\"--import tsx\" TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev electron ./src/electron-main.ts --inspect=5858 .",
- "start-prod": "npm run build:prepare-dist && npx electron-rebuild -m build && cross-env TRILIUM_DATA_DIR=./data TRILIUM_ENV=prod electron ./build/src/electron-main.js --inspect=5858 .",
-
- "build:clean": "rimraf ./dist ./build",
- "build:copy-dist": "tsx ./scripts/copy-dist.ts",
- "build:prepare-dist": "npm run build:clean && npm run build:copy-dist && npm run build:ts",
- "build:ts": "tsc",
-
- "electron-forge:start": "npm run build:prepare-dist && cd ./build && electron-forge start",
- "electron-forge:make": "npm run build:prepare-dist && cross-env DEBUG=electron-windows-installer:* electron-forge make ./build",
- "electron-forge:package": "npm run build:prepare-dist && cd ./build && electron-forge package"
- },
- "dependencies": {
- "@triliumnext/server": "0.0.1"
- },
- "devDependencies": {
- "tsx": "4.19.3"
- }
-}
diff --git a/_regroup_monorepo/apps/desktop/scripts/copy-dist.ts b/_regroup_monorepo/apps/desktop/scripts/copy-dist.ts
deleted file mode 100644
index 9f16435579..0000000000
--- a/_regroup_monorepo/apps/desktop/scripts/copy-dist.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import { execSync } from "child_process";
-import fs from "fs-extra";
-import path from "path";
-
-const DEST_DIR = "./build";
-
-const VERBOSE = process.env.VERBOSE;
-
-function log(...args: any[]) {
- if (VERBOSE) {
- console.log(...args);
- }
-}
-
-try {
- fs.mkdirpSync(DEST_DIR);
- copyNodeModules("./package.json");
- copyPackageJson();
-
- /**
- * Copy the server.
- */
- fs.copySync("../server/build", path.join(DEST_DIR, "node_modules", "@triliumnext/server"));
-
- /**
- * Copy assets.
- */
- const assetsToCopy = new Set([
- "./tsconfig.json",
- "./forge.config.cjs",
- "./scripts/electron-forge/desktop.ejs",
- "./scripts/electron-forge/sign-windows.cjs",
- ]);
-
- for (const asset of assetsToCopy) {
- log(`Copying ${asset}`);
- fs.copySync(asset, path.join(DEST_DIR, asset));
- }
-
- /**
- * Directories to be copied relative to the project root into <resource_dir>/src/public/app-dist.
- */
- const publicDirsToCopy = ["../server/src/public/app/doc_notes"];
- const PUBLIC_DIR = path.join(DEST_DIR, "src", "public", "app-dist");
- for (const dir of publicDirsToCopy) {
- fs.copySync(dir, path.join(PUBLIC_DIR, path.basename(dir)));
- }
-
- console.log("Copying complete!")
-
-} catch(err) {
- console.error("Error during copy:", err)
- process.exit(1)
-}
-
-/**
- * We cannot copy the node_modules directory directly because we are in a monorepo and all the packages are gathered at root level.
- * We cannot copy the files manually because we'd have to implement all the npm lookup logic, especially since there are issues with the same library having multiple versions across dependencies.
- *
- * @param packageJsonPath
- */
-function copyNodeModules(packageJsonPath: string) {
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
-
- // Skip monorepo packages
- packageJson.dependencies = Object.fromEntries(
- Object.entries(packageJson.dependencies).filter(([key]) => {
- return !key.startsWith("@triliumnext");
- }));
-
- // Trigger an npm install to obtain the dependencies.
- fs.writeFileSync(path.join(DEST_DIR, "package.json"), JSON.stringify(packageJson));
- execSync(`npm install --omit=dev`, {
- cwd: DEST_DIR,
- stdio: "inherit",
- });
-}
-
-/**
- * Rewrite the name field of `package.json` since electron-forge does not support forward slashes in the name.
- * Other attempts to rewrite the name field in the forge config have failed.
- */
-function copyPackageJson() {
- const packageJsonPath = path.join("package.json");
- const packageJson = fs.readJSONSync(packageJsonPath);
- packageJson.name = "trilium";
- fs.writeJSONSync(path.join(DEST_DIR, "package.json"), packageJson, { spaces: 2 });
-}
diff --git a/_regroup_monorepo/packages/commons/package.json b/_regroup_monorepo/packages/commons/package.json
deleted file mode 100644
index 6f7e5dce56..0000000000
--- a/_regroup_monorepo/packages/commons/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "@triliumnext/commons",
- "version": "0.0.1",
- "description": "Shared library between the clients (e.g. browser, Electron) and the server, mostly for type definitions and utility methods.",
- "homepage": "https://github.com/TriliumNext/Notes#readme",
- "bugs": {
- "url": "https://github.com/TriliumNext/Notes/issues"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/TriliumNext/Notes.git"
- },
- "license": "AGPL-3.0-only",
- "author": {
- "name": "TriliumNext Notes Team",
- "email": "[email protected]",
- "url": "https://github.com/TriliumNext/Notes"
- },
- "type": "module",
- "main": "build/index.js",
- "types": "build/index.d.ts",
- "scripts": {
- "build": "tsc"
- },
- "devDependencies": {
- "@types/node": "^22.14.1",
- "typescript": "5.8.3",
- "vitest": "^3.1.1"
- }
-}
diff --git a/_regroup_monorepo/packages/commons/tsconfig.json b/_regroup_monorepo/packages/commons/tsconfig.json
deleted file mode 100644
index 325460524c..0000000000
--- a/_regroup_monorepo/packages/commons/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "compilerOptions": {
- "module": "NodeNext",
- "declaration": true,
- "outDir": "build",
- },
- "include": [ "./src/**/*.ts" ]
-}
\ No newline at end of file
diff --git a/apps/client/package.json b/apps/client/package.json
index 384b8c5f56..1868fd6389 100644
--- a/apps/client/package.json
+++ b/apps/client/package.json
@@ -1,7 +1,14 @@
{
"name": "@triliumnext/client",
"version": "0.0.1",
+ "description": "JQuery-based client for TriliumNext, used for both web and desktop (via Electron)",
"private": true,
+ "license": "AGPL-3.0-only",
+ "author": {
+ "name": "TriliumNext Notes Team",
+ "email": "[email protected]",
+ "url": "https://github.com/TriliumNext/Notes"
+ },
"dependencies": {
"@eslint/js": "9.25.0",
"@excalidraw/excalidraw": "0.18.0",
diff --git a/apps/server/package.json b/apps/server/package.json
index 1700422b78..e9c200713a 100644
--- a/apps/server/package.json
+++ b/apps/server/package.json
@@ -1,6 +1,7 @@
{
"name": "@triliumnext/server",
"version": "0.0.1",
+ "description": "Desktop client for TriliumNext, embedding both the client and the server.",
"private": true,
"dependencies": {
"better-sqlite3": "11.9.1",
diff --git a/packages/commons/package.json b/packages/commons/package.json
index ff66355f66..f3590e58cf 100644
--- a/packages/commons/package.json
+++ b/packages/commons/package.json
@@ -1,6 +1,7 @@
{
"name": "@triliumnext/commons",
"version": "0.0.1",
+ "description": "Shared library between the clients (e.g. browser, Electron) and the server, mostly for type definitions and utility methods.",
"private": true,
"type": "module",
"main": "./dist/index.js",
@@ -15,6 +16,12 @@
"default": "./dist/index.js"
}
},
+ "license": "AGPL-3.0-only",
+ "author": {
+ "name": "TriliumNext Notes Team",
+ "email": "[email protected]",
+ "url": "https://github.com/TriliumNext/Notes"
+ },
"nx": {
"sourceRoot": "packages/commons/src",
"targets": {