Is there a good way to make a community edition available for `tiddlywiki --init`?

Say I have a folder wiki that I would like to use as a template for myself. I would like to be able to easily generate new folder wikis off of this template.

I can use tiddlywiki --init my_edition_name for any editions that are included in the base tiddlywiki npm package. And as far as I can tell, these editions (in /usr/lib/node_modules/tiddlywiki/editions on my computer) are just standard folder wikis. But I don’t want to copy my custom edition into this folder since NPM will probably end up overwriting it sooner or later.

Similarly to the situation for plugins, is there a way to specify a custom location for editions?

1 Like

Hey @sobjornstad – I shuffled this into the Developers category for now.

A question for you: by “folder wiki”, do you mean that interchangeably with “edition”?

That is, a collection of individual .tid files, plugins, and an empty.html/ index.html in a folder?

@boris: By “folder wiki,” I mean the native format used by the Node.js platform to store wikis. By “edition” I mean these guys, or the options you have when you run tiddlywiki --editions. The editions can be copied out into new folder wikis with a tiddlywiki --init edition, or they can be built into HTML files and distributed on the web to users who want to use them in the single-file version.

It is my belief, from looking at the way editions are stored on my computer, that folder wikis and editions are the same format under the hood (tiddlywiki --listen in an edition folder works, for example), but I am not 100% sure about that and can’t find it documented anywhere. They do have different purposes (folder wikis store content for production use, while editions are templates for creating production folder wikis).

Neither of these, as far as I can tell, involves an index.html in a folder. Folder wikis definitely do not (the lack of that HTML file is the defining feature of a folder wiki, to me).

It has been quite some time since I was looking at the relevant code but try setting the TIDDLYWIKI_EDITION_PATH environmental variable to point to the folder with your own editions.

Edit: IIRC there is a corresponding plugin, theme and language environmental variable too. On mobile at the moment so can’t confirm.

See https://tiddlywiki.com/#Environment%20Variables%20on%20Node.js

Aha, thought there would be something somewhere in the docs but couldn’t find it. This looks promising! I’ll give it a shot and let you know how it goes.

Yes, I use ENV variables when launching Node TW via bash script or VSCode “launch” settings. Here is the bash script to launch my new multiserver, for example:


#!/usr/bin/env bash

# You need to use the full path here, ~/TiddlyWiki/Plugins doesn't work
export TIDDLYWIKI_PLUGIN_PATH="/c/tw/plugins"
export TIDDLYWIKI_THEME_PATH="/c/tw/themes"
export TIDDLYWIKI_EDITION_PATH="/c/tw/editions"

# The last two 'node tiddlywiki' arguments are the path to the folder that contains the
# tiddlywiki.info file for the RootWiki and the server command for the Yjs websockets plugin.

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

node tiddlywiki "+plugins/joshuafontany/tw5-yjs" "+plugins/joshuafontany/tw5-yjswebsockets" "+plugins/tiddlywiki/filesystem" "$SCRIPT_DIR" --ws-server

1 Like

Just to follow up, TIDDLYWIKI_EDITION_PATH did exactly what I wanted. Thanks everyone!

A followup note for users coming across this later:

The TIDDLYWIKI_PLUGINS_PATH Environment Variable is how you can have a folder full of plugin-folders, outside of the main TW repository, and access them by including them on the command line (as my bash script does) or by listing them in the tiddlywiki.info file for that wiki.

This is a “centralized” alternate to having a plugins/ folder in each wiki-folder. NOTE: With the ENV variable forlder, all plugins have to be listed under an “author folder” (while those in the ${wikiPath}/plugins/ directory have to be only 1 folder down).

2 Likes