kookma / TW-Commander

A tiddler toolkit for Tiddlywiki 5. Batch operations on bulk of tiddlers. Create, delete, add fields, tags, search and replace and inspect tiddlers.
https://kookma.github.io/TW-Commander/
49 stars 6 forks source link

TW-Commander for NodeJS #4

Closed flibbles closed 5 years ago

flibbles commented 5 years ago

So after having experimented with your plugin because of our discussion, I've identified a few times your plugin would have been helpful just this afternoon.

However, I have many projects, and they work through NodeJS. Instead of installing Commander individually into all of them, I'd much prefer to be able to install Commander in my /usr/local/lib/node_modules/tiddlywiki/plugins directory and then have my servers import them on startup by having commander listed under plugins in my project's tiddlywiki.info file. That way, I only need one instance of TW5-Commander on my machine.

Except, the only thing in your repository is the precompiled plugin. That's only good for standalone tiddlywiki.

Is there any chance you could include your individual source files in a /kookma/commander? It'd also allow other contributors to help out. I would have made a pull request for the change we discussed earlier, but I couldn't because I had no source files to work with.

-Flibbles

flibbles commented 5 years ago

If you're not interested, or you're not sure how, I can always use commandline tiddlywiki to unpack your plugin. It'd just take me a few minutes to remember how.

kookma commented 5 years ago

@flibbles Sure! I will add the source as you requested! I would also appreciate your help in improving Tiddler Commander

flibbles commented 5 years ago

This is in response to the message you sent me on Google Forum.

I don't know anything about ThirdFlow. I've always developed my plugins in a similar manner similar to how Jermolene makes the tiddlywiki plugins that distribute with the source, but not quite. He'd have you check out the entire Tiddlywiki repository and put your plugin in the plugin directory. I keep my repository separate, and if I want to install it into my Tiddlywiki5 distribution, I just copy the plugin part over.

Working with separated files isn't too hard, though it does require you to have tiddlywiki on the commandline. This can be done with npm install tiddlywiki pretty easily (if you're on windows, I'm not sure how it varies, but I'm sure it's possible).

All the tiddlers are separated out into separate .tid files (with some exceptions) usually under a /plugins/kookma/commander directory. You edit them with whatever editor you want. To run them, you would run a tiddlywiki server for a project which imports that directory in it's tiddlywiki.info file. For me, I have my demo site checked in right alongside my source, so I only have to go to my root directory and type tiddlywiki --server to have it all just work.

You can also create the .tid plugin file by typing tiddlywiki --savetiddler $:/plugins/kookma/commander index.htmlwhich creates the same file you currently have checked into your source. You can also generate a standalone demo site with tiddlywiki --rendertiddler $:/core/save/all site.html text/plain I think. You can also configure your tiddlywiki.info file to set all this up under one nice tiddlywiki --build command.

BUT having said all this. If this all makes you uncomfortable, you shouldn't do it. This is your project, not mine, and I've already figured out the command I need to unpack your tiddler into a plugin directory, so I don't need you to do this in order for me to use it with NodeJS.

But if you do want to do this, then it may make sense for me to do the unpacking (seeing as how I just looked up the command). It's only something that would have to be done once, and I know all the neat bits, like how to properly set up your css files, and how to configure your tiddlywiki.info file and plugins.info file.

kookma commented 5 years ago

Thanks for your detailed explanation! Yes, I have nodeJS + TW5 installed on my system and the present Commander plugin has been developed using ThirdFlow (lets work with Node.JS version of TW), but what I published is the packed plugin!

I think ThirdFlow automates much of the works should be done from command line! but I need to resolve some minor issues! I hope I could publish the source on GitHub! My concern is to have minimum manual operation during development and publishing to GitHub!

flibbles commented 5 years ago

If you broke it down into source files

I don't know what the workflow is like with ThirdFlow. If the workflow I just described sounds amenable to you, I can make a pull request which has your project broken down exactly as you'd want it.

kookma commented 5 years ago

Many thanks for complementary explanations! I will soon update the source files!

Yes, ThirdFlow do all of these except the git part! The issue was it does not keep all files in the same folder because its primary objective is to create packaged plugin!

I recommend to have a look.

flibbles commented 5 years ago

I have tried it. The plugin seems to be working as intended. And it integrates with Relink just fine.

I hope it wasn't too much effort, and remember, if this new workflow doesn't work for you, don't keep it just on my account.

kookma commented 5 years ago

I planned to create a new branch and see how I can use Relink with Commander! It seems I need to add checkboxes or a setting section to let Commander knows if a call to Relink is needed!

flibbles commented 5 years ago

Probably just this:

<$checkbox tiddler="$:/config/RelinkOnRename" field="text" checked="yes" unchecked="no" default="no"> {{$:/language/EditTemplate/Title/Relink/Prompt}}</$checkbox>

That'll enable/disable Relink if Relink is installed. It'll also enable/disable the vanilla list and tags relink if Relink isn't installed.

flibbles commented 5 years ago

The language string will also be correct whether or not Relink is installed.

kookma commented 5 years ago

Many thanks! It works like a charm! I gonna to prepare a new release! I will add the checkbox under setting! This way users can install both plugin as they wish and if Relink was present then the setting will show the checkbox! Please let me know if you have any comment idea.

One question: Does this setting affect Relink globally or it will be local to Tiddler Commander?

flibbles commented 5 years ago

It's global, and the way that checkbox is used in core is that it appears while you're trying to rename a tiddler. If you set it up as a setting in your global configuration, that setting is bound to change as users check or uncheck the checkbox that appears under any renamed tiddler.

It may be better to have that checkbox appear on the rename page so users can toggle it per operation. That seems to me to be more in line with how core Tiddlywiki expects it to behave.

kookma commented 5 years ago

That sounds good! but lets see where tiddler name can be changed

So, at least in two places this checkbox should be appeared!

kookma commented 5 years ago

$:/language/EditTemplate/Title/Relink/Prompt seems does not work properly with commander, as it rename bulk of tiddler! I think I need to use something consistent here!

flibbles commented 5 years ago

It's your call. If the Relink/Prompt doesn't fit, then perhaps something generic will, like "Relink tiddlers", but then mention in your documentation that Commander integrates with Relink. Maybe the prompt can be a link to your documentation.

Or maybe you set up a variable message prompt depending on whether $:/plugins/flibbles/filters exists.

kookma commented 5 years ago

A new update has been pushed! It can integrate to relink now!