New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add hook *before:step-functions-offline:start* #313
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c9dbb6c
add hook *before:step-functions-offline:start*
vkkis93 f78d5e9
use compile instead of wpwatch
vkkis93 a1631bc
Update index.js
vkkis93 bab15c8
Create prepareStepOfflineInvoke.js
vkkis93 ba7ec41
fix eslint
vkkis93 b4e98d2
Update index.js
vkkis93 bd46cd9
Update prepareStepOfflineInvoke.js
vkkis93 20f84a1
Added unit tests for prepareStepOfflineInvoke
245ced2
Added step-offline to separate supported plugins section
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch will automatically watch for source changes. Both functionalities (offline watch and invoke local watch) set the base directory for the execution properly, e.g. for serverless-offline the location parameter is set correctly.
If there is something similar for the step-functions that needs to be done, we had to add a different "watch" or "prepare" function for step (e.g. stepWatch).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using .then(this.validate).then(this.compile) need to create separate function for plugin ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only if we want to support watch mode and if step-offline needs to know the compiled directory, then you can do:
The new
prepareStepOffline
function should then do something similar as https://github.com/serverless-heaven/serverless-webpack/blob/master/lib/prepareOfflineInvoke.js, only that it prepares the root folder for the step-offline plugin.Otherwise the step-offline will just run on the uncompiled code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need only compile code once, run step-offline and stop process.
I don't need to have watch mode
About compiled directory, user will indicate the path to directory by himself in plugin settings.
Referring to my requirements - need to change something or this code makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense with the compile, yes.
However:
That will not really work out, if you set package: individually. Then the compiled code will then be distributed. I think you need a "prepare" function because for the offline, it has to be set to service packaging (then the output directory is ".webpack/service") like in the prepareOffline.
With individual packaging it is ".webpack/" which is not predictable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me the link to your plugin. Maybe I have some time over the weekend to have a look, if we can combine this in an easy and compatible way there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HyperBrain but looks like your approach very good.
Makes sense to rewrite it.
Only one question, serverless-webpack compiles all functions which described in section functions in serverless.yml ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great,
I update this pull request to Is this ready for review?: NO at this moment.
When I will rewrite code, I will notify you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I'm already excited 😄