[tw5] What's the process for moving a single-file TiddlyWiki to a TiddlyWiki on node.js?

Hello all,

I was under the impression that the html file for a single-file TiddlyWiki could simply be dragged to the node.js TiddlyWiki for importing.

Having tried this with two different single-file TiddlyWikis, the node.js TiddlyWiki (i.e. a clean/unmodified new TiddlyWiki instance) cannot be restarted after the import, getting all kinds of errors that seem javascript related.

Using this single-file TiddlyWiki as the case study, what’s the process to successfully import that TiddlyWiki’s tiddlers into a new and unmodified TiddlyWiki running on node.js ?

And are there other process steps to consider that may not need to be considered in this particular example TiddlyWiki ?

Hi,

Which TW server version do you use?

tiddlywiki --version will show it.

-m

Hi,

version 5.1.23

Should I first upgrade the single-file TiddlyWiki from 5.1.22 to 5.1.23 ?

No. … I did test it with the prerelease and it worked without a problem. I’ll test it with 5.1.23 again.
-mario

1 Like

If it matters any: version of node is 10.24.0

You have a very strange tiddler title, that start with: <$vars vWorkingTid … It seems to cause a problem with the node.js syncer. … No tiddlers are saved. … I did disable it at import so all tiddlers seemed to be created … But … see next issue :wink:

And there seems to be a getstartupcontext.js macro that I don’t know. … It causes a problem at server startup.

I’ll investigate further and let you know.

-m

getstartupcontext.js, that I can get rid of going forward.

If you want, delete that tiddler from the process.

And that “<$vars vWorking Tid…” tiddler, that’s definitely something I created by mistake while in the process of creating an action widget.

I think. I can’t explain that tiddler.

It’s astonishing that this mechanism works. … Where did you get this implementation from?
The mechanism in “Set Startup Context” is completely new to me. … And it seems to cause a problem in the server because it references the “window” object, which is only available in the browser. …

So IMO there would only be a if($tw.browser) needed. … Maybe

-m

Hi,
Yea, if those 2 tiddlers are removed it works. … Will have a closer look at the macro. …

-m

Please don’t spend too much of your time on that macro.

That was very early going when I couldn’t figure out a way to accomplish the same thing with just native TW code.

I am no fan of javascript, so quite happy to send that js code to the dustbin.

Maybe not tonight. Bad thunderstorm going on over here, and the lights are flickering something silly…

I’m not really sure, what the macro does, but if the .run function would look like this:

exports.run = function() {
if ($tw.browser) {
const queryString = window.location.search;
try {
const urlParams = new URLSearchParams(queryString);
const wikicontext = urlParams.get(‘context’);
var output = wikicontext;

if ( (output !== “OffGridding”) && (output !== “HydroCutting”) && (output !== “Chromebook”) ){
output = “ProductReviews”;
};
document.title = output;
}
catch(err) {
output = “ProductReviews”;
}
return output;
}
};

It will let the server start in a normal way. …

-mario

It seems the prerelease can handle this strange tiddler name. … That’s a good thing :slight_smile:

have fun!
over and out :wink:

mario

Woohoo !

All is working A-1. Thank-you very much for your help !

I got rid of the wonky tiddler likely created while in the midst of coding a new-tiddler action widget.

I also replaced my on startup “context-setting” javascript macro with some native TW code to do the job, which makes me a much happier camper.

Cheers !