build: fix build for amplitude-segment-snippet.min.js #462
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.
Summary
This change includes a fix to the build step that generates
amplitude-segment-snippet.min.js.Currently, the build steps fails on minify, after
greppipes code to minify that contains syntax errors. The syntax error stems from to an incorrect pattern used ingrep. The pattern was previously working with unstyled code until prettier was introduced in this commit.After prettier was introduced, the following line in
src/amplitude-snippet.js:turned into:
where the pattern does not work with. This leads to code containing syntax errors getting piped to minify and ultimately causing it to fail. The output is an empty file named
amplitude-segment-snippet.min.js.In addition, with the output file being empty, it breaks the release workflow for
@semantic-release/githubin the step where it publishes the file that matches this blob. This publish step validates that the file is not empty. The emptyamplitude-segment-snippet.min.jsviolates the rule leading to a failed release workflow.The change assumes that
amplitude-segment-snippet.min.jsis still relevant and needs to be kept. If the assumption is not true, we can alternatively remove the build step for this file.Checklist