-
Notifications
You must be signed in to change notification settings - Fork 8
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
use eject from create React app to allow more robust dev and production build configs #66
Comments
A PR is welcomed sure, to outline the changes. It may be a good point for discussion of the approach and its tradeoffs. An earlier concern I had (although might have been incorrect) is that CRA focuses mainly on projects that are building single page web applications, not libraries. Going off the README here: https://github.com/facebook/create-react-app#popular-alternatives
While I think Mirador hits many of these checkboxes, I wouldn't consider it adhering to a traditional single page application. Another reason for the "start from scratch approach" was to make sure that we had broad understanding of the various parts of our webpack config and project setup. All that being said, enhancements to the project structure are most welcome! I just wanted to provide a bit of context of how we got here and some of the original concerns with CRA. |
closes ProjectMirador#66 adds ejected create react app configuration to app moves tests to subdirectories of components linting changes closes ProjectMirador#68 handles prop updates in Window replaces binds with arrow functions excludes console in eslint adds build to .gitignore adds lerna.json
this issue and PR is linked to the history branch which is now 8 commits ahead of master. As such, it probably cannot be merged as is. I can cherry pick any commit (or whatever) into another branch and PR at your discretion. Just let me know how / if we can move forward and if I should close this PR. If it helps, I can create some documentation / diagrams to illustrate how I think that this structure will work as the code base grows. There are a couple of issues beyond the somewhat radical restructuring that I believe are good practices, but are opinionated. For example, using the .jsx extension for React Components. I also think that named exports are preferable to default in pure ES6. (ref. "tree shaking"). With The e2e test package can now build from imported apps. The CI may seem a bit complex, but this is due to the monorepo. e2e tests are usually run against published packages and not against build artifacts, but building lib apps from the monorepo on demand is an option. Cypress has a video record feature that is useful. For reference, here is the latest build log. |
Ok, so looking at this and based off of our conversations in Edinburgh, I see the smoothest way forward to get these pieces in, and also provide shared understanding to the entire team as this:
As I briefly mentioned, I several common things that we would do in modern front end applications may not apply in this repo (chunking, service worker, etc) but we don't want to preclude Mirador adopters from doing any of this.
Thanks for all of your hard work on this @christopher-johnson . I'm also happy to hop on a pairing session to see if we can knock one of these out together. |
I see the path forward and will definitely work with you on this. I would start by adding the webpack build to create the lib package as this is a necessity for people who want to import a basic app from npm. btw, today I have integrated the proof of concept into a React CMS ( an spa that uses This was actually not so easy as there is an issue with This kind of external integration also highlighted the question of inline vs. bundled styling. Not sure what the optimal solution is, but the bundled default styles do not work in an external container. |
Yep looks like react-redux introduces a breaking API change: https://github.com/reduxjs/react-redux/releases/tag/v6.0.0
Mirador already has an npm package which we will release as part of the package once we port the POC code into the main repo. We will of course make sure to release on npm in the appropriate ways. Installation via NPM is one of the main targets we want to hit. |
After 2, then I guess implementing cypress and improving the test tooling would be next. There is an issue #72 to add code coverage, which can be done by adding this config here I think that moving to cypress does not require the monorepo. It should work in any case. The question is how much flexibility it would need. I believe that it should support multiple apps and have its own build scripts to create them, but this can be added incrementally to a simple start. |
the current webpack config is minimal. An ejected configuration from create react app provides reasonable defaults for custom configurations which will provide both development and production build environments.
For example, the standard dev configuration includes helpful plugins like babel-plugin-transform-react-jsx-source that provides stack traces with line numbers and file names.
It has been indicated in the meeting today that this repo is considered to be a starting point for future development. Is a PR for this welcomed here?
The text was updated successfully, but these errors were encountered: