thediveo / TW5FontAwesome

⚑ Embedding Font Awesome in TW5
http://thediveo.github.io/TW5FontAwesome
Other
40 stars 3 forks source link

Missing plugin.info #9

Open sobjornstad opened 3 years ago

sobjornstad commented 3 years ago

First of all, thanks very much for this plugin, very handy!

There is no plugin.info file in the plugin's source folder currently, which is preventing me from loading it into the plugins folder of my folder wiki and having TiddlyWiki recognize it.

It looks like the FontAwesome.tid file contains all the information a plugin.info would, so I am guessing this is an older format that was used before I started using TiddlyWiki. Would it be possible to update to the new method? Or if there's some way I can make TiddlyWiki recognize it in this format (I tried a lot, and I can't find anything documented), please share!

thediveo commented 3 years ago

FontAwesome.tid is the plugin itself in ASCII format (there's no official file extension as far as I know) and you simply can drag and drop it onto your TiddlyWiki in a browser.

If I get information about plugin.info I might be able to support it; as far as I know from long ago, the info files are meta data, referencing plugins only. And this is where the problem starts: when not part of the official distribution, how are people supposed to handle the info and plugin files? Thus the current plugin-only distribution, where you simply drop the single plugin file into a TiddlyWiki instance.

sobjornstad commented 3 years ago

FontAwesome.tid is the plugin itself in ASCII format (there's no official file extension as far as I know) and you simply can drag and drop it onto your TiddlyWiki in a browser.

I'm aware that I can install it with drag-and-drop (and I currently have done so), but I'd like to easily have it available for multiple wikis, and be able to update it using a standard process like all of my other plugins.

To be clear, I'm talking about the source version found in this subdirectory, not the built release. I'd like to be able to take updates to the plugin through Git like I do my other plugins. (Including this because the FontAwesome.tid here does not contain the plugin itself, only some metadata about it, so I'm not sure we're talking about the same file.)

Here is some community documentation on the format of plugin.info. It appears to me that what you have in https://github.com/TheDiveO/TW5FontAwesome/blob/master/src/tiddlers/system/plugins/TheDiveO/FontAwesome.tid is essentially what should be in a plugin.info file, just in JSON format and called plugin.info.

as far as I know from long ago, the info files are meta data, referencing plugins only. And this is where the problem starts: when not part of the official distribution, how are people supposed to handle the info and plugin files?

Sorry, I'm not following this.

thediveo commented 3 years ago

The FontAwesome.tid inside src/tiddler/system/plugins/TheDiveO/ isn't the final plugin tiddler and isn't the plugin.info either, but instead it is the "hollow shell" for storing the meta data, yet without the plugin contents. It's not the plugin.info but the plugin tiddler data. Only as part of the plugin generation (or release) process using the ThirdFlow plugin the real and final plugin will be generated in editions/release/output/. plugin.info is separate, it's never a tiddler and for that reason I don't use it; even with plugin.info you always need the plugin tiddler itself and a developer might decide to attach fields to the tiddler which are not part of the plugin.info but useful to the plugin itself.

sobjornstad commented 3 years ago

even with plugin.info you always need the plugin tiddler itself

Maybe I am missing something, but I am pretty sure this isn't correct. The plugin tiddler appears in the wiki when you have a plugin.info containing the correct metadata in the plugin folder and start the TW listener, almost like a “virtual” tiddler is created for it. If you build into a single-file wiki from there, a correct plugin tiddler is inserted into said wiki (and no matter how it's being served, you can successfully drag and drop the plugin into another wiki).

Apart from several plugins I've written on my own without including such a tiddler, here are four examples of the plugin.info architecture and the design that appears to be most common among recently written TW plugins, several of them among the most popular plugins today:

With the plugin.info in the folders linked above, you can copy the source folder directly into the plugins location in Node, and it will work. Without the plugin.info, you cannot.

Granted, the official documentation on plugin format is so poor as to be almost nonexistent right now, so it is difficult to understand exactly what is intended. However, given that the method TW5FontAwesome is using currently appears to work in fewer situations, I'm inclined to think the plugin.info is the more correct way to do it.

I don't know what ThirdFlow is, so it's possible that it somehow does not support this?

If you think we should get more clarification on the best way to do this, one of us could start a thread on the forum.

kookma commented 3 years ago

Hi @TheDiveO

I think @sobjornstad is correct!

For better understanding how plugins work under Node.JS

https://tiddlywiki.com/#Installing%20custom%20plugins%20on%20Node.js

Actually every plugin used under Tiddlywiki+Node.JS needs a plugin.info file

See https://tiddlywiki.com/#PluginFolders

Without a plugin.info the plugin will not work! See many examples here

https://github.com/Jermolene/TiddlyWiki5

So in brief, plugins can be used in two version

thediveo commented 3 years ago

Admittedly, I'm still lost as to the use case and deployment steps so I would be glad if you could fill in my blanks here (please bear with me). Your recent pointers already help a lot; let me see if I'm getting this correct now:

kookma commented 3 years ago
  • This is not about a plugin installed into a TW by dragging and dropping its single plugin tiddler file, correct? That's what me threw off the track all the time.

Correct!

  • Where should the plugin.info file be located? In src/tiddlers/system/plugins/TheDiveO/FontAwesome?

Correct

  • How are the users then going to deploy the plugin? Setting TIDDLYWIKI_PLUGIN_PATH to a list of paths, including src/tiddlers/system/plugins?

For example a third party plugin folder defined by is TIDDLYWIKI_PLUGIN_PATH is D:/Tiddlywiki/Plugins. So if I want to have TheDiveO plugins I have to have a D:/Tiddlywiki/Plugins/TheDiveO folder as below

image

and the Thirdflow folder is like below

image

And the content of plugin.info here is

{
    "title": "$:/plugins/TheDiveO/ThirdFlow",
    "name":"ThirdFlow",
    "description": "Third Flow in-TW plugin development process support",
    "author": "TheDiveO",
    "version": "1.2.11",
    "core-version": ">=5.1.22",
    "source": "http://thediveo.github.io/ThirdFlow",
    "list": "readme license history",
    "dependents": "",
    "plugin-type": "plugin"
}

I have created this file to be able use ThirdFlow under Node.JS

danj-ca commented 2 years ago

@TheDiveO I believe I've run into the same issue as @sobjornstad, and for clarity's sake let me add my approach:

The use case that I am after (and I believe Soren is doing the same?) is running TiddlyWiki under node.js.

As described here, when you run TiddlyWiki in this case, as a client/server, dragging plugins into the wiki does not actually install them in the server, just the current browser session.

That's why we're after a different way of installing the Font Awesome plugin. :)

Here's how I successfully installed TW5FontAwesome in TiddlyWiki on node.js:

  1. Clone the TW5FontAwesome Git repository
  2. Copy the contents of src/tiddlers/system/plugins/TheDiveO to a folder where I host plugins for my TiddlyWiki on node.js install (e.g. ~/wikis/plugins)
  3. I now have a folder ~/wikis/plugins/TheDiveO that contains two things: a folder called FontAwesome with the plugin's contents, and a file called FontAwesome.tid containing metadata about the plugin
  4. As per this note about "PluginFolders", I use the information in FontAwesome.tid to create a JSON file called plugin.info. The contents of plugin.info are:
    {
    "author": "TheDiveO",
    "core-version": ">=5.1.0",
    "description": "FontAwesome embedded font support for TW5",
    "list": "readme license history",
    "name": "TW5FontAwesome",
    "plugin-type": "plugin",
    "source": "https://github.com/TheDiveO/TW5FontAwesome",
    "title": "$:/plugins/TheDiveO/FontAwesome",
    "version": "1.2.22"
    }
  5. I no longer need FontAwesome.tid, so I delete it. I put plugin.info inside the FontAwesome folder
  6. I now have a folder ~/wikis/plugins/TheDiveO/FontAwesome that contains the plugin's files alongside a plugin.info file that describes the plugin
  7. Edit the tiddlywiki.info file[^1] for my wiki to include TheDiveO/FontAwesome in its plugins collection
  8. Launch my TiddlyWiki node.js server (e.g. by running TIDDLYWIKI_PLUGIN_PATH=./plugins tiddlywiki mywikiname --listen port=8120 at the command line)
  9. Confirm FontAwesome plugin is installed and working correctly! 🥳

Hopefully the steps above are useful both to gain context on what the solution to this issue would be, and for anyone else looking to install the plugin in TiddlyWiki on node.js.

@sobjornstad can chime in if I've missed anything he requires, but I believe what we're looking for is a version of the above-mentioned src/tiddlers/system/plugins/TheDiveO/FontAwesome folder to be distributed with a plugin.info file inside, so we can easily install and upgrade the plugin. Thanks!

[^1]: (this file is used by TiddlyWiki on node.js to configure the wiki, see here)