eui icon indicating copy to clipboard operation
eui copied to clipboard

[DISCUSS] Script for pre-release EUI build testing in consuming projects

Open chandlerprall opened this issue 7 years ago • 12 comments

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

chandlerprall avatar Apr 08 '19 17:04 chandlerprall

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?

snide avatar Apr 08 '19 17:04 snide

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.

cchaos avatar Apr 08 '19 18:04 cchaos

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.

chandlerprall avatar Apr 09 '19 15:04 chandlerprall

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.

chandlerprall avatar Apr 09 '19 15:04 chandlerprall

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 of yarn that 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 a yarn 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.

thompsongl avatar Apr 12 '19 21:04 thompsongl

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)

thompsongl avatar Apr 18 '19 16:04 thompsongl

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

thompsongl avatar May 24 '19 15:05 thompsongl

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.

chandlerprall avatar Jun 25 '19 15:06 chandlerprall

Found this tool which may satisfy many of the above constraints/ideas, however:

  • no Windows support
  • uses npm to 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 pack and npm install --production. You can use your current test suite for testing, and also write some new smoke tests that are specific to r2g.

chandlerprall avatar Jun 25 '19 16:06 chandlerprall

👋 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.

github-actions[bot] avatar Sep 07 '21 00:09 github-actions[bot]

👋 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.

github-actions[bot] avatar Mar 06 '22 16:03 github-actions[bot]

👋 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.

github-actions[bot] avatar Sep 03 '22 16:09 github-actions[bot]

👋 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.

github-actions[bot] avatar Mar 05 '23 16:03 github-actions[bot]

❌ We're automatically closing this issue due to lack of activity. Please comment if you feel this was done in error.

github-actions[bot] avatar Mar 13 '23 00:03 github-actions[bot]