mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-08 19:09:57 +00:00
5aa3646df5
* Initial Commit * Fix plugin library URL * Need to set plugin library location for prerelease * Styling tweaks * Docs * Add tests that the core plugins all have a valid stability field
46 lines
1010 B
JavaScript
46 lines
1010 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"
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true, browser: true */
|
|
/*global $tw: false */
|
|
"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": JSON.stringify({tiddlers: tiddlers})
|
|
};
|
|
wiki.addTiddler(new $tw.Tiddler(pluginFields));
|
|
return null;
|
|
};
|
|
|
|
exports.Command = Command;
|
|
|
|
})();
|