TW plugin workflow

134 views
Skip to first unread message

Alain Dutech

unread,
Feb 22, 2016, 3:06:08 PM2/22/16
to TiddlyWikiDev
Hi everyone,

this must be a very naive question, but I feel like my JS plugins development workflow is far from optimal and I would like some advice.

So, how do I develop (on my Linux)

1) I have a twsomething.html with my javascript tiddler (say myplug.js) in it.
2) myplug.js is also a file in my directory.
3) I edit myplug.js, say with emacs. When I feel it is "ready", I copy in (manually) in my tiddler.
4) I reload my twsometing.html file in my browser
4.1) if no error, I do small adkustment directly in the tiddler. When fine, I copy back to my myplug.js file.
4.2) if error => big red popup window in browser, I do my best to correct it directly in the browser, but most often the big red window is too large and cannot bi clicked away. So it is a bit painfull...
5) go back to 3)
6) eventually, pack my plugin as explained in http://tiddlywiki.com/dev/#Developing%20plugins%20using%20Node.js%20and%20GitHub

So I'm pretty sure there is a better way, but as I am not experienced at all with javascript/tw5, I can not find a better way of doing things.

How are you doing things ?

Thanks,
Snow/Alain

Tobias Beer

unread,
Feb 22, 2016, 3:46:28 PM2/22/16
to TiddlyWikiDev
Hi Alain,
 
How are you doing things ?

I strongly suggest you try to get the gist of working with node.js and serving wiki folders,
while setting up your own plugin folder.
In fact, these days I actually have a "plugins" folder in which I symlink all my plugin repositories.
That way, I can add new plugins to my heart's content
while my TIDDLYWIKI_PLUGIN_PATH environment variable remains untouched.

I have some keyboard shortcuts that have me paste the right commands in the commandline, e.g. "tiddlywiki --server",
which stays open while I develop, so I constantly switch between browser, editor, and commandline (hitting CTRL-C, twice, up arrow, enter).
If you want to go crazy, you can even have gulp watch for file-changes and then restart the server automagically.

Best wishes,

Tobias. 

BJ

unread,
Feb 23, 2016, 9:31:57 AM2/23/16
to tiddly...@googlegroups.com
Hi Snow,
I wrote those instructions on tiddlywiki.com/dev for developing plugins. If you have followed those instructions and created a github repository then you are nearly following my work flow. The way I work is to edit my source files and then rebuld my tiddlywiki using nodejs. This is the most efficient way to work. I use a couple of batch files to automate the process.

I have a 'template' project that I use to create other projects with. You can clone it and give it a try. These are the instructions

open a bash shell and go to the root of your copy of the  tiddlywiki repository (that is on your computer)

then type:

 cd plugins
 mkdir bj
 cd bj
 git clone https://github.com/buggyj/TW5-nulleditor
 cd TW5-nulleditor/build/
./bld.sh

the result is a new 'test' tiddlywiki html file located in build/browser/output that contains the plugin

I have another batch file edit.sh that I use to create permanent tiddlers for testing

all the best
BJ

BJ

unread,
Feb 23, 2016, 9:40:28 AM2/23/16
to TiddlyWikiDev
If you follow this method DO NOT create tiddlers for testing in the standalone (made using ./bld.sh) version of your test tiddlywiki. This file is rebuilt each time the command is run. Use the ./edit.sh for adding test tiddlers.


On Tuesday, February 23, 2016 at 2:31:57 PM UTC, BJ wrote:
Hi Snow,
I wrote those instructions on tiddlywiki.com/dev for developing plugins. If you have followed those instruction and created a github repository then you are nearly follow my work flow. The way I work is to edit my source files and then rebuld my tiddlywiki using nodejs. This is the most efficient way to work. I use a couple of batch files to automate the process.


I have a 'template' project that I use to create other projects with. You can clone it and give it a try. These are the instructions

open a bash shell and go to the root of you copy of the  tiddlywiki repository (that is on your computer)

Alain Dutech

unread,
Feb 23, 2016, 12:12:53 PM2/23/16
to tiddly...@googlegroups.com
Thanks for pointing up the power nodejs + tiddlywiki. It really open my perspectives :o)

So, I've experimented with nodejs as explained in
http://tiddlywiki.com/#Installing%20TiddlyWiki%20on%20Node.js

And everything is great while using the "server" edition.

But I'd like to do that with "my" edit-comptextdemo edition. And I have a problem
0) say tiddlywiki is installed by npm in $TWHOME
1) I have my gitub plugin TW5-edit-comptext cloned in rep $TWHOME/plugins/snowgoon88/edit-comptext. Let name it $MYPLUGIN
2) I set up a link in $TWHOME/editions to $MYPLUGIN/edit-comptextdemo
3) but, when I try `nodejs tiddlywiki.js dev_edit --init edit-comptextdemo`
in $TWHOME I have an error that does not append if I try to init something with, for, example
nodejs tiddlywiki.js dev_edit --init server

ERROR :
Copied edition 'edit-comptextdemo' to dev_edit

fs.js:432
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory 'dev_edit/tiddlywiki.info'
    at Object.fs.openSync (fs.js:432:18)
    at Object.fs.readFileSync (fs.js:286:15)
    at Command.execute ($:/core/modules/commands/init.js:51:31)
    at Commander.executeNextCommand ($:/core/modules/commander.js:82:14)
    at Commander.execute ($:/core/modules/commander.js:46:7)
    at Object.exports.startup ($:/core/modules/startup/commands.js:34:12)
    at $tw.boot.executeNextStartupTask (/home/dutech/Projets/node_modules/tiddlywiki/boot/boot.js:1945:10)
    at $tw.boot.executeNextStartupTask (/home/dutech/Projets/node_modules/tiddlywiki/boot/boot.js:1943:21)
    at $tw.boot.executeNextStartupTask (/home/dutech/Projets/node_modules/tiddlywiki/boot/boot.js:1943:21)
    at $tw.boot.executeNextStartupTask (/home/dutech/Projets/node_modules/tiddlywiki/boot/boot.js:1943:21)

Someone can tell me what is happening ??

Thanks a lot,
Alain

For info,
** the following command works fine
nodejs ./tiddlywiki.js editions/edit-comptextdemo --build index

** File editions/edit-comptextdemo/tiddlywiki.info is
{nodejs ./tiddlywiki.js editions/edit-comptextdemo --build index
        "description": "Demo of the Edit-Comptext plugin",
        "plugins": [
                "snowgoon88/edit-comptext"
        ],
        "themes": [
                "tiddlywiki/vanilla",
                "tiddlywiki/snowwhite"
        ],
        "includeWikis": [
        ],
        "build": {
                "index": [
                        "--rendertiddler","$:/core/save/all","edit-comptextdemo.html","text/plain"]
        }
}

** And rep editions/edit-comptextdemo has
> editions/edit-comptextdemo
├── output
│   └── edit-comptextdemo.html
├── tiddlers
│   ├── About.tid
│   ├── $__config_EditorTypeMappings_text_vnd.tiddlywiki.tid
│   ├── DefaultTiddlers.tid
│   ├── hisFive.tid
│   ├── hisFor.tid
│   ├── hisOne.tid
│   ├── hisThree.tid
│   ├── hisTwo.tid
│   ├── myOne.tid
│   ├── myTwo.tid
│   ├── SiteSubtitle.tid
│   ├── SiteTitle.tid
│   └── Under the hood.tid
└── tiddlywiki.info

and
** plugins/snowgoon88/edit-comptext
├── edit-comptextdemo
│   ├── output
│   │   └── edit-comptextdemo.html
│   ├── tiddlers
│   │   ├── About.tid
│   │   ├── $__config_EditorTypeMappings_text_vnd.tiddlywiki.tid
│   │   ├── DefaultTiddlers.tid
│   │   ├── hisFive.tid
│   │   ├── hisFor.tid
│   │   ├── hisOne.tid
│   │   ├── hisThree.tid
│   │   ├── hisTwo.tid
│   │   ├── myOne.tid
│   │   ├── myTwo.tid
│   │   ├── SiteSubtitle.tid
│   │   ├── SiteTitle.tid
│   │   └── Under the hood.tid
│   └── tiddlywiki.info
├── edit-comptext.js
├── files
│   ├── cursor-position.js
│   └── tiddlywiki.files
├── plugin.info
├── README.md
├── readme.tid





--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/m2Pquqr8qX8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/af479d5c-880e-45ca-99cb-d04e0039a785%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

BJ

unread,
Feb 23, 2016, 1:32:56 PM2/23/16
to TiddlyWikiDev
I don't why it does not work, but I would say developing plugins is easier using a cloned tiddlywiki repository. Often when developing plugins I need to put debug into the core, and this is made easier if you can branch the tiddlywiki repository to have multiple version with different mods. Also you can test your plugin against different version of tiddlywiki by checkout different tags.

From your project tree I think you will have a (different) problem in that tiddlywiki (I think) will include your tiddlers in the dir edit-comptextdemo into your plugin. I use a tiddlywiki.files to tell tiddlywiki to ignore files in a subdir.

Tobias Beer

unread,
Feb 24, 2016, 3:21:24 AM2/24/16
to TiddlyWikiDev
Hi Alain,

But I'd like to do that with "my" edit-comptextdemo edition. And I have a problem

For TiddlyWiki to pick up your edit-comptextdemo edition,
add it to your  TIDDLYWIKI_EDITION_PATH environment variable.

Best wishes,

Tobias.

Alain Dutech

unread,
Feb 24, 2016, 5:01:04 AM2/24/16
to tiddly...@googlegroups.com
Ok, I have it working.

The problem was that I had a symlink from '$TWHOME/edition/myplugin-dev` to my 'git-cloned-rep/edition/myplugin-dev' and this does not work if it is a symlink (but don't know why...)
 - I tried by copying the rep instead of using a symlink : it works
 - I tried setting TIDDLYWIKI_EDITION_PATH : it works.

so I'm now using TIDDLYWIKI_EDITION_PATH...

Thanks everybody, I'll be able to be more productive (I hope).

Alain


--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/m2Pquqr8qX8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
Reply all
Reply to author
Forward
0 new messages