1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-16 14:54:51 +00:00
TiddlyWiki5/editions/dev/tiddlers/from tw5.com/Developing plugins using Node.js and GitHub.tid
2017-11-11 11:56:20 +00:00

119 lines
2.7 KiB
Plaintext

created: 20140320055936611
modified: 20141022145259278
tags: howto
title: Developing plugins using Node.js and GitHub
type: text/vnd.tiddlywiki
The most practical way to develop plugins is to use Node.js with the tiddlywiki5 repository to build your plugins, and to use ~GitHub to manage you files.
! Step by step
!! 1. Installation
First read https://tiddlywiki.com/static/PluginMechanism.html.
Install Git from http://git-scm.com/downloads
Install Node.js from http://nodejs.org/
!! 2. Create a new blank repository on ~GitHub
Hint: ~GitHub repositories cannot be grouped together into directories, so it is only possible to group by using a naming scheme, e.g. use 'TW5-' as a name prefix with tiddlywiki5 projects to group them together.
Go to https://github.com/ and create new a repository 'pluginname' - choose to add a readme file.
!! 3. Setup a working environment
Choose a location in your file system (eg TW5) for your plugin project; issue commands to:
!!! 1. Create the directory
```bash
mkdir TW5
```
!!! 2. Make a local read-only copy of the ~TiddlyWiki5 repository
```bash
git clone https://github.com/Jermolene/TiddlyWiki5.git TW5
```
!!! 3. Make a directory for your plugin
```bash
cd TW5
cd plugins
mkdir yourname
cd yourname
mkdir pluginname
```
!!! 4. Make a local copy of your plugin repository
```bash
git clone https://github.com/yourgithub/pluginname.git pluginname
```
!!! 5. Go to your files
```bash
cd pluginname
```
Create the file plugin.info with content:
```js
{
"title": "$:/plugins/yourgithub/pluginname",
"description": "summary of the plugin's purpose",
"author": "yourname",
"version": "0.0.1",
"core-version": ">=5.0.8",
"source": "https://github.com/yourgithub/pluginname",
"plugin-type": "plugin"
}
```
!! 4. Create the files for your plugin
For example files see the plugins in the ~TiddlyWiki5 repository i.e. those located at plugins/tiddlywiki/. See [[TiddlerFiles|https://tiddlywiki.com/#TiddlerFiles]] for details of the supported tiddler file formats.
!!5. Build your files into a ~TiddlyWiki
Modify `editions/tw5.com/tiddlywiki.info` to include a reference to your plugin directory, i.e. find `"plugins": [ ` and add `"yourname/pluginname"`.
From the TW5 directory issue the command
```bash
node ./tiddlywiki.js editions/tw5.com --build index
```
The resultant file (index.html) will be placed in the `editions/tw5.com/output` directory of the TW5 repo.
!! 6. Save your work on ~GitHub
From `plugins/yourname/pluginname/` issue commands to:
!!! 1. Add all files
```bash
git add -A
```
!!! 2. Commit to your local repository
```bash
git commit -am "something meaningful about this check in"
```
!!! 3. Copy local changes to github
```bash
git push
```