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: [esinstall] outdated/wrong documentation? #3873

Open
1 task done
mindplay-dk opened this issue Feb 23, 2022 · 2 comments
Open
1 task done

🐛 BUG: [esinstall] outdated/wrong documentation? #3873

mindplay-dk opened this issue Feb 23, 2022 · 2 comments

Comments

@mindplay-dk
Copy link

mindplay-dk commented Feb 23, 2022

Quick checklist

  • I am using the latest version of Snowpack and all plugins. N/A

What package manager are you using?

npm

What operating system are you using?

Ubuntu 20 under WSL2

Describe the bug

I followed the directions for esinstall and it doesn't do what it says in the README.

import { install, printStats } from "esinstall";

(async () => {
  const result = await install(["preact", "htm"]);

  if (result.success) {
    printStats(result.stats);
  } else {
    console.error(JSON.stringify(result));
  }
})();

Output:

{"importMap":{"imports":{"htm":"./htm.js","preact":"./preact.js"}},"stats":{"direct":{"htm.js":{"size":1234,"gzip":662,"brotli":596},"preact.js":{"size":10043,"gzip":3992,"brotli":3674}},"common":{}}}

There is no success property in there?

(I don't know why we need to configure this with a build-script in the first place? Documentation is never a good substitute for something that actually emits an error message if you're using it wrong... Please consider adding a CLI front-end like we had in the old days with Pika? Installing an npm package as an ES module should be easy - no other project makes that easy since we lost Pika, and then again since the role of Snowpack completely changed from being essentially this... You had the simplest, most elegant solution to this... Please, consider making this simple again. 🙏)

Steps to reproduce

(see above)

Link to minimal reproducible example (optional)

No response

@mindplay-dk
Copy link
Author

Even this doesn't work:

import { install, printStats } from "esinstall";

(async () => {
  const result = await install(["preact", "htm"]);

  printStats(result.stats);
})();

printStats just doesn't do anything - although from the console output above, you can see the stats property is there.

19k weekly downloads tells me somebody is successfully using this tool, or at least trying to?

Is this package maintained and supported or is it defunct?

@mindplay-dk
Copy link
Author

Oh, okay, printStats doesn't actually print, heh... console.log(result.stats) and it works.

I'm going to guess the missing success flag has been replaced by a rejected Promise or something?

Looks like this is just a documentation issue.

(It would be really nice with a CLI front-end though - this really shouldn't be this hard.)

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

1 participant