Upgrading Mutiple External Core TiddlyWiki's by copying the Javascript file?

This is a hypothetical question.

I have 20 external-core wikis sharing a single external-core javascript file, and I would like to upgrade in order to take advantage of the latest features of hypothetical version 5.4.2.

Being a clever boy, before I started I copied the versioned tiddlywikicore-5.3.6.js to tiddlywikicore-current.js.

Then edited all the html files <script> tags to source tiddlywikicore-current.js instead of the specific version tiddlywikicore-5.3.6.js

Is the upgrade going to work if I simply download the latest external-core javascript file, and copy the new version to tiddlywikicore-current.js?

(edited to simplify/remove references to soft-linking.)

I see here has no emoji for “I don’t know”.

But your post is v. interesting and I hope gets an answer.

There are emojis for shrugging though :man_shrugging:

1 Like

Welcome to the “club” :wink:

You should not do that.

But first things first – Backup all your existing wikis.

There is no version 5.4.2 – See: TiddlyWiki Archive


The html file contains the boot-loader, which contains the very basics, that are needed to start the wiki. The problem is, that it has to fit version with the external core. If you do not change the bootloader, there will be unexpected and nearly undetectable side effects.

You should go with Upgrading your standalone wiki from tiddlywiki-com.

Alternative Way - Manually Upgrading Core Plugins

Backup First - Use at your own risk

  • Download the latest tiddlywikicore-5.3.6.js from the page Info page
    • There is a green button if you scroll down.
  • Download the latest empty.html from tiddlywiki.com
  • Rename emtpy.html to your-wiki-name.html
    • Open it from file
  • Open the tiddler: $:/config/SaveWikiButton/Template
  • Change the content to: $:/core/save/offline-external-js
  • Click the standard save button

The Wiki should be an empty.html which uses the latest external core. The HTML file should be about 110kByte now. The external-js file has to be in the same directory

  • Now drag and drop import your-wiki.html into the new wiki.
  • Update the core plugins if you used some of them

This should do the trick.

Hope that helps
Mario

The next time the wiki is saved it will probably be overwritten. Don’t know would need to be tested. So IMO no go.

It would be nice, but I agree with @pmario, there’s a good chance you’ll have problems.

The curl/diff command below shows the difference in the empty file for external core TW between 5.3.5 and 5.3.6. Because everything is serialized into a single line of json you can’t tell what’s going on - I guess a diff in the TiddlyWiki5 repo would be more revealing - but either way, the main point is that there are changes happening in the empty file, not just the core.js file. If you upgraded core.js but not the empty file, you’re running the risk that some of those changes are important and things will break without them.

export URL=https://raw.githubusercontent.com/tiddlyhost/tiddlyhost-com/main/rails/tw_content/empties/tw5x && diff --color <(curl -s "$URL/5.3.5.html") <(curl -s "$URL/5.3.6.html")
1 Like

Hi Earl,

I have been using the External JS plugin to maintain two javascript libraries—tiddlywikicore-x.x.x.js and myplugins-x.x.x.js. These two JS files are then shared across my external-core html wikis. Whenever I want to upgrade, I typically fire up TiddlyWiki on Node.js with desired versions of core and plugins (on a dummy wiki), then use the “External JS” plugin to re-export the updated core and/or the 3rd-party plugins. Once I have the new JS files, I would manually edit my TW html files and change all of the version number strings (one at the top of the file, two at the bottom). Some finer points:

  1. I just find it easier to get upgraded JS via node.js. To solely do it via single-file method, I would probably use a (dummy) wiki containing all of the plugins I want to use, run it through the single file upgrade process, then export the core and the plugins. You want to make sure, at least, any plugins maintained by TiddlyWiki are upgraded as well.

  2. Just obtaining the new core JS is likely insufficient because at minimum, the required “Snow White” and “Vanilla” core themes are not packed into the tiddlywikicore.js So I always make sure I include them in myplugins.js file.

  3. If you do not care about versioning, you can edit the template $:/plugins/cdr/external-js/filenames and specify the desired filenames for your core and plugin libraries.

Hope this helps.

Thanks everyone. So that’s a no go.

I am still testing, but it appears possible to upgrade a external-core wiki using the tiddlywiki node command:

tiddlywiki --load "original-wiki.html" --output . --render  "$:/core/save/offline-external-js" "upgraded-wiki.html" "text/plain"  

and then fetching the external javascript using curl:

version=$(tiddlywiki --version)
curl https://tiddlywiki.com/tiddywikicore-${version}.js > tiddlywikicore-${version}.js

This command line workflow would be acceptable for my currently theoretical use case.

The earliest version this may work for is 5.2.0 (Oct 2021) since that is the version where we get the $:/core/save/offline-external-js file. I didn’t test that far back. However if you have an external-core wiki, it’s guaranteed to be at least that version since the feature was simply not available before then.

(edit: corrected earliest version)

2 Likes

Agree with @cdruan. If there are no major file format changes. Just replace the theme and core js files.

Please see my post: Upgrading Mutiple External Core TiddlyWiki's by copying the Javascript file? - #4 by pmario

If you do not update the html file it can cause severe problems. The boot loader contains about 2000 lines of code and does most initialisations for tiddlers, module startup and the TW store. So hacking the html file, without proper updating can cause problems, which are almost impossible to debug.

I just did the experiment. Generated two empty.html files using @cdruan’s externaljs. Here are the results comparing v5.3.5 and v5.3.6. There are only 35 lines. Nothing that would create a bug.

12c12
< <meta name="tiddlywiki-version" content="5.3.5" />
---
> <meta name="tiddlywiki-version" content="5.3.6" />
163,166d162
< <li>Untitled</li>
< 
< <li>Untitled 1</li>
< 
180,181c176,177
< {"created":"20250217171108569","text":"yes","title":"$:/config/ExternalJS/EnableExternalPlugins","modified":"20250217171108569"},
< {"created":"20250217171139404","title":"$:/config/SaveWikiButton/Template","text":"$:/core/save/offline-external-js","modified":"20250217171139404"},
---
> {"created":"20250217171448990","text":"yes","title":"$:/config/ExternalJS/EnableExternalPlugins","modified":"20250217171448990"},
> {"created":"20250217171548320","title":"$:/config/SaveWikiButton/Template","text":"$:/core/save/offline-external-js","modified":"20250217171548320"},
185,187c181,183
< {"created":"20250217171046302","title":"$:/state/plugin-info--1428507752-$:/plugins/cdr/external-js---848723632","text":"usage","modified":"20250217171046303"},
< {"created":"20250217170345368","title":"$:/state/tab/moresidebar-1850697562","text":"$:/core/ui/MoreSideBar/Plugins","modified":"20250217171038619"},
< {"created":"20250217170343818","title":"$:/state/tab/sidebar--595412856","text":"$:/core/ui/SideBar/More","modified":"20250217171037136"},
---
> {"created":"20250217171424021","title":"$:/state/plugin-info--1428507752-$:/plugins/cdr/external-js---848723632","text":"usage","modified":"20250217171424021"},
> {"created":"20250217171419218","title":"$:/state/tab/moresidebar-1850697562","text":"$:/core/ui/MoreSideBar/Plugins","modified":"20250217171419218"},
> {"created":"20250217171417753","title":"$:/state/tab/sidebar--595412856","text":"$:/core/ui/SideBar/More","modified":"20250217171417753"},
189,191c185
< {"created":"20250217171043738","title":"$:/StoryList","text":"","list":"$:/plugins/cdr/external-js $:/config/SaveWikiButton/Template GettingStarted","modified":"20250217171158023"},
< {"title":"Untitled","text":"$:/plugins/cdr/external-js"},
< {"title":"Untitled 1","text":"$:/plugins/cdr/external-js"}
---
> {"title":"$:/StoryList","created":"20250217171421520","text":"","list":"$:/plugins/cdr/external-js GettingStarted","modified":"20250217171550754"}
196,197c190,191
< <script src="myplugins-5.3.5.js" onerror="alert('Error: Cannot load myplugins-5.3.5.js');"></script>
< <script src="tiddlywikicore-5.3.5.js" onerror="alert('Error: Cannot load tiddlywikicore-5.3.5.js');"></script>
---
> <script src="myplugins-5.3.6.js" onerror="alert('Error: Cannot load myplugins-5.3.6.js');"></script>
> <script src="tiddlywikicore-5.3.6.js" onerror="alert('Error: Cannot load tiddlywikicore-5.3.6.js');"></script>

You can think of both theme and core as plugins. Plugins are self-sufficient and don’t require html to work with them. Of course. Experiment before replacing files. Make sure there are no compatibility issues between plugins.

If you don’t have your own website to host which js files. Then you have to be honest and use empty.html to override the tiddlers as @pmario said.

Also. If it does cause problems. The solution to the problem is to override the tiddlers with empty.html as @pmario said.