adbayb / termost

📦 A framework to build your next CLI application: Get the most of your terminal 🚀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: "unable to retrieve automatically the package name and version"

selfagency opened this issue · comments

Description

Getting the error:

error: Termost was unable to retrieve automatically the package name and version. To fix it, use `termost({ name, description, version })` to define them manually.
      at I (/$bunfs/root/exporter:21735:11)
      at Z (/$bunfs/root/exporter:21704:47)
      at /$bunfs/root/exporter:22507:15

But when I try to do that I get a TypeScript error and the same error above regardless:

CleanShot 2024-02-24 at 16 32 14@2x

Reproduction

Gist

Environment

Bun 1.0.28
Node 18.17.1

@selfagency Your package metadata (including name, description, and version) needs to be put in the first argument.
The second argument is for callbacks 👍 .
The following change should work:

const program = termost<ProgramContext>(
	{
		name: "wpconv",
		description: "WordPress data converter",
		version: "0.0.1",
	},
	{
		onException(error) {
			log.error(error);
		},
		onShutdown() {
			log.info("Fin.");
		},
	},
);

Can you confirm it?

Closed since not reproducible.
@selfagency Feel free to re-open it if needed.