1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-04 23:39:57 +00:00
TiddlyWiki5/editions/dev/tiddlers/from tw5.com/Developing plugins using Node.js and GitHub.tid

119 lines
2.7 KiB
Plaintext
Raw Normal View History

created: 20140320055936611
2014-10-22 15:08:06 +00:00
modified: 20141022145259278
tags: howto
title: Developing plugins using Node.js and GitHub
type: text/vnd.tiddlywiki
2014-03-20 07:58:17 +00:00
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.
2014-10-22 15:08:06 +00:00
! Step by step
2014-10-22 15:08:06 +00:00
!! 1. Installation
2022-12-21 10:07:14 +00:00
First read https://tiddlywiki.com/static/PluginMechanism.html.
Install Git from http://git-scm.com/downloads
Install Node.js from http://nodejs.org/
2014-10-22 15:08:06 +00:00
!! 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.
2014-10-22 15:08:06 +00:00
!! 3. Setup a working environment
2014-10-22 15:08:06 +00:00
Choose a location in your file system (eg TW5) for your plugin project; issue commands to:
2014-10-22 15:08:06 +00:00
!!! 1. Create the directory
2014-11-28 10:06:17 +00:00
```bash
mkdir TW5
```
2014-10-22 15:08:06 +00:00
!!! 2. Make a local read-only copy of the ~TiddlyWiki5 repository
2014-11-28 10:06:17 +00:00
```bash
git clone https://github.com/Jermolene/TiddlyWiki5.git TW5
```
2014-10-22 15:08:06 +00:00
!!! 3. Make a directory for your plugin
2014-11-28 10:06:17 +00:00
```bash
cd TW5
cd plugins
mkdir yourname
cd yourname
mkdir pluginname
```
2014-10-22 15:08:06 +00:00
!!! 4. Make a local copy of your plugin repository
2014-11-28 10:06:17 +00:00
```bash
git clone https://github.com/yourgithub/pluginname.git pluginname
```
2014-10-22 15:08:06 +00:00
!!! 5. Go to your files
2014-11-28 10:06:17 +00:00
```bash
cd pluginname
```
Create the file plugin.info with content:
2014-11-28 10:06:17 +00:00
```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"
}
```
2014-10-22 15:08:06 +00:00
!! 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.
2014-10-22 15:08:06 +00:00
!!5. Build your files into a ~TiddlyWiki
2022-12-21 10:07:14 +00:00
Modify `editions/tw5.com/tiddlywiki.info` to include a reference to your plugin directory, i.e. find `"plugins": [ ` and add `"yourname/pluginname"`.
2014-10-17 15:29:27 +00:00
From the TW5 directory issue the command
2014-11-28 10:06:17 +00:00
```bash
2014-10-22 15:08:06 +00:00
node ./tiddlywiki.js editions/tw5.com --build index
```
2014-10-22 15:08:06 +00:00
The resultant file (index.html) will be placed in the `editions/tw5.com/output` directory of the TW5 repo.
2014-10-22 15:08:06 +00:00
!! 6. Save your work on ~GitHub
From `plugins/yourname/pluginname/` issue commands to:
2014-10-22 15:08:06 +00:00
!!! 1. Add all files
2014-11-28 10:06:17 +00:00
```bash
git add -A
```
2014-10-22 15:08:06 +00:00
!!! 2. Commit to your local repository
2014-11-28 10:06:17 +00:00
```bash
git commit -am "something meaningful about this check in"
```
2014-10-22 15:08:06 +00:00
!!! 3. Copy local changes to github
2014-11-28 10:06:17 +00:00
```bash
git push
```