Trying to modify the Projectify plugin on node.js with TW 5.3.0-prerelease

Hello,

I’m trying to modify the Projectify plugin on node.js with TW 5.3.0-prerelease but I’m stuck. I already upgraded my TW on node.js to 5.3.0-prerelease (it works fine).

But apparently this Projectify plugin uses a special (?) mechanism which requires cross-env, and I suspect that this is what causes the issue:

Below using the original code, running from the root directory. If I use the regular way to start TW on node.js:

tiddlywiki --verbose . --listen

gives

Warning: Cannot find plugin 'nico/projectify'
Warning: missing plugin.info file in /home/erwan/tmp/Projectify/plugins/nico

The resulting wiki does not contain any of the plugin tiddlers.

If I use the method apparently recommended in the instructions for the plugin (after installing cross-env with npm):

npm run serve

In this case the demo and plugin work perfectly, but it’s running TW 5.2.7 instead of 5.3.0-prerelease as I want.

I’m not knowledgeable at all about node.js, so it’s possible that I misunderstand things… Is there a way to either make this work with cross-env (maybe some config file to modify?) or get rid of cross-env in order to do a regular plugin? Any other advice?

When you use npm run serve it will use the tiddlywiki npm package which is probably local to your projectify directory. This local tiddlywiki would have come from npm install and it uses the latest version from npm. The pre-release is not released to npm yet.

One thing you can try is to change this line:

to

"tiddlywiki": "github:Jermolene/TiddlyWiki5"

and then run npm update. This should update the projectify local npm tiddlywiki package to latest master branch (which is the prerelease). Then the npm run serve should use the new tiddlywiki.

There are many thing which could make my advice wrong…depending what your setup is like, but hopefully it helps.

1 Like

Thank you so much @btheado , it works perfectly like this!

Thanks for the clear explanations too, it really helps me :slight_smile:

If I may ask: this is not the standard way TW plugins usually work, is it? if not, do you know why Projectify require this particular environment?

It’s actually a pretty common setup for TW plugin git repositories. The advantage to this structure is how self-contained it is. You just need nodejs and npm installed. Then once you git clone you just need the npm install; npm run <some run script from package.json> and you automatically get tiddlywiki pulled in from npm.

One advantage this git structure has is the ability to run node js directly in your browser and sharing the result with a simple url. See this discussion with several example stackblitz links:

Those links are all possible because the repository is structure in the same way as you see in Projectify.

And here is a link which works to run this Projectify repository via nodejs in the browser: https://stackblitz.com/github/NicolasPetton/Projectify?startScript=serve-demo

1 Like

Ok I see. Thank you for clarifying things, this helps a lot!