sindresorhus / meow

🐈 CLI app helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong description output of cwd instead of library

franciscop opened this issue · comments

meow is outputting the description of the cwd's package.json, not of the CLI tool. I created check-licenses, which uses meow, and running it in a local project (let's call it "abc") outputs:

~/abc $ npx check-licenses --help

Abc description here      // <- Here is the problem

A simple tool to check all the licenses in your dependencies:
    $ npx check-licenses
    $ npx check-licenses --list

I believe the intended "description" here should be of the check-licenses package I created, not of the dev-package currently being active on the terminal. Is that assumption correct?

Meow fetches the description using import.meta, so it sounds like you're passing in the incorrect import.meta.

Thanks for the quick reply! That seems like a new option for ESM that I wasn't aware of (happy long term user of meow 😊). I just tried adding it and republish but still seems to get the wrong directory?

// https://github.com/franciscop/check-licenses/blob/master/index.js#L48
...`,
  {
    importMeta: import.meta,
    flags: { list: { type: "boolean", alias: "l", default: false } },
  }
);

I'm supposed to just pass it like this, right? Both the npx check-licenses and installing it and running it seem to still use the local project description instead of the library one.

Okay I forgot to upgrade meow, so the code I was seeing inside meow was different from my dependency. I noticed when I saw that there was no warning/error for me thrown even when I didn't provide importMeta in if (!(options.importMeta && options.importMeta.url)) {. Fixed, thanks!