Skip to content

Basic script deployer - #9543

Merged
eliandoran merged 30 commits into
mainfrom
tool/script_deployer
Apr 23, 2026
Merged

Basic script deployer#9543
eliandoran merged 30 commits into
mainfrom
tool/script_deployer

Conversation

@eliandoran

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the script-deployer application, a development harness designed for writing and deploying Trilium scripts to a local instance. The package includes a deployment engine that manages metadata parsing, TypeScript transpilation, and note synchronization, alongside a development server with file-watching and hot-reloading capabilities. Additionally, it provides a utility script for importing Xournal++ (.xopp) files into Trilium canvas notes. Review feedback highlights the need to remove a debug log, ensure that metadata like labels and render note titles are updated during redeployment, and use parameterized inputs when injecting scripts via websockets to prevent syntax errors from special characters.

Comment on lines +167 to +168
console.log("Stroke width ", widths[0], el.strokeWidth);
el.opacity = isHighlighter ? 40 : extractOpacity(color);

This comment was marked as outdated.

Comment thread apps/script-deployer/src/deploy.ts
Comment thread apps/script-deployer/src/dev.ts Outdated
Comment on lines +166 to +174
script: `function() {
for (const ctx of api.getNoteContexts()) {
if (ctx.noteId === "${renderId}") {
api.triggerEvent("refreshData", { ntxId: ctx.ntxId });
console.log("[script-deployer] refreshed", "${meta.title}", "in context", ctx.ntxId);
}
}
}`,
params: [],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Injecting variables directly into the script string via template literals can lead to syntax errors if the values contain quotes (e.g., if meta.title contains a double quote). It is safer to pass these values via the params array.

                script: "function(title, renderId) {\n                    for (const ctx of api.getNoteContexts()) {\n                        if (ctx.noteId === renderId) {\n                            api.triggerEvent(\"refreshData\", { ntxId: ctx.ntxId });\n                            console.log(\"[script-deployer] refreshed\", title, \"in context\", ctx.ntxId);\n                        }\n                    }\n                }",\n                params: [meta.title, renderId],

@eliandoran eliandoran changed the title Tool/script deployer Basic script deployer Apr 23, 2026
@eliandoran eliandoran added this to the v0.103.0 milestone Apr 23, 2026
@eliandoran
eliandoran marked this pull request as ready for review April 23, 2026 19:31
@eliandoran
eliandoran merged commit 007764c into main Apr 23, 2026
13 checks passed
@eliandoran
eliandoran deleted the tool/script_deployer branch April 23, 2026 19:31
@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant