Closed jesstelford closed 8 years ago
I tried writing some tests, but I can't figure out how to get mocha to play nice with environment variables. It seems like no matter how many times I delete process.env.NO_WRITE_FS
, it seems to stick around and everything else blows up :/
Any ideas? Some Google-based research didn't turn up much.
Hi! I'm not sure, but I don't really like to use env variable here. Instead of using it you could just require html-to-react-components/lib/processor
and use provided transformation function. Writing is done only in html-to-react-components/lib/index
, you don't have to use it.
@jesstelford Have you tried what I wrote in the last comment? Did it work for you?
Yeah, I definitely could reach into html-to-react-components/lib/processor
, but is just feels a bit dirty to me; circumventing node's require algorithm.
It's probably not likely, but if you were to rearrange the files / refactor some functions internally, and do a minor or patch semver version bump, then any project which depends on html-to-react-components/lib/processor
would stop working on the next install due to the default npm versioning using ^
.
Is there a particular case in mind that you don't like environment variables for?
I don't want to add specific features like this. But, I think it would be really good to have this tool working in the browser.
Do you expect more PRs or browser support?
Enables smaller browserify builds when combined with envify and uglifyify.
For example, with an invocation such as:
Will conditionally exclude all the write to fs files (including the node
fs
module which doesn't work in the browser anyway.note: The changeset is much better viewed with whitespace differences turned off: https://github.com/roman01la/html-to-react-components/pull/8/files?w=0 (due to indentation of a function)