Is there a way in Seed to apply a facade-style pat...
# help
r
Is there a way in Seed to apply a facade-style pattern using pre-build or pre-compile tasks (or other mechanism)? What I mean by that is we have a Github repo with the main application code in it that will get deployed. Then each customer has its own configuration to apply on top of the code in that repo. What we do in the front-end (which is deployed via Netlify) is to provide a JavaScript file in the core repo that uses some enviroment variables that contain a Git access token, and the name of a customer repo. Then instead of running
Copy code
npm run build
we have a separate NPM script that calls the Javascript file say
Copy code
npm run config
which actually does:
Copy code
node buildClientApp.js
buildClientApp.js retrieves the config using Octokit from the provided repo and then runs npm run build on the combined config and core code. This output is then what is deployed. Does anyone have any pointers on how this could be achieved in Seed for the backend lambda code?
j
You should be able to run a similar script on Seed. Add it to the before compile step and it’ll be run before npm install https://seed.run/docs/adding-a-build-spec.html
r
Thanks Jay, so at that stage of the process, the code is checked out but npm install hasn’t been run?
j
Yup exactly
r
Ok, cool, i’ll give it a bash
thanks