TiddlyWiki5/core-server/commands/makelibrary.js
Arlen Beiler fdaf9f6d92 add preloadHooks and data tiddler serializer and isPlugin support
- trying to find as many uses of plugins as I can
2025-10-11 22:51:33 +00:00

40 lines
964 B
JavaScript

/*\
title: $:/core/modules/commands/makelibrary.js
type: application/javascript
module-type: command
Command to pack all of the plugins in the library into a plugin tiddler of type "library"
\*/
"use strict";
exports.info = {
name: "makelibrary",
synchronous: true
};
var UPGRADE_LIBRARY_TITLE = "$:/UpgradeLibrary";
var Command = function(params,commander,callback) {
this.params = params;
this.commander = commander;
this.callback = callback;
};
Command.prototype.execute = function() {
var wiki = this.commander.wiki,
upgradeLibraryTitle = this.params[0] || UPGRADE_LIBRARY_TITLE,
tiddlers = $tw.utils.getAllPlugins();
// Save the upgrade library tiddler
var pluginFields = {
title: upgradeLibraryTitle,
type: "application/json",
"plugin-type": "library",
"text": $tw.utils.stringifyDataTiddler("application/json",{tiddlers: tiddlers})
};
wiki.addTiddler(new $tw.Tiddler(pluginFields));
return null;
};
exports.Command = Command;