How to modify plugin tiddlers with node.js?

Hi there,

In my slow progress into coding with TW, I now would like to modify an existing plugin: I would like to customize some parts of Projectify, and I want my modifications to be stored as shadow tiddlers inside the plugin, not only as regular tiddlers by overwriting.

I’m reasonably comfortable with node.js, and so far I’m able to do what I want by editing the text files corresponding to the tiddlers but I’m pretty sure there’s a better way… How can I use tiddlywiki on node.js to serve the plugin tiddlers as regular tiddlers and edit them within TW?

(I saw that there are certainly tools to make this easier but I would prefer to understand the basic way first)

Thanks!
Erwan

Welcome to the community!

Someone probably has a better way, but this technique has worked for me so far:

I do my editing in TW, overriding the shadow tiddlers. Then when I’m happy with them, I simply move the files from the tiddlers folder to the particular plugin folder. I will have to restart Node if I want to double-check that it’s doing what I want, but I don’t bother for each and every change, only occasionally.

Since most plugins have a common namespace, it’s easy to find the files to move.

It may not be ideal, but it works well enough for me when developing plugins.

Hi Scott,

Thanks for this idea!

But isn’t it a bit tedious to have to locate the path for each tiddler? I mean for example if I edit a tiddler $:/plugins/nico/projectify/ui/dashboard/Dashboard then in the folder tiddlers the file is named $__plugins_nico_projectify_ui_dashboard_Dashboard.tid and I have to correctly move it to its correct path plugins/nico/projectify/tiddlers/ui/dashboard/Dashboard.tid. Or is there a better way?

Thank you anyway, it’s still better than the way I was using! :slight_smile:

Ahh, for me it’s been easier because the plugins (mostly my own) have all been flat. Thus I would just move $__plugins_nico_projectify_ui_dashboard_Dashboard.tid to plugins/nico/projectify/tiddlers or even plugins/nico/projectify/. It won’t hurt if you do that. The folder structure is just for development convenience. I think the only rule is that plugin.info must be in the root, and I’m not even certain about that.

But of course that would mean needing to flatten out the plugin to work this way, or to manually delete the original the first time you edit it and move the edited one to the root; and that’s likely still a pain. If you don’t do that, it’s at the very least, messy. I just tested with one of my plugins, and it seems the ones in the root override the ones in folders (I guess it’s a post-order traversal, if that means something to you.)

So this has worked for me. It’s easier for my case because I start with flat structures. I imagine others who’ve been at this longer have better techniques.

Ok, I see.
This is not ideal for the plugin that I currently work with, but it’s a useful method to know. Thanks for sharing!