-
-
Notifications
You must be signed in to change notification settings - Fork 456
214 build override #259
214 build override #259
Conversation
- Removed `next build` - Updated README with changes - Added missing `inputs` to README - Clarified the use of `nextConfigDir` - Modified `deploy` step
…c resources folder lives
…of appending to it. I think this is clearer to configure.
- Add buildScripts input - Updated README with changes
|
@jlaramie Just a few questions from me:
# default
MyNextJSProject:
component: serverless-next.js
inputs:
build:
cmd: 'node_modules/.bin/next'
args: ['build']
cwd: './'# custom build opts with env etc.
MyNextJSProject:
component: serverless-next.js
inputs:
build:
cmd: '../some/other/.bin/next'
args: ['build', 'src']
cwd: './'
env:
foo: ${SomeOtherComponent.foo}
SomeOtherComponent:
...# don't build
MyNextJSProject:
component: serverless-next.js
inputs:
build: falsePresumably that covers all use cases? |
|
@danielcondemarin I can make those changes. I took this logic from my own custom serverless component which uses arrays in order to call multiple build scripts. The idea was to be able to call more than one script if you wanted to like if there are two distinct things you want to build with different arguments. I like the idea of putting this all under |
@jlaramie Feel free to make the changes and we'll get it merged 🙏 Also, I'd prefer if it wasn't an array. It shouldn't be responsibility of the next component to build other things aside from the next app. |
- Replaced input.buildScripts with just input.build - Updated readme and provided an example for using
|
@danielcondemarin Just pushed the changes you suggested. I also updated the readme and added an example |
|
@danielcondemarin Yeah really if you need multiple things built you should just modify the build script to call a wrapper command |
|
@jlaramie Excellent work! Thank you 🙏 |
@danielcondemarin If we aren't going to decouple the build then I'd like a way to pass additional ENVs to the build. As I've progressed the projects that are using this library, I've now run into needing access to serverless variables. Currently I solve this by creating my own custom component that gets fed the variables and does the NextJS builds. The outputs from the custom component get passed into the
serverless-nextjs-componentso that it doesn't run until mybuildcomponent finishes.I suggest something like this:
inputs.nextStaticPathinputs.nextBuildArgumentsinputs.buildScripts. This defaults to running the standard build withinputs.nextBuildArgumentsbut can be overridden with an array of scripts to run.Here is a mock sample of the default configuration
Benefits
inputs.nextBuildArgumentsor by replacing theinputs.buildScriptsSorry for the rant but I"m just trying to figure out what will get me out of this fork and back into master. I'm going to create a pull request for this.