Scripts: Do not exit build when no entry found in src directory - #38737
Merged
Conversation
gziolo
requested review from
ajitbohra,
nerrad,
ntwb and
ryanwelcher
as code owners
February 11, 2022 10:37
gziolo
force-pushed
the
fix/wp-scripts-entry-exit
branch
from
February 11, 2022 10:38
db32672 to
4e2dfce
Compare
8 tasks
Member
Author
|
I'm planning to publish this fix to npm soon after this change is merged. |
|
Size Change: 0 B Total Size: 1.15 MB ℹ️ View Unchanged
|
ocean90
approved these changes
Feb 11, 2022
ocean90
left a comment
Member
There was a problem hiding this comment.
Thanks, this looks good and is also working for me. 👍
ocean90
reviewed
Feb 11, 2022
Co-authored-by: Dominik Schilling <dominikschilling+git@gmail.com>
Member
Author
|
Prettier didn't like the changes and I had to fix that in the |
gziolo
added a commit
that referenced
this pull request
Feb 11, 2022
…38737) * Scripts: Do not exit `build` when no entry found in `src` directory * Apply suggestions from code review Co-authored-by: Dominik Schilling <dominikschilling+git@gmail.com> Co-authored-by: Dominik Schilling <dominikschilling+git@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #38739.
Addressed the issue raised by @loxK in #38584 (comment).
I followed the recommendation and added an early return when there is no
srcdirectory. In case when thesrcdirectory exists then the script still shows the warning but it returns the defaul value forentrywhich is{}.I also included a missed CHANGELOG entry for #38584.
Testing Instructions
Run:
Try removing a script file referenced in the
block.jsonand run the build again:You should see a warning and the build should run but it will only copy a
block.jsonfile:If you rename the
srcdirectory then the build should still run but will finish without any files processed:Types of changes
Bug fix (non-breaking change which fixes an issue).
Checklist:
*.native.jsfiles for terms that need renaming or removal).