Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] "tiddlywiki invalid-path --listen" does start a server - IMO it should not #8542

Closed
pmario opened this issue Aug 21, 2024 · 7 comments
Closed

Comments

@pmario
Copy link
Member

pmario commented Aug 21, 2024

If I run tiddlywiki invalid-path --listen, it does still start a server - IMO it should not

This issue is related to: Add some new scripts to package.json, to make npm run command easier #8294

Proposal

It should produce "Error" instead of "Warning" -- and stop

PS E:\git\tiddly\tiddlywiki\TiddlyWiki5> npm run edition:lazy

> [email protected] preedition:lazy
> npm run edition:lazy:info -s

"use: npm run edition:lazy --edition=tw5.com [de-AT, es-ES, fr-FR, ko-KR, xlsx-utils]"

> [email protected] edition:lazy
> node ./tiddlywiki.js ./editions/%npm_config_edition%-server --listen root-tiddler=$:/core/save/lazy-all

Warning: Wiki folder './editions/%npm_config_edition%-server' does not exist or is missing a tiddlywiki.info file
PS E:\git\tiddly\tiddlywiki\TiddlyWiki5>

Command to replicate the problem

node ./tiddlywiki.js ./editions/%npm_config_edition%-server --listen root-tiddler=$:/core/save/lazy-all

It prints this info:

Warning: Wiki folder './editions/%npm_config_edition%-server' does not exist or is missing a tiddlywiki.info file
Warning: Plugin(s) required for client-server operation are missing.
"$:/plugins/tiddlywiki/filesystem", "$:/plugins/tiddlywiki/tiddlyweb"
Serving on http://127.0.0.1:8080
(press ctrl-C to exit)

So it knows, that it will not work. But it still runs a server that will create this:

image

@pmario
Copy link
Member Author

pmario commented Aug 21, 2024

@linonetwo @saqimtiaz -- Can you imagine a configuration, where it would make sense to run a server with an invalid path name?

@Jermolene
Copy link
Member

@linonetwo @saqimtiaz -- Can you imagine a configuration, where it would make sense to run a server with an invalid path name?

The canonical example of using an invalid pathname is when initialising a new wiki:

tiddlywiki ./MyWikiFolder --init empty

@pmario
Copy link
Member Author

pmario commented Aug 21, 2024

The canonical example of using an invalid pathname is when initialising a new wiki:

tiddlywiki ./MyWikiFolder --init empty

Yes, but that does not touch the code of the --listen command. The important thing here is --listen

@Jermolene
Copy link
Member

Hi @pmario so you are suggesting that the --listen command should check for a valid wiki folder and raise an error if there isn't one.

That's not right. TiddlyWiki can be run without a wiki folder. For example:

tiddlywiki --load <somedata> --listen

It is not necessary for there to be a wiki folder in order for TiddlyWiki to function correctly.

@pmario
Copy link
Member Author

pmario commented Aug 21, 2024

OK. --load is an argument. But if you use tiddlywiki invalid-path --listen there is still a problem

image

@Jermolene
Copy link
Member

Hi @pmario the "problem" here is just that there is no theme plugin loaded. If we think that that is confusing then perhaps a better approach would be to make the core display a warning banner if there is no theme plugin loaded. I think that could be done in wikitext as a page template segment.

@linonetwo
Copy link
Contributor

I don't use cli, I only call its JS api, so I have no opinion here.

@pmario pmario closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants