envinfo icon indicating copy to clipboard operation
envinfo copied to clipboard

Envinfo config file

Open ryhinchey opened this issue 4 years ago • 7 comments

This PR adds support for an envinfo.js configuration file. Based on the discussion here https://github.com/tabrindle/envinfo/issues/158.

Some notes on the design considerations from @tabrindle:

size. envinfo is frequently used via npx, so I want to preserve small size for speed of download

  • the implementation doesn't add enough code to make a material impact on the package's size IMO

the file having a consistent name and extension. (extensionless dotfiles bother me)

  • the only supported file is envinfo.js

ability to use a remote config file (fetched via http, possibly a future feature)

  • you can use Promises in the envinfo.js file. See the tests added as part of this PR

the contents of the config file being similar or identical to config passed inline when using the library directly in js

  • they're identical

somehow declaring compatible versions of config vs versions of envinfo

  • I didn't touch on this and am not entirely sure what this would entail but I'd be happy to take a stab at it as part of this PR or a future one

ryhinchey avatar Jun 05 '20 20:06 ryhinchey

This is awesome - I'll take a deeper look at it tomorrow, but as of now, my only suggestion is that we use the more conventional naming of envinfo.config.js

webpack and babel both do it this way, and I think that's probably a bandwagon we should jump on.

tabrindle avatar Jun 15 '20 00:06 tabrindle

Are we reasonably confident with the state of this PR? I think it's good to go. We can iterate as we get adoption.

tabrindle avatar Jul 28 '20 13:07 tabrindle

Are we reasonably confident with the state of this PR? I think it's good to go. We can iterate as we get adoption.

@tabrindle yah I think so. I've been pretty busy lately but I did change the name of the file to envinfo.config.js. I'd like to land this with some docs which I can get to this week.

ryhinchey avatar Jul 29 '20 01:07 ryhinchey

How would the API for libraries look like? It seems to me that this PR would add support for an envinfo.config.js in the user repository. But that wouldn't be helpful since the library wants to control what environment information it needs.

I was about to file PRs for testing-library and Material-UI presets since I find this package incredibly helpful. Though I'm not sure if PRs for presets should be preferred or waiting for this feature.

eps1lon avatar Dec 07 '20 14:12 eps1lon

How would the API for libraries look like? It seems to me that this PR would add support for an envinfo.config.js in the user repository. But that wouldn't be helpful since the library wants to control what environment information it needs.

I was about to file PRs for testing-library and Material-UI presets since I find this package incredibly helpful. Though I'm not sure if PRs for presets should be preferred or waiting for this feature.

sorry for the delay here. The goal of this PR is to come up with a way to avoid teams having to submit PRs for presets.

Maybe we should support being able to pass a --config flag to the envinfo command. Something like npx envinfo --config @testing-library/react that would tell envinfo to look for a config at the root of the @testing-library/react package within node_modules

@tabrindle thoughts on this approach?

ryhinchey avatar Feb 12 '21 05:02 ryhinchey

@tabrindle thoughts on https://github.com/tabrindle/envinfo/pull/176#issuecomment-777983932?

ryhinchey avatar Mar 18 '21 19:03 ryhinchey

Yes, I think this approach would work. Would this need to be a separate feature/PR? I think this one is mostly complete for the original intentions.

tabrindle avatar Dec 07 '21 14:12 tabrindle