dev env for plugin: reload browser on code changes ?

88 views
Skip to first unread message

Sebastian Ovide

unread,
Sep 19, 2019, 3:02:30 AM9/19/19
to TiddlyWikiDev
Hello

I've working on a plugin and not sure if is there a better way of dealing with the dev cycle. Here is what I do

1) change the code
2) build
3) run the server ("--listen") with ++myuplugin

everytime I change the code I need to do it all again. 

 "scripts": {
    "test""npm run build",
    "build""npm run build:prepare && npm run build:TW",
    "build:prepare""mkdir -p build/ && cp node_modules/tiddlywiki/editions/server/tiddlywiki.info build/ && node bin/updateVersion.js",
    "build:TW""tiddlywiki ++./plugin build --verbose --output build/gh-pages/ --build index",
    "serve""npm run build && (sleep 2 && open-cli http://127.0.0.1:8080 --background) && tiddlywiki ++./plugin build --verbose --listen"
  },

Is there a better way ? something that would build and refresh the browser if I change any code in the plug in? perhaps can tiddlywiki --listen  support some kind of file watcher ?

thanks

Jed Carty

unread,
Sep 19, 2019, 10:59:09 AM9/19/19
to TiddlyWikiDev
With Bob you can do something a bit simpler, but I don't know of anything that will automatically watch plugins.

In Bob you can unload a wiki and then when you reload it the plugins should be updated, so it is still multiple steps.

TonyM

unread,
Sep 19, 2019, 9:35:42 PM9/19/19
to TiddlyWikiDev
On single file wikis we have the tinka plugin packer.

Perhaps you could identify some methods to simplify your plugin builds at this software layer instead.

Be warned the packer removes the standard tiddlers as it packs.

Also I do not know what the ultimate impact on node plugin tiddlers are.

Regards
Tony

Sebastian Ovide

unread,
Sep 20, 2019, 3:31:28 AM9/20/19
to tiddly...@googlegroups.com

thanks both. 

I did some progress. Now I can run 

npm run serve


and it will open a browser, build. When there are changes, it will rebuild and restart the server. The only manual operation is to click reload in the browser.

  "scripts": {
   
"test": "npm run build",
   
"build": "npm run build:prepare && npm run build:TW",
   
"build:prepare": "mkdir -p build/ && cp node_modules/tiddlywiki/editions/server/tiddlywiki.info build/ && node bin/updateVersion.js",
   
"build:TW": "tiddlywiki ++./plugin build --verbose --output build/gh-pages/ --build index",

   
"serve:start": "npm run serve:stop && tiddlywiki ++./plugin build --verbose --listen || echo killed",
   
"serve:stop": "pkill -f \"node `which tiddlywiki`\" || echo nothing running",
   
"serve:open-browser-delayed": "sleep 2 && open-cli http://127.0.0.1:8080 --background &",
   
"serve:listen-changes": "chokidar \"plugin/**/*.tid\" \"plugin/**/*.js\" -c \"npm build && npm run serve:start\" --initial",
   
"serve": "npm run serve:open-browser-delayed && npm run serve:listen-changes"
 
},

Jeremy Ruston

unread,
Sep 20, 2019, 11:29:45 AM9/20/19
to tiddly...@googlegroups.com
Hi Sebastian

This is interesting. Is there are any chance you could write it up for others to follow? I note that the scripts reference bin/updateVersion.js which must be something new.

Best wishes

Jeremy

On 20 Sep 2019, at 08:31, Sebastian Ovide <sebasti...@gmail.com> wrote:

Enter code here...

-- 
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/658f8456-c107-4cf3-b935-2c0f1688c92d%40googlegroups.com.

Sebastian Ovide

unread,
Sep 23, 2019, 3:35:43 AM9/23/19
to TiddlyWikiDev
Hi Jeremy

the bin/updateVersion.js just use increase the patch part of the version if release (in travis) or the time stamp is built locally. The latest is helpful if dragging the file for updates but probably not useful anymore if using npm run serve


Cheers
Jeremy

To unsubscribe from this group and stop receiving emails from it, send an email to tiddly...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages