-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: improve test command, support dotenv files, add postcss #52
Conversation
Deploy preview for dhis2-app-platform ready! Built with commit 1e1efbe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement. 👍
Looks good all-in-all. Very nice getting bundle analysis built-in. 🔬
I'm a bit way about misuse of .env
files, though that is up to the consumer. The 12-factor app principles don't always apply to us, nor should they, though some of the points are general enough to apply where we think they make sense.
I believe the configuration parts is one such area: https://12factor.net/config
The dotenv
authors discuss it a bit in their FAQ as well: https://github.com/motdotla/dotenv#faq
Having .env.development
, .env.test
, env.development.local
etc. is an anti-pattern, and not something I want us to endorse.
I think I agree here - it's a tradeoff, though, since I'm onboard with removing at least the per-environment env files, but would be curious what the "right" way to implement environment defaults/overrides should be in the platform - I know we'll be getting rid of this use of source-local HTTP requests soon, so we could omit the @varl what do you envision - no support for dotenv or support for only one dotenv (possibly with |
We need to think a bit about it. For instance, what is an environment? My computer for example is a development environment, and therefore it should not be allowed to act as a production environment. Generally I think that a CRA does not use the environment files for environments in the strictest sense, it uses it for configuration for different modes for the intended environment, which solves the problems above in exchange for a bit of a mess of files in the app repo. Anyway, pardon me for bringing up this topic in this PR. I think this is good for now. |
@varl it's a very fair point since this adds support for |
The advantage of allowing multiple mode-targeted |
(p.s. thanks for the feedback!) |
I thought about that too, and to be pragmatic about it; In the end, having support for it doesn't mean we have to use it, so we can safely leave it in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left one comment in the code that I think needs to be addressed before this is merged.
Nice. I personally like using this to have a standard way to point to a dhis2 backend. I don't like the approach we used before with the dhis2 config that lives outside of the repo, on your system somewhere. The .env files make way more sense to me. |
@HendrikThePendric removed the offending file, thanks for catching that - should be good to go now! |
I'd really like to get this in - @HendrikThePendric I think your request has been addressed, let me know ASAP if it hasn't, otherwise I'd like to merge this first-thing tomorrow! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks all for the feedback! |
# [1.4.0](v1.3.1...v1.4.0) (2019-09-24) ### Features * improve test command, support dotenv files, add postcss ([#52](#52)) ([210c9cc](210c9cc))
🎉 This PR is included in version 1.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This is an upgrade to the test command which adds support for jest config overrides, provides nice testing defaults, and adds support for
--updateSnapshot
,--coverage
, and--watch
to thetest
command.This also adds support for specifying environment variables in
.env
files (including.env.local
,.env.<mode>[.local]
(mode == production, development, or test), for all three build/test/start commandsThis does modify the behavior of the compiler somewhat - we now only bundle apps into a single file, not libs (this might change again in the future). We also only support
CJS
module loading (for now) because of an issue with CJS named exports in static dependendency resolution (see the code comment and the rollup issue)This also adds support for
postcss
so that we can more easily port CRA apps to the platform. It supportsimport 'my.css'
for global styles, as well asimport styles from 'my.module.css'
for CSS module support (filenames must have the extension.module.css
)Finally, I've patched up a few small issues in the shell, such as an omitted typeface-robotto and including more favicon variants
These changes were influenced by the effort to port Usage Analytics to the platform, see dhis2/usage-analytics-app#94