Use multi-file layout without using NodeJS?

258 views
Skip to first unread message

Evade Flow

unread,
Jan 3, 2017, 4:44:43 PM1/3/17
to tiddl...@googlegroups.com
I've been experimenting with TiddlyWiki and NodeJS, and discovered that 'importing' my mono-html file (using tiddlywiki --load) causes it to be converted into a bunch of discrete files. Further experiments reveal that it is possible—seemingly, at least—to sync these files (and hence, my entire wiki) to multiple machines using git push/pull. The one catch is: it appears that the only way to actually use a TiddlyWiki structured this way is to serve it using NodeJS? Is that correct? Or... is there some way I can access/modify this collection of files using only git and a browser?

I ask because the setup I'm fumbling my way towards seems a bit... cumbersome. I'm a software developer by trade, so sync'ing git repos to multiple machines comes as naturally as breathing. In contrast, doing a local install of Node + npm + tiddlywiki on each machine I want to access the data from feels like a lot of extra effort. I use Windows and Linux at work, and OS X at home, and I'd rather not bother figuring out the nuances of how to do that dance on all three platforms—especially given that I don't have admin/root access on all the machines I'd like to access my wiki(s) from.

I already have a killer setup for managing my myriad config files (.vimrc, .zshrc, .tmux.conf, etc.) and various plugins using myrepos and vcsh. Everything is stored in git, so I can sync my setup around to whatever machines I want. It would be enormously helpful if I could do the same with my TiddlyWiki(s). Is this possible?

NOTE: After trying it a few times, I don't have much interest in trying to sync changes to monolithic TW files. The mono-HTML files are huge, and the diffs contain so much 'noise' that trying to merge updates from multiple machines seems like an impossibility. (Perhaps I'll find that the multi-file layout has quirks/pitfalls of its own, but so far, it seems really easy to understand and reason about...)

Evade Flow

unread,
Jan 3, 2017, 7:50:28 PM1/3/17
to TiddlyWiki
> is there some way I can access/modify this collection of files using only git and a browser?

Driving home this evening, I realized this was a bit of a silly question for somebody who professes to be a software developer by trade to ask—doh! (Can you tell I'm not a web developer?) Looking at the files processed by tiddlywiki+NodeJS, I see that none of them are HTML. It truly is "tiddlers all the way down", so... something has to convert all those .tid files to HTML so the browser can display them.

I guess I should rephrase my question as: is there some way of serving multi-file TW content that requires less setup work than NodeJS? I'm thinking about how Python contains builtin modules that let you run something like this in a folder:

$ python -m SimpleHTTPServer 8000

For me, this would be a big win because (as it happens) just about every machine I work on already has Python installed. And they all have Perl, which I believe has a similar (built-in) capability[?] So it would be "one less thing" to worry about it when configuring a new environment.

Arlen Beiler

unread,
Jan 3, 2017, 10:26:43 PM1/3/17
to TiddlyWiki
Anything is possible over HTTP. How are you going to save changes? 

From reading your email, I guess you don't know that you can just download any tag or the master from the TiddlyWiki GitHub repository, drop node.exe into it and call "node.exe tiddlywiki.js ../data/wiki1 --server" and your good to go. Easy on Windows, don't know about Linux or Mac, but you're a software developer :)

(At first I was going to use the stock "I guess you know...") :-)

Also several of us are working on serving multiple wikis as separate folders instead of seperate server instances.


Hope that helps.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e5c24183-b6aa-43a1-a682-2fc8137f4fab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark S.

unread,
Jan 3, 2017, 10:55:35 PM1/3/17
to TiddlyWiki
In your example, what is "../data/wiki1" and where does it come from?

Thanks!
Mark
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

Arlen Beiler

unread,
Jan 3, 2017, 11:57:04 PM1/3/17
to TiddlyWiki
If you specify --init or --load instead --server, then tiddlywiki.js will make that the data directory. Then you specify that directory when you specify --server and it will serve the files from that folder. 

You can find more info on TiddlyWiki.com or by exploring the code.

To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Arlen Beiler

unread,
Jan 4, 2017, 12:00:46 AM1/4/17
to TiddlyWiki
If you do not specify a directory as the first argument after tiddlywiki.js, it will use the current directory. Most of the commands use that directory. So I recommend you set one.

Arlen Beiler

unread,
Jan 4, 2017, 12:05:02 AM1/4/17
to TiddlyWiki
Welcome to the world of NodeJS. You can search for "commands" on TiddlyWiki.com. That will give you all the command line options.

node.exe tiddlywiki.js [data directory] [command [options]]

Arlen Beiler

unread,
Jan 4, 2017, 12:10:54 AM1/4/17
to TiddlyWiki
Normally I store the data directory inside the tiddlywiki folder, but you can store it anywhere you want.

BJ

unread,
Jan 4, 2017, 4:36:12 AM1/4/17
to tiddl...@googlegroups.com
Going away from nodejs would involve some work. Tiddlywiki is a dual platform application one platform is nodejs the other is the browser. For example:

tiddlywiki contain a packaging application that runs under nodejs - in the boot.js - this contains a build system, one feature is that it can package directory trees containing tiddlers into plugins. This makes it super easy to use git to manage plugin dev.

tiddlywiki is also a dedicated http tiddler server written for nodejs - it 'knows' how to serve and save tiddlers.

I think that nowadays nodejs is easy to install and use on any platform, and npm is included in nodejs

all the best

BJ

Evade Flow

unread,
Jan 4, 2017, 10:45:06 AM1/4/17
to TiddlyWiki
> I think that nowadays nodejs is easy to install and use on any platform, and npm is included in nodejs

After going through the process on Windows, OS X and Linux yesterday, I have to agree. It wasn't too hard to figure out on each platform. I've still got some rough edges to file down, but it seems like I can find a way to automate the steps. Or... make them 'semi-automated', anyway. Thanks for the feedback!

Evade Flow

unread,
Jan 4, 2017, 11:31:09 AM1/4/17
to TiddlyWiki
> From reading your email, I guess you don't know that you can just download any tag or the master from the TiddlyWiki GitHub repository, drop node.exe into it and call "node.exe tiddlywiki.js ../data/wiki1 --server"...

That's actually really helpful, thanks. You mean: I don't need to download all of node/npm? I found these instructions for installing on Windows, and (more-or-less) followed them, installing the npm + nodejs zip package from here, as recommended in one of the comments in the gist. It wasn't difficult, but I was a bit surprised when I saw that the node-v7.2.1-win-x64 folder takes up 70 MB. I mostly do embedded systems development, so I sometimes have these "Get off my lawn!" moments when something dumps a ton of files onto my system whose purpose I don't really understand. (This, even though I've got 315 GB free on that hard drive. I don't claim it makes any sense. `:-] )

Now that I look at it, I see that the node_modules/tiddlywiki subfolder itself is responsible for ~27 of those 70 MB. And the editions folder (which I assume I don't need?) contains some 13 MB of 'stuff'. If I only need the tiddlywiki.js file and node.exe that trims things down considerably. I'll give it a try!
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

Evade Flow

unread,
Jan 4, 2017, 11:51:35 AM1/4/17
to TiddlyWiki
> If I only need the tiddlywiki.js file and node.exe that trims things down considerably.

Ah. I see now that I misunderstood. You didn't say that having only tiddlywiki.js and node.exe was sufficient, you said to clone the TW repo and drop node.exe into it. Instead, I tried copying both node.exe and tiddlywiki.js into my TW folder, and got:


module.js:472
   
throw err;
   
^

Error: Cannot find module './boot/boot.js'
    at
Function.Module._resolveFilename (module.js:470:15)
    at
Function.Module._load (module.js:418:25)
    at
Module.require (module.js:498:17)
    at
require (internal/module.js:20:19)
    at
Object.<anonymous> (C:\Users\wod2fh\projects\reverie\tiddlywiki.js:7:11)
    at
Module._compile (module.js:571:32)
    at
Object.Module._extensions..js (module.js:580:10)
    at
Module.load (module.js:488:32)
    at tryModuleLoad
(module.js:447:12)
    at
Function.Module._load (module.js:439:3)


Now I'm thinking perhaps I'll try using git submodules to make the TW repo a 'sub-repo' of my tiddler repo...

Mark S.

unread,
Jan 4, 2017, 1:02:27 PM1/4/17
to TiddlyWiki
When I try your short-cut approach, I get warnings about missing plugins and the resulting served up TW is formatted wrongly -- as if missing a stylesheet or something. There must be an additional step setting up a tiddlywiki.info file. Perhaps it can just be copied from somewhere?

Return messages:

C
:\Users\Mark\Downloads\node\mytestwiki>node.exe tiddlywiki.js .\data1 --server
Warning: Wiki folder '.\data1' does not exist or is missing a tiddlywiki.info file
Serving on 127.0.0.1:8080
(press ctrl-C to exit)
Warning: Plugins required for client-server operation ("tiddlywiki/filesystem" a
nd
"tiddlywiki/tiddlyweb") are missing from tiddlywiki.info file


Evade Flow

unread,
Jan 4, 2017, 1:45:56 PM1/4/17
to TiddlyWiki
> Now I'm thinking perhaps I'll try using git submodules to make the TW repo a 'sub-repo' of my tiddler repo...

Well... that didn't work so well. `:-} I got an error saying: "TypeError: $tw.utils.replaceString is not a function". It's probably a PEBCAK error, but I created an issue for it, just in case, see: https://github.com/Jermolene/TiddlyWiki5/issues/2695

Evade Flow

unread,
Jan 4, 2017, 2:11:52 PM1/4/17
to TiddlyWiki
> When I try your short-cut approach, I get warnings...

Hmm. I'm still a n00b, so I'm not sure what to suggest. In case it helps, I can provide details on how I set up my initial 'tiddler repo'. I started with a monolithic HTML file that I've been using for the last week or so to explore TiddlyWiki's features. Then, I installed node and npm on a Linux machine (just 'because', I think Windows/OS X would have been fine as well). Then, I ran:


$ sudo npm install -g tiddlywiki

to install tiddlywiki globally. (It wound up in `/usr/local/bin/tiddlywiki` by default.) After that, I ran:

$ tiddlywiki mywiki --init server
Copied edition 'server' to mywiki


Apparently, that step is what created tiddlywiki.info:

$ ls mywiki
tiddlywiki
.info


After that, I used my monolithic HTML to 'seed' the mywiki folder created in the previous step and start the server:

$ tiddlywiki mywiki --load ~/Desktop/mywiki.html --server


The above command created a tiddlers folder under mywiki containing all my tiddlers.

$ ls mywiki/tiddlers | head -15
Can't_embed_QWidget_in_QML_.tid
$__config_DefaultSidebarTab.tid
$__config_PageControlButtons_Visibility_$__core_ui_Buttons_fold-all.tid
$__config_PageControlButtons_Visibility_$__core_ui_Buttons_save-wiki.tid
$__config_PageControlButtons_Visibility_$__core_ui_Buttons_unfold-all.tid
$__config_WikiParserRules_Inline_wikilink.tid
Contents.tid
$__core.json.tid
deb.tid
$__DefaultTiddlers.tid
Getting_Tiddly.tid
How_can_I_extract_files_from_a_DEB_package_.tid
How_can_I_interact_with_TiddlyWiki_using_Alexa_.tid
How_can_I_list_the_contents_of_a_DEB_file_.tid
How_can_I_remove_a_tag_.tid
...

After running all of the above commands, I ran git init in the mywiki folder and committed all the files.

HTH!

Arlen Beiler

unread,
Jan 5, 2017, 8:55:32 AM1/5/17
to TiddlyWiki
Yes, that looks right. Except just note that you only need to run --init and --load one time, not every time you run --server.

Also, instead of doing npm install, you can just download the files from GitHub, or from the latest release (currently https://github.com/Jermolene/TiddlyWiki5/releases/tag/v5.1.13). 

Then use the command "/path/to/node /path/to/tiddlywiki.js /path/to/datafolder [--server|--init|--load|...]".

I'm guessing node is self-contained on linux too. Don't know about mac, but it's always nice to have certain things easily accessible. And node is used for a lot of stuff.

Hope that helps.
-Arlen

To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages