Skip to content
This repository has been archived by the owner on May 14, 2023. It is now read-only.

Add option to install Stork during CI builds. #9

Open
reese opened this issue Jan 9, 2021 · 3 comments
Open

Add option to install Stork during CI builds. #9

reese opened this issue Jan 9, 2021 · 3 comments

Comments

@reese
Copy link
Owner

reese commented Jan 9, 2021

Many users will deploy this using Github Actions, Netlify, or similar build providers. Installing Stork during CI builds by default (and allowing users to opt-out if needed) would save many users some headaches.

@ashutoshsaboo
Copy link

ashutoshsaboo commented Apr 7, 2021

How about this plugin can configure for an optional env variable say - GATSBY_STORK_INSTALL_LOCATION (GATSBY_ prefix as per gatsby best practices). If that variable is set then where you are checking for if stork is installed in the plugin there can be an or check to also execute binary at this path and check if it's version or something to assert stork is installed.

Once that is done, when actually invoking stork for index creation - similarly we can use either stork cli command if it's natively installed or else use ./<ENV_VAR_LOCATION> to invoke stork.

How does that sound ? Would that be a trivial fix? For ease and reducing complexity with the plugin, We can simply ask the client to set the env variable to correct binary executable location (along with chmod +x). Since most will anyways only use this for CIs, this should be quite easy for them to set as well. @reese

@reese
Copy link
Owner Author

reese commented Apr 7, 2021

I think the ENV variable sounds reasonable to me, especially for a quick fix for your use case. In the long term, I think it could also be useful to provide a default installation script during CI and then expose a config flag to optionally run it. There's an is-ci npm package that may be useful for that, and since I would assume that most CI uses Ubuntu, we could provide something similar to the build.sh in the docs and then call it with execSync from inside the plugin, which would mean that clients wouldn't even have to worry about installation. That's a longer-term solution though, we can always support those two separately.

@reese
Copy link
Owner Author

reese commented Apr 18, 2021

@ashutoshsaboo I'll work on a more robust solution in the future, but I just published version 0.3.2 which has a GATSBY_STORK_EXECUTABLE_PATH env variable to override the stork executable location. Hopefully that at least unblocks you for now, but let me know if you run into any issues using that!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants