Skip to content

Build your personal knowledge base with Trilium Notes

chore(share): prebuilt template

Elian Doran2d3265136d2e
diff --git a/packages/share-theme/package.json b/packages/share-theme/package.json
index 6120927658..8950f47a29 100644
--- a/packages/share-theme/package.json
+++ b/packages/share-theme/package.json
@@ -18,6 +18,7 @@
"license": "ISC",
"devDependencies": {
"@digitak/esrun": "^3.2.24",
+ "@digitalmaas/esbuild-plugin-ejs": "1.0.0",
"@types/swagger-ui": "^3.52.0",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
diff --git a/packages/share-theme/scripts/build.ts b/packages/share-theme/scripts/build.ts
index 4db3dce673..ef36d18049 100644
--- a/packages/share-theme/scripts/build.ts
+++ b/packages/share-theme/scripts/build.ts
@@ -1,5 +1,6 @@
import fs from "node:fs";
import path from "node:path";
+import ejsPlugin from "@digitalmaas/esbuild-plugin-ejs";
// import {fileURLToPath} from "node:url";
import dotenv from "dotenv";
@@ -15,9 +16,30 @@ const rootDir = path.dirname(process.env.npm_package_json!);
dotenv.config();
-const modules = ["scripts", "styles"];
+const modules = ["scripts", "styles", "templates"];
const entryPoints: {in: string, out: string}[] = [];
-const makeEntry = (mod: string) => ({"in": path.join(rootDir, "src", mod, mod === "styles" ? "index.css" : "index.ts"), "out": mod});
+
+function makeEntry(mod: string) {
+ let entrypoint: string;
+ switch (mod) {
+ case "styles":
+ entrypoint = "index.css";
+ break;
+ case "scripts":
+ entrypoint = "index.ts";
+ break;
+ case "templates":
+ entrypoint = "page.ejs";
+ break;
+ default:
+ throw new Error(`Unknown module type ${mod}.`);
+ }
+
+ return {
+ "in": path.join(rootDir, "src", mod, entrypoint),
+ "out": mod
+ };
+}
const modulesRequested = process.argv.filter(a => a.startsWith("--module="));
for (const mod of modulesRequested) {
@@ -36,6 +58,9 @@ async function runBuild() {
outdir: path.join(rootDir, "dist"),
format: "cjs",
target: ["chrome96"],
+ plugins: [
+ ejsPlugin()
+ ],
loader: {
".png": "dataurl",
".gif": "dataurl",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 93c1dcbeb0..8e75ae2763 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -473,9 +473,6 @@ importers:
'@braintree/sanitize-url':
specifier: 7.1.1
version: 7.1.1
- '@digitalmaas/esbuild-plugin-ejs':
- specifier: 1.0.0
- version: 1.0.0([email protected])
'@electron/remote':
specifier: 2.1.2
version: 2.1.2([email protected])
@@ -1282,6 +1279,9 @@ importers:
'@digitak/esrun':
specifier: ^3.2.24
version: 3.2.26
+ '@digitalmaas/esbuild-plugin-ejs':
+ specifier: 1.0.0
+ version: 1.0.0([email protected])
'@types/swagger-ui':
specifier: ^3.52.0
version: 3.52.4
@@ -1303,9 +1303,6 @@ importers:
highlight.js:
specifier: ^11.8.0
version: 11.11.1
- trilium-etapi:
- specifier: ^0.1.2
- version: 0.1.2
typescript:
specifier: ^5.2.2
version: 5.8.3
@@ -5813,9 +5810,6 @@ packages:
resolution: {integrity: sha512-yWq+R3U3jE+coOeEb3a3GgE2j/0MMiDKM/QpLb6h9ihf5fGY9UXtvK9o4vNqjWXoZz7/3EaSVU3IX53TvFFUOw==}
- resolution: {integrity: sha512-PbFMgMSrmgx6uxCdm57RUos9Tc3fclMvhLSATYN39XsDV29B89zZ3KA89jmY0vwSGazyU+uerqwa6t+KaodPcg==}
-
resolution: {integrity: sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==}
engines: {node: '>=12'}
@@ -10037,10 +10031,6 @@ packages:
resolution: {integrity: sha512-h/0ikF1M3phW7CwpZ5MMvKnfpHficWoOEyr//KVNTxV4F6deRK1eYMtHyBKEAKFK0aXIEUK9oBvlF6PNXMDsAw==}
- resolution: {integrity: sha512-GEazpTWwTZaEQ9RhL7Nyz0WwqilbqgLahDM3D0hxWwmVDI52nXEybHqiN6/elwpkJBhcuj+WbBu+QfT0uhPGfQ==}
- engines: {node: '>= 8'}
-
resolution: {integrity: sha512-WY73tMvNzXWEld2LicT9Y260L43isrZ85tPuqRyvtkljSDLmnNFQmZICt4xUJMVulmcc6L9O7jbBrtx3DOz/YQ==}
@@ -12269,10 +12259,6 @@ packages:
resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==}
hasBin: true
- resolution: {integrity: sha512-es86UOZaUCmpkdH2xNk5GGusJ2UpfxgqFpWdr7y6j7ZxNHS4q9H1mzKlslT6skTKwqUoFvZSV9jfNEqEwgsAvw==}
- engines: {node: '>=16'}
-
resolution: {integrity: sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==}
engines: {node: '>=0.10.0'}
@@ -19386,12 +19372,6 @@ snapshots:
- dependencies:
- follow-redirects: 1.15.9([email protected])
- transitivePeerDependencies:
- - debug
-
dependencies:
assertion-error: 2.0.1
@@ -24657,12 +24637,6 @@ snapshots:
- dependencies:
- centra: 2.7.0
- transitivePeerDependencies:
- - debug
-
dependencies:
glur: 1.1.2
@@ -27140,13 +27114,6 @@ snapshots:
- dependencies:
- '@types/node': 20.17.32
- phin: 3.7.1
- transitivePeerDependencies:
- - debug
-
dependencies:
escape-string-regexp: 1.0.5