Optionally get custom scripts config from toolkit.config.js #188
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 of the Change
Gives developers the option to use a
toolkit.config.js
file at the root of their project for custom 10up-toolkit configuration. If present this will override any toolkit config withinpackage.json
.Closes #187
Alternate Designs
I had thought about modifying the
getPackage
function, but the package build config depends on this function to retrieve other properties frompackage.json
. OnlygetTenUpScriptsConfig
is concerned with custom config.Possible Drawbacks
Might be a little confusing for devs now having 3 different options for custom config. I think this would at least eliminate the need to provide the option for a custom
filenames.config.js
.Verification Process
Followed the contributing guidelines and tested with the 10up-theme. Removed
10up-toolkit
frompackage.json
, placed the configuration along with new entries within atoolkit.config.js
at the root of the project, and all assets were processed as they should have been when runningnpm start
.Note: Tests are failing due to
hasProjectFileMock.mockReturnValue(true)
within multiple tests. Honestly I'm not sure what the preferred fix would be here.Checklist:
Changelog Entry
Credits
Props @