feat: add @yardinternet/wp-scripts-config - #143
Merged
Conversation
YvetteNikolov
requested review from
FreakyWizard,
JasperS20,
WybeBosch,
Yannicvanveen,
laravdiemen and
rivanuff
August 10, 2026 14:19
YvetteNikolov
force-pushed
the
feat/wp-scripts-config
branch
from
August 10, 2026 14:21
9d3a016 to
d87aa53
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new @yardinternet/wp-scripts-config package to the monorepo, intended to wrap @wordpress/scripts’ webpack config and apply Yard-specific fixes (currently disabling Sass’ BOM-emitting charset behavior). The root Vitest workspace is updated to include this new package’s test suite.
Changes:
- Add new
packages/wp-scripts-configpackage exporting a transformed@wordpress/scriptswebpack config. - Add a
disable-sass-charsettransform plus a Vitest suite validating schema compatibility and Sass BOM behavior. - Register the new package’s Vitest project in the root
vitest.config.mjs.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.mjs | Adds the new package’s Vitest project to the workspace test run. |
| packages/wp-scripts-config/vitest.config.mjs | Defines the package-local Vitest configuration. |
| packages/wp-scripts-config/tests/index.test.js | Adds tests for schema validity, sass-loader option merging, and BOM suppression behavior. |
| packages/wp-scripts-config/src/transforms/disable-sass-charset.js | Implements the transform that sets sassOptions.charset = false for sass-loader rules. |
| packages/wp-scripts-config/src/index.js | Exports the transformed @wordpress/scripts config by applying transforms in sequence. |
| packages/wp-scripts-config/README.md | Documents purpose, usage, and how to add future fixes. |
| packages/wp-scripts-config/package.json | Introduces the new package manifest with peer/dev dependencies. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+11
to
+26
| module.exports = ( config ) => { | ||
| for ( const rule of config.module?.rules ?? [] ) { | ||
| for ( const use of Array.isArray( rule.use ) ? rule.use : [] ) { | ||
| if ( ! use?.loader?.includes?.( 'sass-loader' ) ) { | ||
| continue; | ||
| } | ||
|
|
||
| use.options = { | ||
| ...use.options, | ||
| sassOptions: { ...use.options?.sassOptions, charset: false }, | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| return config; | ||
| }; |
| const config = require( '../src/index.js' ); | ||
| const disableSassCharset = require( '../src/transforms/disable-sass-charset' ); | ||
|
|
||
| const BOM = ''; |
Comment on lines
+5
to
+10
| // Add all transforms to the array here. | ||
| const allTransforms = [ require( './transforms/disable-sass-charset' ) ]; | ||
|
|
||
| module.exports = allTransforms.reduce( | ||
| ( config, transform ) => transform( config ), | ||
| defaultConfig |
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.
No description provided.