[DISCUSS] Script for pre-release EUI build testing in consuming projects
Because node_modules exists within the EUI project dir, yarn linking EUI into another project can create conflicts between dependency versions, most notably with React. Another recurring "issue" when testing EUI linked into another project is forgetting to buildchanges to EUI.
I'd like to add a new script in EUI that mimics a linking behaviour by building & copying the es and lib directories to a specified project, then watch for changes to EUI sources and update the es and lib builds on additional changes.
Something like yarn build-into ~/projects/kibana
I assume the build would be wiped on a kbn bootstrap? Which is fine. I'm just wondering if you're thinking it's a generic copy of files, or more of symlink like yarn link?
I'm always up for whatever makes it easier without having to remember the entire procedure. One thing to note, I think I had trouble getting back to the original EUI without the link. And it most often always requires a yarn clean which takes terribly long. So if it's possible to avoid that, that would be wonderful.
I assume the build would be wiped on a kbn bootstrap?
I think I had trouble getting back to the original EUI without the link. And it most often always requires a yarn clean which takes terribly long.
Noted! I've always had problems getting things back in order even when linking / unlinking was successful.
The script can backup the existing es & lib directories and revert them when its process is killed.
I'm just wondering if you're thinking it's a generic copy of files, or more of symlink like yarn link?
I was thinking copying the files themselves; symlinks aren't cross-platform (Windows) compatible.
I tried some things out today and here's a diff containing a linking/copying script: https://github.com/elastic/eui/compare/master...thompsongl:link-eui
Things to note:
- It's naive. Given Kibana as the dest project, it can hold its own through
yarn kbn bootstrap, but can't introduce any new deps. That is, it has to be able to run on the deps currently installed for EUI in that project (probably whatever version is currently on master). This is a limitation ofyarnthat I'm not sure how to work around. - It's destructive. Once you use it, you'll need to
yarn install --force(or something) to get the dest project back to normal. This isn't different from what happens today after ayarn unlink, but we can do better. - It's inefficient. The build and watch sequences just use
yarn build, which take forever. With @chandlerprall's help, we can do better.
Also, this is absolutely not the approach we need to take. I just needed something to better work through upcoming typescript config changes that would give consistent results when synced with Kibana.
This will likely become a bigger priority: https://github.com/elastic/eui/pull/1822#issuecomment-484571112 (yarn link + reading real file paths + different babel configs)
Looked into using yarn pack to be able to more accurately/comprehensively install local EUI in Kibana. Ran into a problem running yarn add after changing the process directory because of node version expectations (Kibana wants 10.15, EUI has 8.15).
Not sure trying to match versions is something we want to do, but it's a blocker for having a script handle all the steps if interacting with yarn
Ideally, this thought/script/thing could be expanded to support testing EUI builds against any number of projects. e.g. validate against create-react-app, codesandbox (snapshot a blank project?), etc. This should have the ability to run those projects' test and/or build scripts for validation.
Found this tool which may satisfy many of the above constraints/ideas, however:
- no Windows support
- uses
npmto install, may not be able to configure it to yarn - doesn't support incremental builds
https://github.com/ORESoftware/r2g
r2g tests your package after using
npm packandnpm install --production. You can use your current test suite for testing, and also write some new smoke tests that are specific to r2g.
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
❌ We're automatically closing this issue due to lack of activity. Please comment if you feel this was done in error.