Whenever a new release of TiddlyWiki comes out, I used to manually update each individual TW file (my editions), which was tedious and involved managing plugins, configurations, and other details. Below is a PowerShell script (PowerShell works on all major operating systems) that helps create new editions on the fly. Here are the steps:
- I have TiddlyWiki running on Node.js on Windows 11.
- I maintain an Editions folder containing customized TiddlyWiki folders (with plugins, themes, languages, and pre-configured settings) like Mehregan, Tirgan, XP, Krystal, Notebook, etc.
- I use TiddlyWiki on Node.js to generate index.html for each edition (e.g., single-file TiddlyWiki).
- I store them in two global folders, one on a thumb drive and another on the computer drive.
- I use a small PowerShell script to quickly create copies of any version wherever needed.
Below is the PowerShell script to create single-file editions in both compressed and normal sizes.
<#
.SYNOPSIS
Builds standalone (single .html) TiddlyWiki editions.
.DESCRIPTION
This script generates both normal and minified (.html) versions of multiple
customized TiddlyWiki editions stored in:
D:/TiddlyWiki/Editions
The output files are built in:
D:/TiddlyWiki/S-Editions
After building, each edition folder is mirrored to:
C:/TW/000. Empty/S-Editions/<version>
G:/TW/000. Empty/S-Editions/<version>
Editions and their subfolders are defined in the `$editions` array
inside the script — making it easy to add, remove, or rename editions.
.EXAMPLE
tw-make-single-editions
Builds all editions listed in `$editions` (normal + minified) and copies them
to the target folders on C: and G: drives.
.NOTES
Author: Mohammad Rahmani
Revision History:
1.0 - 2022-12-12 : Initial release
1.1 - 2022-12-25 : General improvements
1.2 - 2022-12-28 : Remove Uglify plugin after compression
1.3 - 2023-04-21 : Script moved to C:/MyScripts; restore path after run
1.4 - 2025-07-05 : Added 'Course' edition
2.0 - 2025-08-12 : Refactored with arrays & loops for easier maintenance (with the help of GPT-5)
#>
Clear-Host
Write-Host "`nStart making TiddlyWiki single file editions`n"
$startTime = Get-Date
Write-Host "The script was started at $startTime"
# Paths
$currentPath = Get-Location
$editionPath = "D:\TiddlyWiki\Editions"
$buildPath = "D:\TiddlyWiki\S-Editions"
# List of editions and their subfolders (empty string means the root edition)
$editions = @(
@{ Name = "Vanilla TiddlyWiki"; Paths = @("vanilla", "vanilla/minified") },
@{ Name = "Basic TiddlyWiki"; Paths = @("basic", "basic/minified") },
@{ Name = "Mehregan (Zettelkasten)"; Paths = @("mehregan", "mehregan/minified") },
@{ Name = "Tirgan (Scientific)"; Paths = @("tirgan", "tirgan/minified", "tirgan/course") },
@{ Name = "Notebook TiddlyWiki"; Paths = @("notebook", "notebook/minified") },
@{ Name = "TiddlyWiki xp"; Paths = @("xp", "xp/minified") },
@{ Name = "TiddlyWiki Krystal"; Paths = @("krystal", "krystal/minified") }
)
# Change to S-Editions build folder
Set-Location -Path $buildPath
# Build all editions
foreach ($edition in $editions) {
Write-Host "`n--- Making $($edition.Name)" -ForegroundColor Yellow
foreach ($path in $edition.Paths) {
tiddlywiki "$editionPath/$path" --build index
}
}
# Version and paths
$version = tiddlywiki --version
$targetPaths = @(
"C:\TW\000. Empty\S-Editions\$version",
"G:\TW\000. Empty\S-Editions\$version"
)
# Delete target folders if they exist
foreach ($target in $targetPaths) {
Remove-Item -Force -Recurse $target -ErrorAction Ignore
}
# Copy new builds to targets
foreach ($target in $targetPaths) {
robocopy "$buildPath\$version" $target /MIR
}
# Return to original path
Set-Location -Path $currentPath
# Timing info
$endTime = Get-Date
$timeElapsedS = ($endTime - $startTime).TotalSeconds
Write-Host "`nThe script finished at $endTime."
Write-Host "Elapsed time in seconds: $timeElapsedS`n" -ForegroundColor Cyan