diff --git a/bin/test-create-block.sh b/bin/test-create-block.sh
index 99b7e8e608260..7df3b214af042 100755
--- a/bin/test-create-block.sh
+++ b/bin/test-create-block.sh
@@ -56,7 +56,7 @@ if [ "$expected" -ne "$actual" ]; then
exit 1
fi
expected=7
-actual=$( find src -maxdepth 1 -type f | wc -l )
+actual=$( find src -maxdepth 2 -type f | wc -l )
if [ "$expected" -ne "$actual" ]; then
error "Expected $expected files in the \`src\` directory, but found $actual."
exit 1
@@ -70,7 +70,7 @@ status "Building block..."
status "Verifying build..."
expected=9
-actual=$( find build -maxdepth 1 -type f | wc -l )
+actual=$( find build -maxdepth 2 -type f | wc -l )
if [ "$expected" -ne "$actual" ]; then
error "Expected $expected files in the \`build\` directory, but found $actual."
exit 1
diff --git a/changelog.txt b/changelog.txt
index 665265aef64d4..bb71ae8617d7f 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,458 @@
== Changelog ==
+= 20.0.0-rc.1 =
+
+
+## Changelog
+
+### Features
+
+#### Interactivity API
+- Prevent each directive errors and allow any iterable. ([67798](https://github.com/WordPress/gutenberg/pull/67798))
+
+
+### Enhancements
+
+- Add dropdown menu props to ToolsPanel component. ([68019](https://github.com/WordPress/gutenberg/pull/68019))
+- Create Block: Allow external templates to customize more fields. ([68193](https://github.com/WordPress/gutenberg/pull/68193))
+- Create Block: Optimize the default template for multiple blocks case. ([68175](https://github.com/WordPress/gutenberg/pull/68175))
+- DOM: Support class wildcard matcher in 'cleanNodeList'. ([67830](https://github.com/WordPress/gutenberg/pull/67830))
+- Scripts: Recommend passing JS entry points with paths. ([68251](https://github.com/WordPress/gutenberg/pull/68251))
+- Upgrade sass to version 1.54.0. ([68380](https://github.com/WordPress/gutenberg/pull/68380))
+- Use Badge component in dataview grids. ([68062](https://github.com/WordPress/gutenberg/pull/68062))
+- Use Badge component in page markers. ([68103](https://github.com/WordPress/gutenberg/pull/68103))
+- postcss-plugins-preset: Bump autoprefixer to 10.4.20. ([68237](https://github.com/WordPress/gutenberg/pull/68237))
+- wp-env: Add multisite support. ([67845](https://github.com/WordPress/gutenberg/pull/67845))
+
+#### Block Library
+- Add Tools Panel dropdown menu props to More block. ([68039](https://github.com/WordPress/gutenberg/pull/68039))
+- Add block example attribute for Comments Form block. ([68267](https://github.com/WordPress/gutenberg/pull/68267))
+- Add block example attribute for Comments block. ([68266](https://github.com/WordPress/gutenberg/pull/68266))
+- Archive: Add dropdown menu props to ToolsPanel component. ([68010](https://github.com/WordPress/gutenberg/pull/68010))
+- Archives Block: Refactor setting panel. ([67841](https://github.com/WordPress/gutenberg/pull/67841))
+- Button Block: Refactor setting panel. ([67887](https://github.com/WordPress/gutenberg/pull/67887))
+- Button: Update Settings text labels. ([68265](https://github.com/WordPress/gutenberg/pull/68265))
+- Date Block: Add dropdown menu props to ToolsPanel component. ([68018](https://github.com/WordPress/gutenberg/pull/68018))
+- Date Block: Refactor settings panel to use ToolsPanel. ([67906](https://github.com/WordPress/gutenberg/pull/67906))
+- Details Block: Migrate to Toolspanel. ([67966](https://github.com/WordPress/gutenberg/pull/67966))
+- Excerpt Block: Refactor settings panel to use ToolsPanel. ([67908](https://github.com/WordPress/gutenberg/pull/67908))
+- Featured Image Block: Refactor setting panel. ([67456](https://github.com/WordPress/gutenberg/pull/67456))
+- Introduce new filter "render_block_core_navigation_link_allowed_post_status". ([63181](https://github.com/WordPress/gutenberg/pull/63181))
+- Latest Posts Border Block Support. ([66353](https://github.com/WordPress/gutenberg/pull/66353))
+- Login/Logout: Add dropdown menu props to ToolsPanel component. ([68009](https://github.com/WordPress/gutenberg/pull/68009))
+- Login/Logout: Refactor settings panel to use ToolsPanel. ([67909](https://github.com/WordPress/gutenberg/pull/67909))
+- More Block: Refactor settings panel to use ToolsPanel. ([67905](https://github.com/WordPress/gutenberg/pull/67905))
+- Navigation Submenu Block: Refactor settings panel to use ToolsPanel. ([67969](https://github.com/WordPress/gutenberg/pull/67969))
+- Page List Block: Add dropdown menu props to ToolsPanel component. ([68012](https://github.com/WordPress/gutenberg/pull/68012))
+- Page List Block: Refactor settings panel to use ToolsPanel. ([67903](https://github.com/WordPress/gutenberg/pull/67903))
+- Post Featured Image: Use the 'ResolutionTool' component. ([68294](https://github.com/WordPress/gutenberg/pull/68294))
+- Query Page Numbers Block: Refactor settings panel to use ToolsPanel. ([67958](https://github.com/WordPress/gutenberg/pull/67958))
+- Query Page Numbers: Add dropdown menu props to ToolsPanel component. ([68013](https://github.com/WordPress/gutenberg/pull/68013))
+- Query Pagination: Refactor settings panel to use ToolsPanel. ([67914](https://github.com/WordPress/gutenberg/pull/67914))
+- Query Pagination: Update 'showLabel' help text. ([68105](https://github.com/WordPress/gutenberg/pull/68105))
+- Query Total block: Reduce concatenation in the output text. ([68150](https://github.com/WordPress/gutenberg/pull/68150))
+- Read More: Add example preview. ([68288](https://github.com/WordPress/gutenberg/pull/68288))
+- Refactor "Settings" panel of Navigation Item block to use ToolsPanel instead of PanelBody. ([67973](https://github.com/WordPress/gutenberg/pull/67973))
+- Replace PanelBody with ToolsPanel and ToolsPanelItem in column block. ([67913](https://github.com/WordPress/gutenberg/pull/67913))
+- Replace PanelBody with ToolsPanel and ToolsPanelItem in spacer block. ([67981](https://github.com/WordPress/gutenberg/pull/67981))
+- Replace PanelBody with ToolsPanel in columns block. ([67910](https://github.com/WordPress/gutenberg/pull/67910))
+- Site Title Block: Add dropdown menu props to ToolsPanel component. ([68017](https://github.com/WordPress/gutenberg/pull/68017))
+- Site Title Block: Refactor settings panel to use ToolsPanel. ([67898](https://github.com/WordPress/gutenberg/pull/67898))
+- Social Icon: Migrate to Toolspanel. ([67974](https://github.com/WordPress/gutenberg/pull/67974))
+- Social Icons: Migrate to Toolspanel. ([67975](https://github.com/WordPress/gutenberg/pull/67975))
+- Table Block: Refactor settings panel to use ToolsPanel. ([67896](https://github.com/WordPress/gutenberg/pull/67896))
+- Tag Cloud Block: Refactor settings panel to use ToolsPanel. ([67911](https://github.com/WordPress/gutenberg/pull/67911))
+- Video Block: Refactor setting panel. ([67044](https://github.com/WordPress/gutenberg/pull/67044))
+
+#### Components
+- : Badge Component. ([66555](https://github.com/WordPress/gutenberg/pull/66555))
+- Badge: Support text truncation. ([68107](https://github.com/WordPress/gutenberg/pull/68107))
+- Button: Add hover style to `secondary` variant. ([67325](https://github.com/WordPress/gutenberg/pull/67325))
+- CreateTemplatePartModalContents: Use native radio inputs. ([67702](https://github.com/WordPress/gutenberg/pull/67702))
+- Menu: More granular sub-components. ([67422](https://github.com/WordPress/gutenberg/pull/67422))
+- RangeControl: Animate thumb and track only when using marks. ([67836](https://github.com/WordPress/gutenberg/pull/67836))
+- Storybook: Add more `max-width` containers. ([68080](https://github.com/WordPress/gutenberg/pull/68080))
+- Storybook: Upgrade to the latest version (v8.4.7). ([67863](https://github.com/WordPress/gutenberg/pull/67863))
+- Storybook: Upgrade to v8.0.x. ([67574](https://github.com/WordPress/gutenberg/pull/67574))
+- Unite inline Ariakit imports. ([67818](https://github.com/WordPress/gutenberg/pull/67818))
+
+#### Style Book
+- Give style book its own route so it can be linked to directly. ([67811](https://github.com/WordPress/gutenberg/pull/67811))
+- Stylebook: Add the Appearance -> Design submenu through `admin_menu` action. ([68174](https://github.com/WordPress/gutenberg/pull/68174))
+- Try splitting style book into sections. ([68071](https://github.com/WordPress/gutenberg/pull/68071))
+- Try toggle instead of dropdown to show stylebook. ([67810](https://github.com/WordPress/gutenberg/pull/67810))
+
+#### Design Tools
+- Post Comments Link: Add Border Support. ([68450](https://github.com/WordPress/gutenberg/pull/68450))
+- Post Template: Add Border and Spacing Support. ([64425](https://github.com/WordPress/gutenberg/pull/64425))
+- Query Total: Add Border Support. ([68323](https://github.com/WordPress/gutenberg/pull/68323))
+
+#### Block Editor
+- Add reset button to ColorGradientSettingsDropdown. ([67800](https://github.com/WordPress/gutenberg/pull/67800))
+- ChildLayoutControl: Use units defined in theme.json. ([67784](https://github.com/WordPress/gutenberg/pull/67784))
+- KeyboardShortcuts: Update delete shortcut to use `shift + Backspace`. ([68164](https://github.com/WordPress/gutenberg/pull/68164))
+
+#### Block hooks
+- Apply to Post Content (on frontend and in editor). ([67272](https://github.com/WordPress/gutenberg/pull/67272))
+- Synced Patterns: Apply Block Hooks. ([68058](https://github.com/WordPress/gutenberg/pull/68058))
+
+#### Media
+- Split upload into verbs and nouns. ([68227](https://github.com/WordPress/gutenberg/pull/68227))
+
+#### Zoom Out
+- Remove placeholder of default paragraph when it's the only block and canvas is zoomed out. ([68106](https://github.com/WordPress/gutenberg/pull/68106))
+
+#### Interactivity API
+- iAPI Router: Handle styles assets on region-based navigation. ([67826](https://github.com/WordPress/gutenberg/pull/67826))
+
+#### Plugin
+- Add a Playground blueprint json to the /assets/blueprints folder of Plugin Repo. ([67742](https://github.com/WordPress/gutenberg/pull/67742))
+
+#### Site Editor
+- Pages: Add "Set as posts page" action. ([67650](https://github.com/WordPress/gutenberg/pull/67650))
+
+#### Write mode
+- Allow template part editing in write mode. ([67372](https://github.com/WordPress/gutenberg/pull/67372))
+
+#### Patterns
+- Replace Starter Content modal with inserter panel. ([66836](https://github.com/WordPress/gutenberg/pull/66836))
+
+#### Commands
+- Add command to navigate to site editor. ([66722](https://github.com/WordPress/gutenberg/pull/66722))
+
+#### Inspector Controls
+- Use custom name in block sidebar if available (retaining block type information). ([65641](https://github.com/WordPress/gutenberg/pull/65641))
+
+
+### New APIs
+
+#### Components
+- BoxControl: Add support for presets. ([67688](https://github.com/WordPress/gutenberg/pull/67688))
+
+
+### Bug Fixes
+
+- Add duotone and dimensions to the block level for translation. ([68243](https://github.com/WordPress/gutenberg/pull/68243))
+- Add text domain option while scaffolding the block in create-block. ([57197](https://github.com/WordPress/gutenberg/pull/57197))
+- Added `is-focus-mode` class on all viewports. ([67377](https://github.com/WordPress/gutenberg/pull/67377))
+- Editor: Fix initial edits applied again after saving the post. ([68273](https://github.com/WordPress/gutenberg/pull/68273))
+- Fix dataviews commonjs export. ([67962](https://github.com/WordPress/gutenberg/pull/67962))
+- Get active element within the iframe when restoring focus. ([68060](https://github.com/WordPress/gutenberg/pull/68060))
+- Make strings in theme.json translatable. ([66675](https://github.com/WordPress/gutenberg/pull/66675))
+- Scripts: Use fork of `rtlcss-webpack-plugin` to fix issues with deps. ([68201](https://github.com/WordPress/gutenberg/pull/68201))
+
+#### Block Library
+- Columns: Add space above notice text. ([68259](https://github.com/WordPress/gutenberg/pull/68259))
+- Enhance: Improve pagination logic in core/query-pagination-previous block. ([68070](https://github.com/WordPress/gutenberg/pull/68070))
+- Fix author information leakage by author blocks for Custom Post Types without author support & display notice to user. ([67136](https://github.com/WordPress/gutenberg/pull/67136))
+- Media & Text: Correctly reset the 'useFeaturedImage' attribute. ([68247](https://github.com/WordPress/gutenberg/pull/68247))
+- Navigation Submenu Block: Add dropdown menu props to ToolsPanel component. ([68015](https://github.com/WordPress/gutenberg/pull/68015))
+- Page List Block: Fix critical error when converting to link. ([68076](https://github.com/WordPress/gutenberg/pull/68076))
+- Page List block: Don't wrap Edit button with ToolsPanelItem component. ([68248](https://github.com/WordPress/gutenberg/pull/68248))
+- Query Total: Remove nested element. ([68304](https://github.com/WordPress/gutenberg/pull/68304))
+- Table Block: Fix margin/padding to include caption in spacing. ([68281](https://github.com/WordPress/gutenberg/pull/68281))
+- Update SiteTitle block to Fix `isLink` Toggle Behavior. ([68295](https://github.com/WordPress/gutenberg/pull/68295))
+- i18n: Make example and variations translatable in `post-navigation-link`. ([68375](https://github.com/WordPress/gutenberg/pull/68375))
+- i18n: Make example translatable in `query-no-results`. ([68376](https://github.com/WordPress/gutenberg/pull/68376))
+- i18n: Make example translatable in `table-of-contents`. ([68377](https://github.com/WordPress/gutenberg/pull/68377))
+
+#### Components
+- Block Editor: Fix the 'Reset all' bug for the 'ResolutionTool' component. ([68296](https://github.com/WordPress/gutenberg/pull/68296))
+- BoxControl: Better minimum value support. ([67819](https://github.com/WordPress/gutenberg/pull/67819))
+- BoxControl: Fix `aria-valuetext` value. ([68362](https://github.com/WordPress/gutenberg/pull/68362))
+- Fix end-to-end storybook. ([68307](https://github.com/WordPress/gutenberg/pull/68307))
+- Fixing Text Contrast for Dark Mode. ([68349](https://github.com/WordPress/gutenberg/pull/68349))
+- FontSizePicker: Add `display: Contents` rule to custom size select. ([68280](https://github.com/WordPress/gutenberg/pull/68280))
+- Storybook: Fix `emotion/is-prop-valid` warning. ([68202](https://github.com/WordPress/gutenberg/pull/68202))
+- Storybook: Fix a few editor styles warnings. ([68198](https://github.com/WordPress/gutenberg/pull/68198))
+- Storybook: Fix warnings in Layout document. ([67865](https://github.com/WordPress/gutenberg/pull/67865))
+- Use default value in `useMediaUploadSettings`. ([68100](https://github.com/WordPress/gutenberg/pull/68100))
+
+#### Block Editor
+- Media Replace Flow: Add custom toggle support and fix button height. ([68084](https://github.com/WordPress/gutenberg/pull/68084))
+- BlockCard: Fix title alignment. ([68115](https://github.com/WordPress/gutenberg/pull/68115))
+- DateFormatPicker: Fix styles & spacing. ([68079](https://github.com/WordPress/gutenberg/pull/68079))
+- Fix Iframe error for links without 'href'. ([68024](https://github.com/WordPress/gutenberg/pull/68024))
+- Grid Visualizer: Improve observation logic. ([68230](https://github.com/WordPress/gutenberg/pull/68230))
+- List View: Fix appender size. ([68221](https://github.com/WordPress/gutenberg/pull/68221))
+- MediaReplaceFlow: Remove store subscription in favor of modern CSS. ([68276](https://github.com/WordPress/gutenberg/pull/68276))
+- Remove patterns from the Quick Inserter to prevent misuse in block-specific contexts. ([67738](https://github.com/WordPress/gutenberg/pull/67738))
+- Revert 'Warning' component autofocus. ([68133](https://github.com/WordPress/gutenberg/pull/68133))
+
+#### Post Editor
+- DataViews: Fix text in action for setting site home page. ([67787](https://github.com/WordPress/gutenberg/pull/67787))
+- Edit post: Fix meta box pane’s pointer capture. ([68252](https://github.com/WordPress/gutenberg/pull/68252))
+- Editor: Remove HTML from the post title in the document bar. ([68358](https://github.com/WordPress/gutenberg/pull/68358))
+- Fix: Some 403 errors for editor roles. ([68146](https://github.com/WordPress/gutenberg/pull/68146))
+- Improve logic to show entities saved panel description. ([67971](https://github.com/WordPress/gutenberg/pull/67971))
+
+#### DataViews
+- Don't render actions dropdown when all eligible ones are `primary`. ([68168](https://github.com/WordPress/gutenberg/pull/68168))
+- Handle `grid` preview size based on container width. ([68078](https://github.com/WordPress/gutenberg/pull/68078))
+- Hide actions related UI in `grid` when no actions or bulk actions are passed. ([68033](https://github.com/WordPress/gutenberg/pull/68033))
+- Pages: Update layout-specific configuration when the view is updated. ([67881](https://github.com/WordPress/gutenberg/pull/67881))
+- Use `action.disabled` state to disable actions (primary and secondary). ([68275](https://github.com/WordPress/gutenberg/pull/68275))
+
+#### Site Editor
+- Add CSS classname to fix the negative margins not appearing in the Navigation Screen. ([67825](https://github.com/WordPress/gutenberg/pull/67825))
+- Fix obsolete `getLocationWithParams` usage. ([68388](https://github.com/WordPress/gutenberg/pull/68388))
+- Pages: Remove unnecessary padding for items. ([67977](https://github.com/WordPress/gutenberg/pull/67977))
+- Update active menu item appearance. ([68147](https://github.com/WordPress/gutenberg/pull/68147))
+
+#### Style Book
+- Fix global styles updating in style book. ([68111](https://github.com/WordPress/gutenberg/pull/68111))
+- Fix style book background color. ([68088](https://github.com/WordPress/gutenberg/pull/68088))
+- Fix uploading background images in stylebook view. ([68159](https://github.com/WordPress/gutenberg/pull/68159))
+- Stylebook: Avoid double line in subcategory titles. ([67752](https://github.com/WordPress/gutenberg/pull/67752))
+
+#### Zoom Out
+- Allow replace operation on empty default block in Zoom Out. ([68026](https://github.com/WordPress/gutenberg/pull/68026))
+- Fix don't show inserter in Zoom Out dropzone when the text is visible. ([68031](https://github.com/WordPress/gutenberg/pull/68031))
+- Hide separators for currently dragged section in Zoom Out. ([67638](https://github.com/WordPress/gutenberg/pull/67638))
+- Make Write mode and Zoom out block options menus consistent. ([67749](https://github.com/WordPress/gutenberg/pull/67749))
+
+#### Design Tools
+- Background supports: Add default controls supports. ([68085](https://github.com/WordPress/gutenberg/pull/68085))
+- Block supports: Show selected item in font family select control. ([68254](https://github.com/WordPress/gutenberg/pull/68254))
+- Fix: Ensure consistency in editor tools for navigation buttons and delete options. ([67253](https://github.com/WordPress/gutenberg/pull/67253))
+
+#### Template Editor
+- Fix: Editing "Page" is broken for low capability users. ([68110](https://github.com/WordPress/gutenberg/pull/68110))
+- Plugin: Fix eligibility check for post types' default rendering mode. ([67879](https://github.com/WordPress/gutenberg/pull/67879))
+
+#### Widgets Editor
+- Customizer Widgets: Fix inserter button size and animation. ([67880](https://github.com/WordPress/gutenberg/pull/67880))
+- Widget Editor: Fix: Close button is not working. ([65443](https://github.com/WordPress/gutenberg/pull/65443))
+
+#### Meta Boxes
+- Show metabox when pattern is accessed directly. ([68255](https://github.com/WordPress/gutenberg/pull/68255))
+
+#### Typography
+- Button Block: Set proper typography for inner elements. ([68023](https://github.com/WordPress/gutenberg/pull/68023))
+
+#### History
+- Query Pagination: Fix 'undo' trap. ([68022](https://github.com/WordPress/gutenberg/pull/68022))
+
+#### npm Packages
+- Add --glob argument to rimraf cli scripts. ([67829](https://github.com/WordPress/gutenberg/pull/67829))
+
+#### Paste
+- Image: Avoid link class loss when pasting for raw transformation. ([67803](https://github.com/WordPress/gutenberg/pull/67803))
+
+#### Extensibility
+- Make Block Bindings work with `editor.BlockEdit` hook (2nd try). ([67523](https://github.com/WordPress/gutenberg/pull/67523))
+
+
+### Accessibility
+
+- Dataviews List layout: Do not use grid role on a `ul` element. ([67849](https://github.com/WordPress/gutenberg/pull/67849))
+- Fix: Templates and patterns are nesting two elements with the button role. ([67801](https://github.com/WordPress/gutenberg/pull/67801))
+- [Dataviews] Fix: Media item focus style is not visible on Grid. ([67789](https://github.com/WordPress/gutenberg/pull/67789))
+
+#### Block Editor
+- Fix: Inserter category tabs: Avoid unnecessary aria-label. ([68160](https://github.com/WordPress/gutenberg/pull/68160))
+- Improve accessibility of the Warning component in the block editor. ([67433](https://github.com/WordPress/gutenberg/pull/67433))
+
+#### Global Styles
+- Shadows: Always show reset button if hover is not supported. ([68122](https://github.com/WordPress/gutenberg/pull/68122))
+- Visual Refactor: Add Chevron Icon for Shadows in Global Styles. ([67720](https://github.com/WordPress/gutenberg/pull/67720))
+
+#### Block Library
+- Button: Replace ButtonGroup usage with ToggleGroupControl. ([65346](https://github.com/WordPress/gutenberg/pull/65346))
+- Fix Choose menu label when a menu has been deleted. ([67009](https://github.com/WordPress/gutenberg/pull/67009))
+
+#### DataViews
+- Add confirm dialog before Permanently delete. ([67824](https://github.com/WordPress/gutenberg/pull/67824))
+
+#### Site Editor
+- Make sure the sidebar navigation item focus style is fully visible. ([67817](https://github.com/WordPress/gutenberg/pull/67817))
+
+#### Components
+- CustomSelectControl: Refactor to use Ariakit store state for current value. ([67815](https://github.com/WordPress/gutenberg/pull/67815))
+
+
+### Performance
+
+#### Block Library
+- Don't fetch media details if the block doesn't use a featured image. ([68299](https://github.com/WordPress/gutenberg/pull/68299))
+- Media & Text: Optimize block editor store subscriptions. ([68290](https://github.com/WordPress/gutenberg/pull/68290))
+
+
+### Experiments
+
+#### DataViews
+- Proof of concept: Visualize hierarchical data. ([66479](https://github.com/WordPress/gutenberg/pull/66479))
+
+
+### Documentation
+
+- .wp-env.json schema: Add `testsPort` field. ([68220](https://github.com/WordPress/gutenberg/pull/68220))
+- Add README for TextAlignmentControl component. ([68126](https://github.com/WordPress/gutenberg/pull/68126))
+- Add layout related updates to the DataForm README. ([68050](https://github.com/WordPress/gutenberg/pull/68050))
+- Added Global Documentation in load.php. ([68325](https://github.com/WordPress/gutenberg/pull/68325))
+- Badge component: Fix Storybook URL link. ([68077](https://github.com/WordPress/gutenberg/pull/68077))
+- Badge: Fix up extra newline in readme. ([68359](https://github.com/WordPress/gutenberg/pull/68359))
+- Block Editor Storybook: Restructure the directory and add badges to private components. ([68352](https://github.com/WordPress/gutenberg/pull/68352))
+- Clarify template property behavior in InnerBlocks documentation to specify prefill when empty. ([66911](https://github.com/WordPress/gutenberg/pull/66911))
+- Components: Normalize newlines in auto-generated READMEs. ([68208](https://github.com/WordPress/gutenberg/pull/68208))
+- Components: Prevent broken lists in auto-generated readmes. ([68301](https://github.com/WordPress/gutenberg/pull/68301))
+- Components: Warn private API in auto-generated readmes. ([68317](https://github.com/WordPress/gutenberg/pull/68317))
+- Create a catalog list of private APIs. ([66558](https://github.com/WordPress/gutenberg/pull/66558))
+- DateFormatPicker: Improve line breaks in JSDoc and README. ([68006](https://github.com/WordPress/gutenberg/pull/68006))
+- Doc: Add JSDoc and update README for BlockCard component. ([68114](https://github.com/WordPress/gutenberg/pull/68114))
+- Docs: Fix some typos on reference-guide data-core-block-editor.md. ([68066](https://github.com/WordPress/gutenberg/pull/68066))
+- Documenting innerBlocks in save function. ([66689](https://github.com/WordPress/gutenberg/pull/66689))
+- Fix reference to `wp-env start` in documentation. ([68034](https://github.com/WordPress/gutenberg/pull/68034))
+- Fix wrong `npm start` command. ([65221](https://github.com/WordPress/gutenberg/pull/65221))
+- Fix: Fix link to minimal-block example plugin code. ([67888](https://github.com/WordPress/gutenberg/pull/67888))
+- Fixed typo in README of TextTransformControl. ([68443](https://github.com/WordPress/gutenberg/pull/68443))
+- Section Styles: Update block style variation documentation. ([68169](https://github.com/WordPress/gutenberg/pull/68169))
+- Storybook : Add TextTransformControl stories. ([67365](https://github.com/WordPress/gutenberg/pull/67365))
+- Storybook: Add BorderRadiusControl story. ([67383](https://github.com/WordPress/gutenberg/pull/67383))
+- Storybook: Add PlainText Storybook stories. ([67341](https://github.com/WordPress/gutenberg/pull/67341))
+- Storybook: Add stories for BlockCard component. ([67191](https://github.com/WordPress/gutenberg/pull/67191))
+- Storybook: Add stories for BlockTitle Component. ([67234](https://github.com/WordPress/gutenberg/pull/67234))
+- Storybook: Add stories for DateFormatPicker Component. ([67290](https://github.com/WordPress/gutenberg/pull/67290))
+- Storybook: Add stories for the ContrastChecker component. ([68120](https://github.com/WordPress/gutenberg/pull/68120))
+- Storybook: Add stories for the TextAlignmentControl component. ([67371](https://github.com/WordPress/gutenberg/pull/67371))
+- Storybook: Add stories for the TextDecorationControl component. ([67337](https://github.com/WordPress/gutenberg/pull/67337))
+- Storybook: Add story for the Warning component. ([68124](https://github.com/WordPress/gutenberg/pull/68124))
+- Storybook: Make prop sort order consistent. ([68152](https://github.com/WordPress/gutenberg/pull/68152))
+- Tabs: Auto-generate README. ([68209](https://github.com/WordPress/gutenberg/pull/68209))
+- Update platform documentation intro. ([61341](https://github.com/WordPress/gutenberg/pull/61341))
+- Update the copyright license to 2025. ([68440](https://github.com/WordPress/gutenberg/pull/68440))
+- Updated @since Doc Order in Inline documentation. ([68003](https://github.com/WordPress/gutenberg/pull/68003))
+- Updated Document URL in Documentation. ([67990](https://github.com/WordPress/gutenberg/pull/67990))
+- Updated Small Typo in documentation in docs/getting-started/faq.md file. ([68357](https://github.com/WordPress/gutenberg/pull/68357))
+- [Docs] Fix: Two broken links to the packages reference API and to blocks documentation. ([67889](https://github.com/WordPress/gutenberg/pull/67889))
+- env: Fix changelog entry. ([68219](https://github.com/WordPress/gutenberg/pull/68219))
+- theme.json schema: Fix block list. ([68343](https://github.com/WordPress/gutenberg/pull/68343))
+
+
+### Code Quality
+
+- Adding myself as a code owner of the block library package. ([67891](https://github.com/WordPress/gutenberg/pull/67891))
+- Create Block: Migrate Inquirer.js dependency to the new API. ([67877](https://github.com/WordPress/gutenberg/pull/67877))
+- Fix indentation in the upload-media tsconfig. ([68083](https://github.com/WordPress/gutenberg/pull/68083))
+- Fix indentation in upload-media package.json. ([68037](https://github.com/WordPress/gutenberg/pull/68037))
+- Fix: Invalid JSDoc syntax for optional object. ([68061](https://github.com/WordPress/gutenberg/pull/68061))
+- Remove some obsolete stylelint `at-rule-no-unknown` disable rules. ([68087](https://github.com/WordPress/gutenberg/pull/68087))
+
+#### Components
+- DatePicker: Prepare day buttons for 40px default size. ([68156](https://github.com/WordPress/gutenberg/pull/68156))
+- DropZone: Make the drop zone in Storybook the same size as the item. ([68231](https://github.com/WordPress/gutenberg/pull/68231))
+- Fix Button size violations in misc. unit tests. ([68154](https://github.com/WordPress/gutenberg/pull/68154))
+- Fix: Add soft deperecation notice for the ButtonGroup component. ([65429](https://github.com/WordPress/gutenberg/pull/65429))
+- InputControl : Deprecate 36px default size. ([66897](https://github.com/WordPress/gutenberg/pull/66897))
+- Menu: Migrate Storybook examples to CSF3. ([68204](https://github.com/WordPress/gutenberg/pull/68204))
+- Menu: Use ariakit types. ([68206](https://github.com/WordPress/gutenberg/pull/68206))
+- Navigation: Prepare for hard deprecation. ([68158](https://github.com/WordPress/gutenberg/pull/68158))
+- Navigation: Upsize back buttons. ([68157](https://github.com/WordPress/gutenberg/pull/68157))
+- RadioGroup: Log deprecation warning. ([68067](https://github.com/WordPress/gutenberg/pull/68067))
+- SelectControl : Deprecate 36px default size. ([66898](https://github.com/WordPress/gutenberg/pull/66898))
+- Slot: Use layout effect and update Cover block unit tests. ([68176](https://github.com/WordPress/gutenberg/pull/68176))
+- SlotFill: Use observableMap everywhere, remove manual rerendering. ([67400](https://github.com/WordPress/gutenberg/pull/67400))
+- Tabs: Use correct ariakit type for root component. ([68207](https://github.com/WordPress/gutenberg/pull/68207))
+- TreeSelect: Deprecate 36px default size. ([67855](https://github.com/WordPress/gutenberg/pull/67855))
+
+#### Plugin
+- chore: fix return type for `WP_Duotone_Gutenberg::Get_selector()`. ([66695](https://github.com/WordPress/gutenberg/pull/66695))
+- fix: Deprecated `WP_Webfonts()` constructor takes no arguments. ([66700](https://github.com/WordPress/gutenberg/pull/66700))
+- fix: Remove extraneous arg from `gutenberg_url()` call in `gutenberg_posts_dashboard()`. ([66699](https://github.com/WordPress/gutenberg/pull/66699))
+- fix: Remove extraneous param from `remove_filter()` calls. ([66697](https://github.com/WordPress/gutenberg/pull/66697))
+- fix: Wrong number of `$accepted_args` on `add_filter()` calls. ([66694](https://github.com/WordPress/gutenberg/pull/66694))
+- fix: explicitly return false in `WP_Theme_JSON_Gutenberg::Should_override_preset()`. ([66696](https://github.com/WordPress/gutenberg/pull/66696))
+
+#### Block Editor
+- Fix ESLint warnings for the 'useInnerBlockTemplateSync' hook. ([68355](https://github.com/WordPress/gutenberg/pull/68355))
+- FontAppearanceControl: Deprecate 36px default size. ([67854](https://github.com/WordPress/gutenberg/pull/67854))
+- FontFamilyControl: Deprecate 36px default size. ([67853](https://github.com/WordPress/gutenberg/pull/67853))
+- Inserter: Use 40px default size for toggle button. ([68155](https://github.com/WordPress/gutenberg/pull/68155))
+- LineHeightControl: Deprecate 36px default size. ([67850](https://github.com/WordPress/gutenberg/pull/67850))
+
+#### Post Editor
+- DocumentTools: Use standard ToolbarButton for inserter. ([68332](https://github.com/WordPress/gutenberg/pull/68332))
+- Editor: Remove constants for notices. ([68361](https://github.com/WordPress/gutenberg/pull/68361))
+- Editor: Remove the 'content-only' check from 'TemplatePartConverterMenuItem'. ([67961](https://github.com/WordPress/gutenberg/pull/67961))
+
+#### DataViews
+- DataForm: Add unit tests. ([68054](https://github.com/WordPress/gutenberg/pull/68054))
+- DataForm: Remove `FormFieldVisibility`. ([68203](https://github.com/WordPress/gutenberg/pull/68203))
+- [DataView] Initial list of unit tests for the DataView component. ([68205](https://github.com/WordPress/gutenberg/pull/68205))
+
+#### Block Library
+- Columns: Replace some store selectors with 'getBlockOrder'. ([67991](https://github.com/WordPress/gutenberg/pull/67991))
+- Fix trailing spaces in navigation block classnames. ([68161](https://github.com/WordPress/gutenberg/pull/68161))
+
+#### Site Editor
+- Edit Site: Standardize reduced motion handling using media queries. ([68419](https://github.com/WordPress/gutenberg/pull/68419))
+
+#### Design Tools
+- Block Supports: Revert stabilization of typography, border, skip serialization and default controls supports. ([68163](https://github.com/WordPress/gutenberg/pull/68163))
+
+#### Zoom Out
+- Correct spelling in Zoom Out Inserters comment. ([68051](https://github.com/WordPress/gutenberg/pull/68051))
+
+#### Block API
+- Fail gracefully when block in `createBlock` function is not registered. ([68043](https://github.com/WordPress/gutenberg/pull/68043))
+
+#### Icons
+- Deprecate `warning` and rename to `cautionFilled`. ([67895](https://github.com/WordPress/gutenberg/pull/67895))
+
+
+### Tools
+
+#### Build Tooling
+- Add new private `upload-media` package. ([66290](https://github.com/WordPress/gutenberg/pull/66290))
+- Build: Simplify tsconfig.json files. ([68326](https://github.com/WordPress/gutenberg/pull/68326))
+- Clean script: Use braces instead of @-pattern for glob. ([67833](https://github.com/WordPress/gutenberg/pull/67833))
+- Fix VS Code performance. ([68347](https://github.com/WordPress/gutenberg/pull/68347))
+- Fix tsconfig for test/ directory. ([68346](https://github.com/WordPress/gutenberg/pull/68346))
+- Fix: Script with glob option doesn't work on Windows. ([67862](https://github.com/WordPress/gutenberg/pull/67862))
+
+#### Testing
+- Page - Quick Edit: Add end-to-end tests. ([68151](https://github.com/WordPress/gutenberg/pull/68151))
+- Add ESLint rule to prevent usage of the verb 'toggle' in translatable strings. ([67741](https://github.com/WordPress/gutenberg/pull/67741))
+- Enhance template registration end-to-end tests to handle welcome dialog visibility. ([68059](https://github.com/WordPress/gutenberg/pull/68059))
+
+
+### Various
+
+- ActionItem.Slot: Render as `MenuGroup` by default. ([67985](https://github.com/WordPress/gutenberg/pull/67985))
+- Storybook: Add BlockAlignmentMatrixControl Stories and update README. ([68007](https://github.com/WordPress/gutenberg/pull/68007))
+- Update "Call to Action" to "Call to action". ([67876](https://github.com/WordPress/gutenberg/pull/67876))
+
+#### Plugin
+- Assets: Add README.md about syncing. ([68128](https://github.com/WordPress/gutenberg/pull/68128))
+- Workflows: Sync assets to plugin repo upon change in trunk. ([68052](https://github.com/WordPress/gutenberg/pull/68052))
+
+
+## First-time contributors
+
+The following PRs were merged by first-time contributors:
+
+- @benazeer-ben: Add command to navigate to site editor. ([66722](https://github.com/WordPress/gutenberg/pull/66722))
+- @dhruvikpatel18: Fixed typo in README of TextTransformControl. ([68443](https://github.com/WordPress/gutenberg/pull/68443))
+- @fushar: Stylebook: Add the Appearance -> Design submenu through `admin_menu` action. ([68174](https://github.com/WordPress/gutenberg/pull/68174))
+- @im3dabasia: Storybook : Add TextTransformControl stories. ([67365](https://github.com/WordPress/gutenberg/pull/67365))
+- @justlevine: fix: Deprecated `WP_Webfonts()` constructor takes no arguments. ([66700](https://github.com/WordPress/gutenberg/pull/66700))
+- @karthick-murugan: Latest Posts Border Block Support. ([66353](https://github.com/WordPress/gutenberg/pull/66353))
+- @mayurprajapatii: Updated Document URL in Documentation. ([67990](https://github.com/WordPress/gutenberg/pull/67990))
+- @PARTHVATALIYA: Widget Editor: Fix: Close button is not working. ([65443](https://github.com/WordPress/gutenberg/pull/65443))
+- @prasadkarmalkar: Replace PanelBody with ToolsPanel and ToolsPanelItem in column block. ([67913](https://github.com/WordPress/gutenberg/pull/67913))
+- @rilwis: Fix wrong `npm start` command. ([65221](https://github.com/WordPress/gutenberg/pull/65221))
+- @sarthaknagoshe2002: Clarify template property behavior in InnerBlocks documentation to specify prefill when empty. ([66911](https://github.com/WordPress/gutenberg/pull/66911))
+- @timse201: Split upload into verbs and nouns. ([68227](https://github.com/WordPress/gutenberg/pull/68227))
+- @vampdroid: Add text domain option while scaffolding the block in create-block. ([57197](https://github.com/WordPress/gutenberg/pull/57197))
+
+
+## Contributors
+
+The following contributors merged PRs in this release:
+
+@aaronrobertshaw @afercia @akasunil @benazeer-ben @bph @Chrico @ciampo @d-alleyne @DAreRodz @dhruvikpatel18 @draganescu @ellatrix @fabiankaegy @fushar @getdave @gigitux @gziolo @hbhalodia @himanshupathak95 @im3dabasia @Infinite-Null @jameskoster @jasmussen @jeryj @jorgefilipecosta @jsnajdr @juanfra @justlevine @karthick-murugan @kmanijak @louwie17 @Lovor01 @Mamaduka @manzoorwanijk @matiasbenedetto @Mayank-Tripathi32 @mayurprajapatii @mcsf @michalczaplinski @mikachan @mirka @ntsekouras @oandregal @ockham @PARTHVATALIYA @prasadkarmalkar @ramonjd @rilwis @rinkalpagdar @Rishit30G @rohitmathur-7 @SainathPoojary @sarthaknagoshe2002 @SH4LIN @shail-mehta @shimotmk @sirreal @stokesman @Sukhendu2002 @swissspidy @t-hamano @talldan @tellthemachines @timse201 @tyxla @up1512001 @vampdroid @Vrishabhsk @yogeshbhutkar @youknowriad
+
+
= 19.9.0 =
## Changelog
diff --git a/gutenberg.php b/gutenberg.php
index 29cd0f63b4077..f736359a8b357 100644
--- a/gutenberg.php
+++ b/gutenberg.php
@@ -5,7 +5,7 @@
* Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality.
* Requires at least: 6.6
* Requires PHP: 7.2
- * Version: 19.9.0
+ * Version: 20.0.0-rc.1
* Author: Gutenberg Team
* Text Domain: gutenberg
*
diff --git a/lib/block-supports/block-style-variations.php b/lib/block-supports/block-style-variations.php
index b1f3243bfd04d..5f7d02007ed39 100644
--- a/lib/block-supports/block-style-variations.php
+++ b/lib/block-supports/block-style-variations.php
@@ -273,7 +273,7 @@ function gutenberg_enqueue_block_style_variation_styles() {
}
// Add Gutenberg filters and action.
-add_filter( 'render_block_data', 'gutenberg_render_block_style_variation_support_styles', 10, 2 );
+add_filter( 'render_block_data', 'gutenberg_render_block_style_variation_support_styles' );
add_filter( 'render_block', 'gutenberg_render_block_style_variation_class_name', 10, 2 );
add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_block_style_variation_styles', 1 );
diff --git a/lib/experimental/kses-allowed-html.php b/lib/experimental/kses-allowed-html.php
index 122faef7b4ca2..9a4f2e7c614b8 100644
--- a/lib/experimental/kses-allowed-html.php
+++ b/lib/experimental/kses-allowed-html.php
@@ -40,4 +40,4 @@ function gutenberg_kses_allowed_html( $allowedtags ) {
);
return $allowedtags;
}
-add_filter( 'wp_kses_allowed_html', 'gutenberg_kses_allowed_html', 10, 2 );
+add_filter( 'wp_kses_allowed_html', 'gutenberg_kses_allowed_html' );
diff --git a/lib/rest-api.php b/lib/rest-api.php
index 424927acf1f4a..783abc24d3ee3 100644
--- a/lib/rest-api.php
+++ b/lib/rest-api.php
@@ -26,7 +26,7 @@ function gutenberg_override_global_styles_endpoint( array $args ): array {
return $args;
}
-add_filter( 'register_wp_global_styles_post_type_args', 'gutenberg_override_global_styles_endpoint', 10, 2 );
+add_filter( 'register_wp_global_styles_post_type_args', 'gutenberg_override_global_styles_endpoint' );
/**
* Registers the Edit Site Export REST API routes.
diff --git a/package-lock.json b/package-lock.json
index 06e8c147a3e0e..20c4950b3d732 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "gutenberg",
- "version": "19.9.0",
+ "version": "20.0.0-rc.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gutenberg",
- "version": "19.9.0",
+ "version": "20.0.0-rc.1",
"hasInstallScript": true,
"license": "GPL-2.0-or-later",
"workspaces": [
diff --git a/package.json b/package.json
index 8d90f3cbda43f..58a99ada7308a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
- "version": "19.9.0",
+ "version": "20.0.0-rc.1",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
diff --git a/packages/blocks/src/api/factory.js b/packages/blocks/src/api/factory.js
index 25bf64ca65dc9..5eacf96fb1e5b 100644
--- a/packages/blocks/src/api/factory.js
+++ b/packages/blocks/src/api/factory.js
@@ -17,6 +17,7 @@ import {
getGroupingBlockName,
} from './registration';
import {
+ isBlockRegistered,
normalizeBlockType,
__experimentalSanitizeBlockAttributes,
} from './utils';
@@ -31,6 +32,14 @@ import {
* @return {Object} Block object.
*/
export function createBlock( name, attributes = {}, innerBlocks = [] ) {
+ if ( ! isBlockRegistered( name ) ) {
+ return createBlock( 'core/missing', {
+ originalName: name,
+ originalContent: '',
+ originalUndelimitedContent: '',
+ } );
+ }
+
const sanitizedAttributes = __experimentalSanitizeBlockAttributes(
name,
attributes
@@ -94,15 +103,22 @@ export function __experimentalCloneSanitizedBlock(
mergeAttributes = {},
newInnerBlocks
) {
+ const { name } = block;
+
+ if ( ! isBlockRegistered( name ) ) {
+ return createBlock( 'core/missing', {
+ originalName: name,
+ originalContent: '',
+ originalUndelimitedContent: '',
+ } );
+ }
+
const clientId = uuid();
- const sanitizedAttributes = __experimentalSanitizeBlockAttributes(
- block.name,
- {
- ...block.attributes,
- ...mergeAttributes,
- }
- );
+ const sanitizedAttributes = __experimentalSanitizeBlockAttributes( name, {
+ ...block.attributes,
+ ...mergeAttributes,
+ } );
return {
...block,
@@ -583,20 +599,11 @@ export function switchToBlockType( blocks, name ) {
*
* @return {Object} block.
*/
-export const getBlockFromExample = ( name, example ) => {
- try {
- return createBlock(
- name,
- example.attributes,
- ( example.innerBlocks ?? [] ).map( ( innerBlock ) =>
- getBlockFromExample( innerBlock.name, innerBlock )
- )
- );
- } catch {
- return createBlock( 'core/missing', {
- originalName: name,
- originalContent: '',
- originalUndelimitedContent: '',
- } );
- }
-};
+export const getBlockFromExample = ( name, example ) =>
+ createBlock(
+ name,
+ example.attributes,
+ ( example.innerBlocks ?? [] ).map( ( innerBlock ) =>
+ getBlockFromExample( innerBlock.name, innerBlock )
+ )
+ );
diff --git a/packages/blocks/src/api/templates.js b/packages/blocks/src/api/templates.js
index 71231121362a4..6f7e13f27ebe8 100644
--- a/packages/blocks/src/api/templates.js
+++ b/packages/blocks/src/api/templates.js
@@ -109,23 +109,12 @@ export function synchronizeBlocksWithTemplate( blocks = [], template ) {
attributes
);
- let [ blockName, blockAttributes ] =
+ const [ blockName, blockAttributes ] =
convertLegacyBlockNameAndAttributes(
name,
normalizedAttributes
);
- // If a Block is undefined at this point, use the core/missing block as
- // a placeholder for a better user experience.
- if ( undefined === getBlockType( blockName ) ) {
- blockAttributes = {
- originalName: name,
- originalContent: '',
- originalUndelimitedContent: '',
- };
- blockName = 'core/missing';
- }
-
return createBlock(
blockName,
blockAttributes,
diff --git a/packages/blocks/src/api/test/utils.js b/packages/blocks/src/api/test/utils.js
index 548bbb27da388..b1906b65b4208 100644
--- a/packages/blocks/src/api/test/utils.js
+++ b/packages/blocks/src/api/test/utils.js
@@ -12,6 +12,7 @@ import {
isUnmodifiedDefaultBlock,
getAccessibleBlockLabel,
getBlockLabel,
+ isBlockRegistered,
__experimentalSanitizeBlockAttributes,
getBlockAttributesNamesByRole,
isContentBlock,
@@ -213,6 +214,20 @@ describe( 'getAccessibleBlockLabel', () => {
} );
} );
+describe( 'isBlockRegistered', () => {
+ it( 'returns true if the block is registered', () => {
+ registerBlockType( 'core/test-block', { title: 'Test block' } );
+ expect( isBlockRegistered( 'core/test-block' ) ).toBe( true );
+ unregisterBlockType( 'core/test-block' );
+ } );
+
+ it( 'returns false if the block is not registered', () => {
+ expect( isBlockRegistered( 'core/not-registered-test-block' ) ).toBe(
+ false
+ );
+ } );
+} );
+
describe( 'sanitizeBlockAttributes', () => {
afterEach( () => {
getBlockTypes().forEach( ( block ) => {
diff --git a/packages/blocks/src/api/utils.js b/packages/blocks/src/api/utils.js
index 73c34ab3499d6..ad94d9d5c9e0c 100644
--- a/packages/blocks/src/api/utils.js
+++ b/packages/blocks/src/api/utils.js
@@ -266,6 +266,17 @@ export function getDefault( attributeSchema ) {
}
}
+/**
+ * Check if a block is registered.
+ *
+ * @param {string} name The block's name.
+ *
+ * @return {boolean} Whether the block is registered.
+ */
+export function isBlockRegistered( name ) {
+ return getBlockType( name ) !== undefined;
+}
+
/**
* Ensure attributes contains only values defined by block type, and merge
* default values for missing attributes.
diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 9784a65102795..8c710eb93a9ee 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -28,6 +28,7 @@
- Add new `Badge` component ([#66555](https://github.com/WordPress/gutenberg/pull/66555)).
- `Menu`: refactor to more granular sub-components ([#67422](https://github.com/WordPress/gutenberg/pull/67422)).
+- `Badge`: Support text truncation ([#68107](https://github.com/WordPress/gutenberg/pull/68107)).
### Internal
diff --git a/packages/components/src/badge/index.tsx b/packages/components/src/badge/index.tsx
index 8a55f3881215f..ee08003c3911d 100644
--- a/packages/components/src/badge/index.tsx
+++ b/packages/components/src/badge/index.tsx
@@ -56,9 +56,10 @@ function Badge( {
icon={ contextBasedIcon() }
size={ 16 }
fill="currentColor"
+ className="components-badge__icon"
/>
) }
- { children }
+ { children }
);
}
diff --git a/packages/components/src/badge/styles.scss b/packages/components/src/badge/styles.scss
index e1e9cd5312d11..d3f82482cf774 100644
--- a/packages/components/src/badge/styles.scss
+++ b/packages/components/src/badge/styles.scss
@@ -6,17 +6,18 @@ $badge-colors: (
);
.components-badge {
+ @include reset;
+
background-color: color-mix(in srgb, $white 90%, var(--base-color));
color: color-mix(in srgb, $black 50%, var(--base-color));
padding: 0 $grid-unit-10;
min-height: $grid-unit-30;
+ max-width: 100%;
border-radius: $radius-small;
font-size: $font-size-small;
font-weight: 400;
- flex-shrink: 0;
line-height: $font-line-height-small;
- width: fit-content;
- display: flex;
+ display: inline-flex;
align-items: center;
gap: 2px;
@@ -36,3 +37,13 @@ $badge-colors: (
}
}
}
+
+.components-badge__icon {
+ flex-shrink: 0;
+}
+
+.components-badge__content {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
diff --git a/packages/components/src/badge/test/index.tsx b/packages/components/src/badge/test/index.tsx
index 47c832eb3c830..114a8f426c7af 100644
--- a/packages/components/src/badge/test/index.tsx
+++ b/packages/components/src/badge/test/index.tsx
@@ -6,12 +6,17 @@ import { render, screen } from '@testing-library/react';
/**
* Internal dependencies
*/
-import Badge from '..';
+import _Badge from '..';
+
+const testid = 'my-badge';
+const Badge = ( props: React.ComponentProps< typeof _Badge > ) => (
+ <_Badge data-testid={ testid } { ...props } />
+);
describe( 'Badge', () => {
it( 'should render correctly with default props', () => {
render( Code is Poetry );
- const badge = screen.getByText( 'Code is Poetry' );
+ const badge = screen.getByTestId( testid );
expect( badge ).toBeInTheDocument();
expect( badge.tagName ).toBe( 'SPAN' );
expect( badge ).toHaveClass( 'components-badge' );
@@ -19,14 +24,14 @@ describe( 'Badge', () => {
it( 'should render as per its intent and contain an icon', () => {
render( Code is Poetry );
- const badge = screen.getByText( 'Code is Poetry' );
+ const badge = screen.getByTestId( testid );
expect( badge ).toHaveClass( 'components-badge', 'is-error' );
expect( badge ).toHaveClass( 'has-icon' );
} );
it( 'should combine custom className with default class', () => {
render( Code is Poetry );
- const badge = screen.getByText( 'Code is Poetry' );
+ const badge = screen.getByTestId( testid );
expect( badge ).toHaveClass( 'components-badge' );
expect( badge ).toHaveClass( 'custom-class' );
} );
diff --git a/packages/create-block-interactive-template/plugin-templates/$slug.php.mustache b/packages/create-block-interactive-template/plugin-templates/$slug.php.mustache
index 48469aa7d0d93..cb7f45b720794 100644
--- a/packages/create-block-interactive-template/plugin-templates/$slug.php.mustache
+++ b/packages/create-block-interactive-template/plugin-templates/$slug.php.mustache
@@ -8,8 +8,12 @@
* Description: {{description}}
{{/description}}
* Version: {{version}}
- * Requires at least: 6.6
- * Requires PHP: 7.2
+{{#requiresAtLeast}}
+ * Requires at least: {{requiresAtLeast}}
+{{/requiresAtLeast}}
+{{#requiresPHP}}
+ * Requires PHP: {{requiresPHP}}
+{{/requiresPHP}}
{{#author}}
* Author: {{author}}
{{/author}}
diff --git a/packages/create-block-interactive-template/plugin-templates/readme.txt.mustache b/packages/create-block-interactive-template/plugin-templates/readme.txt.mustache
index c3abf5ae4ec02..19a4c8e78587b 100644
--- a/packages/create-block-interactive-template/plugin-templates/readme.txt.mustache
+++ b/packages/create-block-interactive-template/plugin-templates/readme.txt.mustache
@@ -3,7 +3,9 @@
Contributors: {{author}}
{{/author}}
Tags: block
-Tested up to: 6.6
+{{#testedUpTo}}
+Tested up to: {{testedUpTo}}
+{{/testedUpTo}}
Stable tag: {{version}}
{{#license}}
License: {{license}}
diff --git a/packages/create-block-tutorial-template/plugin-templates/$slug.php.mustache b/packages/create-block-tutorial-template/plugin-templates/$slug.php.mustache
index 7ce4be3f7cc73..49959fb5b2f69 100644
--- a/packages/create-block-tutorial-template/plugin-templates/$slug.php.mustache
+++ b/packages/create-block-tutorial-template/plugin-templates/$slug.php.mustache
@@ -8,8 +8,12 @@
* Description: {{description}}
{{/description}}
* Version: {{version}}
- * Requires at least: 6.6
- * Requires PHP: 7.2
+{{#requiresAtLeast}}
+ * Requires at least: {{requiresAtLeast}}
+{{/requiresAtLeast}}
+{{#requiresPHP}}
+ * Requires PHP: {{requiresPHP}}
+{{/requiresPHP}}
{{#author}}
* Author: {{author}}
{{/author}}
diff --git a/packages/create-block-tutorial-template/plugin-templates/readme.txt.mustache b/packages/create-block-tutorial-template/plugin-templates/readme.txt.mustache
index c3abf5ae4ec02..19a4c8e78587b 100644
--- a/packages/create-block-tutorial-template/plugin-templates/readme.txt.mustache
+++ b/packages/create-block-tutorial-template/plugin-templates/readme.txt.mustache
@@ -3,7 +3,9 @@
Contributors: {{author}}
{{/author}}
Tags: block
-Tested up to: 6.6
+{{#testedUpTo}}
+Tested up to: {{testedUpTo}}
+{{/testedUpTo}}
Stable tag: {{version}}
{{#license}}
License: {{license}}
diff --git a/packages/create-block/CHANGELOG.md b/packages/create-block/CHANGELOG.md
index e109e36ccbd79..9ed6c9f439706 100644
--- a/packages/create-block/CHANGELOG.md
+++ b/packages/create-block/CHANGELOG.md
@@ -5,6 +5,8 @@
### Enhancement
- Add support for custom `textdomain` property for the scaffolded block ([#57197](https://github.com/WordPress/gutenberg/pull/57197)).
+- Allow external templates to customize additional plugin header and readme fields: "Requires at least", "Requires PHP", and "Tested up to" ([#68193](https://github.com/WordPress/gutenberg/pull/68193))
+- Update the default template to scaffold a block in its subfolder to make it easier to update to multiple blocks in a single plugin ([#68175](https://github.com/WordPress/gutenberg/pull/68175)).
### Internal
diff --git a/packages/create-block/docs/external-template.md b/packages/create-block/docs/external-template.md
index 45c3cba8c9271..d840896f266f3 100644
--- a/packages/create-block/docs/external-template.md
+++ b/packages/create-block/docs/external-template.md
@@ -76,10 +76,13 @@ The following configurable variables are used with the template files. Template
- `npmDevDependencies` (default: `[]`) – the list of remote npm packages to be installed in the project with [`npm install --save-dev`](https://docs.npmjs.com/cli/v8/commands/npm-install) when `wpScripts` is enabled.
- `customPackageJSON` (no default) - allows definition of additional properties for the generated package.json file.
-**Plugin header fields** ([learn more](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/)):
+**Plugin header and readme fields** (learn more about [header requirements](https://developer.wordpress.org/plugins/plugin-basics/header-requirements/) and [readmes](https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/)):
- `pluginURI` (no default) – the home page of the plugin.
- `version` (default: `'0.1.0'`) – the current version number of the plugin.
+- `requiresAtLeast` (default: `'6.7'`) – the lowest WordPress version that the plugin will work on.
+- `requiresPHP` (default: `'7.4'`) – the minimum required PHP version for use with this plugin.
+- `testedUpTo` (default: `'6.7'`) – the highest WordPress version that the plugin has been tested against.
- `author` (default: `'The WordPress Contributors'`) – the name of the plugin author(s).
- `license` (default: `'GPL-2.0-or-later'`) – the short name of the plugin’s license.
- `licenseURI` (default: `'https://www.gnu.org/licenses/gpl-2.0.html'`) – a link to the full text of the license.
@@ -97,6 +100,7 @@ The following configurable variables are used with the template files. Template
- `description` (no default) – a short description for your block.
- `dashicon` (no default) – an icon property thats makes it easier to identify a block ([available values](https://developer.wordpress.org/resource/dashicons/)).
- `category` (default: `'widgets'`) – blocks are grouped into categories to help users browse and discover them. The categories provided by core are `text`, `media`, `design`, `widgets`, `theme`, and `embed`.
+- `textdomain` (defaults to the `slug` value) – the text domain used to make strings translatable ([more info](https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#text-domains)).
- `attributes` (no default) – block attributes ([more details](https://developer.wordpress.org/block-editor/developers/block-api/block-attributes/)).
- `supports` (no default) – optional block extended support features ([more details](https://developer.wordpress.org/block-editor/developers/block-api/block-supports/).
- `editorScript` (default: `'file:./index.js'`) – an editor script definition.
diff --git a/packages/create-block/lib/scaffold.js b/packages/create-block/lib/scaffold.js
index bc7cb3b8bfcd3..44812e3d5954d 100644
--- a/packages/create-block/lib/scaffold.js
+++ b/packages/create-block/lib/scaffold.js
@@ -36,6 +36,9 @@ module.exports = async (
domainPath,
updateURI,
version,
+ requiresAtLeast,
+ requiresPHP,
+ testedUpTo,
wpScripts,
wpEnv,
npmDependencies,
@@ -58,13 +61,12 @@ module.exports = async (
}
) => {
slug = slug.toLowerCase();
- namespace = namespace.toLowerCase();
const rootDirectory = join( process.cwd(), targetDir || slug );
const transformedValues = transformer( {
$schema,
apiVersion,
plugin,
- namespace,
+ namespace: namespace.toLowerCase(),
slug,
title,
description,
@@ -79,12 +81,15 @@ module.exports = async (
domainPath,
updateURI,
version,
+ requiresAtLeast,
+ requiresPHP,
+ testedUpTo,
wpScripts,
wpEnv,
npmDependencies,
npmDevDependencies,
customScripts,
- folderName,
+ folderName: folderName.replace( /\$slug/g, slug ),
editorScript,
editorStyle,
style,
diff --git a/packages/create-block/lib/templates.js b/packages/create-block/lib/templates.js
index db78ee80aa429..3604ac99a35ea 100644
--- a/packages/create-block/lib/templates.js
+++ b/packages/create-block/lib/templates.js
@@ -59,6 +59,7 @@ const predefinedPluginTemplates = {
},
viewScript: 'file:./view.js',
example: {},
+ folderName: './src/$slug',
},
variants: {
static: {},
@@ -236,6 +237,9 @@ const getDefaultValues = ( projectTemplate, variant ) => {
license: 'GPL-2.0-or-later',
licenseURI: 'https://www.gnu.org/licenses/gpl-2.0.html',
version: '0.1.0',
+ requiresAtLeast: '6.7',
+ requiresPHP: '7.4',
+ testedUpTo: '6.7',
wpScripts: true,
customScripts: {},
wpEnv: false,
diff --git a/packages/create-block/lib/templates/es5/$slug.php.mustache b/packages/create-block/lib/templates/es5/$slug.php.mustache
index 825fd1bfd8b5a..5beb2ca06712c 100644
--- a/packages/create-block/lib/templates/es5/$slug.php.mustache
+++ b/packages/create-block/lib/templates/es5/$slug.php.mustache
@@ -7,9 +7,13 @@
{{#description}}
* Description: {{description}}
{{/description}}
- * Requires at least: 6.6
- * Requires PHP: 7.2
* Version: {{version}}
+{{#requiresAtLeast}}
+ * Requires at least: {{requiresAtLeast}}
+{{/requiresAtLeast}}
+{{#requiresPHP}}
+ * Requires PHP: {{requiresPHP}}
+{{/requiresPHP}}
{{#author}}
* Author: {{author}}
{{/author}}
diff --git a/packages/create-block/lib/templates/es5/readme.txt.mustache b/packages/create-block/lib/templates/es5/readme.txt.mustache
index c3abf5ae4ec02..19a4c8e78587b 100644
--- a/packages/create-block/lib/templates/es5/readme.txt.mustache
+++ b/packages/create-block/lib/templates/es5/readme.txt.mustache
@@ -3,7 +3,9 @@
Contributors: {{author}}
{{/author}}
Tags: block
-Tested up to: 6.6
+{{#testedUpTo}}
+Tested up to: {{testedUpTo}}
+{{/testedUpTo}}
Stable tag: {{version}}
{{#license}}
License: {{license}}
diff --git a/packages/create-block/lib/templates/plugin/$slug.php.mustache b/packages/create-block/lib/templates/plugin/$slug.php.mustache
index 75666af3a850b..e229560a655c3 100644
--- a/packages/create-block/lib/templates/plugin/$slug.php.mustache
+++ b/packages/create-block/lib/templates/plugin/$slug.php.mustache
@@ -7,9 +7,13 @@
{{#description}}
* Description: {{description}}
{{/description}}
- * Requires at least: 6.6
- * Requires PHP: 7.2
* Version: {{version}}
+{{#requiresAtLeast}}
+ * Requires at least: {{requiresAtLeast}}
+{{/requiresAtLeast}}
+{{#requiresPHP}}
+ * Requires PHP: {{requiresPHP}}
+{{/requiresPHP}}
{{#author}}
* Author: {{author}}
{{/author}}
@@ -42,6 +46,6 @@ if ( ! defined( 'ABSPATH' ) ) {
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
function {{namespaceSnakeCase}}_{{slugSnakeCase}}_block_init() {
- register_block_type( __DIR__ . '/build' );
+ register_block_type( __DIR__ . '/build/{{slug}}' );
}
add_action( 'init', '{{namespaceSnakeCase}}_{{slugSnakeCase}}_block_init' );
diff --git a/packages/create-block/lib/templates/plugin/readme.txt.mustache b/packages/create-block/lib/templates/plugin/readme.txt.mustache
index c3abf5ae4ec02..19a4c8e78587b 100644
--- a/packages/create-block/lib/templates/plugin/readme.txt.mustache
+++ b/packages/create-block/lib/templates/plugin/readme.txt.mustache
@@ -3,7 +3,9 @@
Contributors: {{author}}
{{/author}}
Tags: block
-Tested up to: 6.6
+{{#testedUpTo}}
+Tested up to: {{testedUpTo}}
+{{/testedUpTo}}
Stable tag: {{version}}
{{#license}}
License: {{license}}
diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md
index 60acec7de6461..7ed1d2439d2e1 100644
--- a/packages/scripts/CHANGELOG.md
+++ b/packages/scripts/CHANGELOG.md
@@ -2,6 +2,11 @@
## Unreleased
+### Enhancements
+
+- Recommend listing JavaScript entry points as paths passed to the `start` and `build` commands ([#68251](https://github.com/WordPress/gutenberg/pull/68251)).
+- Introduce a new option `--source-path` to customize the source directory used with the `start` and `build` commands ([#68251](https://github.com/WordPress/gutenberg/pull/68251)).
+
### Internal
- The bundled `rtlcss-webpack-plugin` dependency has been replaced with a modified fork of the plugin to fix issues with the original package ([#68201](https://github.com/WordPress/gutenberg/pull/68201)).
diff --git a/packages/scripts/README.md b/packages/scripts/README.md
index f86a4c6091c40..aaf4e03d8a060 100644
--- a/packages/scripts/README.md
+++ b/packages/scripts/README.md
@@ -46,10 +46,6 @@ _Example:_
It might also be a good idea to get familiar with the [JavaScript Build Setup tutorial](https://github.com/WordPress/gutenberg/tree/HEAD/docs/how-to-guides/javascript/js-build-setup.md) for setting up a development environment to use ESNext syntax. It gives a very in-depth explanation of how to use the [build](#build) and [start](#start) scripts.
-## Automatic block.json detection and the source code directory
-
-When using the `start` or `build` commands, the source code directory ( the default is `./src`) and its subdirectories are scanned for the existence of `block.json` files. If one or more are found, they are treated a entry points and will be output into corresponding folders in the `build` directory. This allows for the creation of multiple blocks that use a single build process. The source directory can be customized using the `--webpack-src-dir` flag and the output directory with the `--output-path` flag.
-
## Updating to New Release
To update an existing project to a new version of `@wordpress/scripts`, open the [changelog](https://github.com/WordPress/gutenberg/blob/HEAD/packages/scripts/CHANGELOG.md), find the version you’re currently on (check `package.json` in the top-level directory of your project), and apply the migration instructions for the newer versions.
@@ -66,19 +62,7 @@ Transforms your code according the configuration provided so it’s ready for pr
_This script exits after producing a single build. For incremental builds, better suited for development, see the [start](#start) script._
-The entry points for your project get detected by scanning all script fields in `block.json` files located in the `src` directory. The script fields in `block.json` should pass relative paths to `block.json` in the same folder.
-
-_Example:_
-
-```json
-{
- "editorScript": "file:index.js",
- "script": "file:script.js",
- "viewScript": "file:view.js"
-}
-```
-
-The fallback entry point is `src/index.js` (other supported extensions: `.jsx`, `.ts`, and `.tsx`) in case there is no `block.json` file found. In that scenario, the output generated will be written to `build/index.js`.
+#### Usage
_Example:_
@@ -88,7 +72,7 @@ _Example:_
"build": "wp-scripts build",
"build:custom": "wp-scripts build entry-one.js entry-two.js --output-path=custom",
"build:copy-php": "wp-scripts build --webpack-copy-php",
- "build:custom-directory": "wp-scripts build --webpack-src-dir=custom-directory"
+ "build:custom-directory": "wp-scripts build --source-path=custom-directory"
}
}
```
@@ -104,20 +88,21 @@ This script automatically use the optimized config but sometimes you may want to
- `--webpack-bundle-analyzer` – enables visualization for the size of webpack output files with an interactive zoomable treemap.
- `--webpack-copy-php` – enables copying all PHP files from the source directory ( default is `src` ) and its subfolders to the output directory.
-- `--webpack-no-externals` – disables scripts' assets generation, and omits the list of default externals.
-- `--webpack-src-dir` – Allows customization of the source code directory. Default is `src`.
-- `--output-path` – Allows customization of the output directory. Default is `build`.
+- `--webpack-no-externals` – disables scripts’ assets generation, and omits the list of default externals.
+- `--source-path` – allows customization of the source directory. The default is the project root `.` when [entry points are listed](#listing-entry-points) in the command, or `src` otherwise.
+- `--output-path` – allows customization of the output directory. The default is the `build` folder.
Experimental support for the block.json `viewScriptModule` field is available via the
`--experimental-modules` option. With this option enabled, script and module fields will all be
compiled. The `viewScriptModule` field is analogous to the `viewScript` field, but will compile a module
and should be registered in WordPress using the Modules API.
+Learn more about [using build scripts](#using-build-scripts) to optimize the development experience based on your specific needs.
+
#### Advanced information
This script uses [webpack](https://webpack.js.org/) behind the scenes. It’ll look for a webpack config in the top-level directory of your package and will use it if it finds one. If none is found, it’ll use the default config provided by `@wordpress/scripts` packages. Learn more in the [Advanced Usage](#advanced-usage) section.
-
### `build-blocks-manifest`
This script generates a PHP file containing block metadata from all
@@ -128,10 +113,12 @@ when registering multiple block types, as it allows you to use
Usage: `wp-scripts build-blocks-manifest [options]`
Options:
-- `--input`: Specify the input directory (default: 'build')
-- `--output`: Specify the output file path (default: 'build/blocks-manifest.php')
+
+- `--input`: Specify the input directory (default: 'build')
+- `--output`: Specify the output file path (default: 'build/blocks-manifest.php')
Example:
+
```bash
wp-scripts build-blocks-manifest --input=src --output=dist/blocks-manifest.php
```
@@ -382,8 +369,8 @@ This is how you create a custom root folder inside the zip file.
- When updating a plugin, WordPress expects a folder in the root of the zip file which matches the plugin name. So be aware that this may affect the plugin update process.
- `--root-folder` - Add a custom root folder to the zip file.
-- `npm run plugin-zip` - By default, unzipping your plugin's zip file will result in a folder with the same name as your plugin.
-- `npm run plugin-zip --root-folder='custom-directory'` - Your plugin's zip file will be unzipped into a folder named `custom-directory`.
+- `npm run plugin-zip` - By default, unzipping your plugin’s zip file will result in a folder with the same name as your plugin.
+- `npm run plugin-zip --root-folder='custom-directory'` - Your plugin’s zip file will be unzipped into a folder named `custom-directory`.
- `npm run plugin-zip --no-root-folder` - This will create a zip file that has no folder inside, your plugin files will be unzipped directly into the target directory.
### `start`
@@ -392,19 +379,7 @@ Transforms your code according the configuration provided so it’s ready for de
_For single builds, better suited for production, see the [build](#build) script._
-The entry points for your project get detected by scanning all script fields in `block.json` files located in the `src` directory. The script fields in `block.json` should pass relative paths to `block.json` in the same folder.
-
-_Example:_
-
-```json
-{
- "editorScript": "file:index.js",
- "script": "file:script.js",
- "viewScript": "file:view.js"
-}
-```
-
-The fallback entry point is `src/index.js` (other supported extensions: `.jsx`, `.ts`, and `.tsx`) in case there is no `block.json` file found. In that scenario, the output generated will be written to `build/index.js`.
+#### Usage
_Example:_
@@ -415,7 +390,7 @@ _Example:_
"start:hot": "wp-scripts start --hot",
"start:custom": "wp-scripts start entry-one.js entry-two.js --output-path=custom",
"start:copy-php": "wp-scripts start --webpack-copy-php",
- "start:custom-directory": "wp-scripts start --webpack-src-dir=custom-directory"
+ "start:custom-directory": "wp-scripts start --source-path=custom-directory"
}
}
```
@@ -435,15 +410,17 @@ This script automatically use the optimized config but sometimes you may want to
- `--webpack-bundle-analyzer` – enables visualization for the size of webpack output files with an interactive zoomable treemap.
- `--webpack-copy-php` – enables copying all PHP files from the source directory ( default is `src` ) and its subfolders to the output directory.
- `--webpack-devtool` – controls how source maps are generated. See options at https://webpack.js.org/configuration/devtool/#devtool.
-- `--webpack-no-externals` – disables scripts' assets generation, and omits the list of default externals.
-- `--webpack-src-dir` – Allows customization of the source code directory. Default is `src`.
-- `--output-path` – Allows customization of the output directory. Default is `build`.
+- `--webpack-no-externals` – disables scripts’ assets generation, and omits the list of default externals.
+- `--source-path` – allows customization of the source directory. The default is the project root `.` when [entry points are listed](#listing-entry-points) in the command, or `src` otherwise.
+- `--output-path` – allows customization of the output directory. The default is the `build` folder.
Experimental support for the block.json `viewScriptModule` field is available via the
`--experimental-modules` option. With this option enabled, script and module fields will all be
compiled. The `viewScriptModule` field is analogous to the `viewScript` field, but will compile a module
and should be registered in WordPress using the Modules API.
+Learn more about [using build scripts](#using-build-scripts) to optimize the development experience based on your specific needs.
+
#### Advanced information
This script uses [webpack](https://webpack.js.org/) behind the scenes. It’ll look for a webpack config in the top-level directory of your package and will use it if it finds one. If none is found, it’ll use the default config provided by `@wordpress/scripts` packages. Learn more in the [Advanced Usage](#advanced-usage) section.
@@ -492,7 +469,7 @@ We enforce that all tests run serially in the current process using [--runInBand
When tests fail, both a screenshot and an HTML snapshot will be taken of the page and stored in the `artifacts/` directory at the root of your project. These snapshots may help debug failed tests during development or when running tests in a CI environment.
-The `artifacts/` directory can be customized by setting the `WP_ARTIFACTS_PATH` environment variable to the relative path of the desired directory within your project's root. For example: to change the default directory from `artifacts/` to `my/custom/artifacts`, you could use `WP_ARTIFACTS_PATH=my/custom/artifacts npm run test:e2e`.
+The `artifacts/` directory can be customized by setting the `WP_ARTIFACTS_PATH` environment variable to the relative path of the desired directory within your project’s root. For example: to change the default directory from `artifacts/` to `my/custom/artifacts`, you could use `WP_ARTIFACTS_PATH=my/custom/artifacts npm run test:e2e`.
#### Advanced information
@@ -581,11 +558,11 @@ To do so, you can add a file called `playwright.config.ts` or `playwright.config
When tests fail, snapshots will be taken of the page and stored in the `artifacts/` directory at the root of your project. These snapshots may help debug failed tests during development or when running tests in a CI environment.
-The `artifacts/` directory can be customized by setting the `WP_ARTIFACTS_PATH` environment variable to the relative path of the desired directory within your project's root. For example: to change the default directory from `artifacts/` to `my/custom/artifacts`, you could use `WP_ARTIFACTS_PATH=my/custom/artifacts npm run test:playwright`.
+The `artifacts/` directory can be customized by setting the `WP_ARTIFACTS_PATH` environment variable to the relative path of the desired directory within your project’s root. For example: to change the default directory from `artifacts/` to `my/custom/artifacts`, you could use `WP_ARTIFACTS_PATH=my/custom/artifacts npm run test:playwright`.
#### Advanced information
-You are able to use all of Playwright's [CLI options](https://playwright.dev/docs/test-cli#reference). You can also run `./node_modules/.bin/wp-scripts test-playwright --help` or `npm run test:playwright:help` (as mentioned above) to view all the available options. Learn more in the [Advanced Usage](#advanced-usage) section.
+You are able to use all of Playwright’s [CLI options](https://playwright.dev/docs/test-cli#reference). You can also run `./node_modules/.bin/wp-scripts test-playwright --help` or `npm run test:playwright:help` (as mentioned above) to view all the available options. Learn more in the [Advanced Usage](#advanced-usage) section.
## Passing Node.js options
@@ -639,30 +616,49 @@ To also debug the browser context, run `wp-scripts --inspect-brk test-e2e --pupp
For more e2e debugging tips check out the [Puppeteer debugging docs](https://developers.google.com/web/tools/puppeteer/debugging).
-## Advanced Usage
+## Using build scripts
-In general, this package should be used with the set of recommended config files. While it’s possible to override every single config file provided, if you have to do it, it means that your use case is far more complicated than anticipated. If that happens, it would be better to avoid using the whole abstraction layer and set up your project with full control over tooling used.
+The `build` and `start` commands use [webpack](https://webpack.js.org/) behind the scenes. webpack is used to bundle and optimize code for web applications, enabling developers to manage dependencies efficiently, enhance performance, and simplify the development workflow.
-### Working with build scripts
+### Listing entry points
-The `build` and `start` commands use [webpack](https://webpack.js.org/) behind the scenes. webpack is a tool that helps you transform your code into something else. For example: it can take code written in ESNext and output ES5 compatible code that is minified for production.
+The simplest way to list JavaScript entry points is to pass them as arguments for the command.
-#### Default webpack config
+_Example:_
-`@wordpress/scripts` bundles the default webpack config used as a base by the WordPress editor. These are the defaults:
+```bash
+wp-scripts build entry-one.js entry-two.js
+```
-- [Entry](https://webpack.js.org/configuration/entry-context/#entry): the entry points for your project get detected by scanning all script fields in `block.json` files located in the `src` directory. The fallback entry point is `src/index.js` (other supported extensions: `.jsx`, `.ts`, and `.tsx`) in case there is no `block.json` file found.
-- [Output](https://webpack.js.org/configuration/output): `build/[name].js`, for example: `build/index.js`, or `build/my-block/index.js`.
-- [Loaders](https://webpack.js.org/loaders/):
- - [`babel-loader`](https://webpack.js.org/loaders/babel-loader/) allows transpiling JavaScript and TypeScript files using Babel and webpack.
- - [`@svgr/webpack`](https://www.npmjs.com/package/@svgr/webpack) and [`url-loader`](https://webpack.js.org/loaders/url-loader/) makes it possible to handle SVG files in JavaScript code.
- - [`css-loader`](https://webpack.js.org/loaders/css-loader/) chained with [`postcss-loader`](https://webpack.js.org/loaders/postcss-loader/) and [sass-loader](https://webpack.js.org/loaders/sass-loader/) let webpack process CSS, SASS or SCSS files referenced in JavaScript files.
-- [Plugins](https://webpack.js.org/configuration/plugins) (among others):
- - [`CopyWebpackPlugin`](https://webpack.js.org/plugins/copy-webpack-plugin/) copies all `block.json` files discovered in the `src` directory to the build directory.
- - [`MiniCssExtractPlugin`](https://webpack.js.org/plugins/mini-css-extract-plugin/) extracts CSS into separate files. It creates a CSS file per JavaScript entry point which contains CSS.
- - [`@wordpress/dependency-extraction-webpack-plugin`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/dependency-extraction-webpack-plugin/README.md) is used with the default configuration to ensure that WordPress provided scripts are not included in the built bundle.
+The default location for the source files is the project’s root. In effect, the command above will look for `entry-one.js` and `entry-two.js` in the project’s root and output the generated files into the `build` directory.
+
+### Automatic block.json detection and the source code directory
-#### Using CSS
+A convenient alternative for blocks is using automatic entry point detection. In that case, the source code directory (the default is `./src`) and its subdirectories are scanned for the existence of `block.json` files. If one or more are found, the JavaScript files listed in metadata are treated as entry points and will be output into corresponding folders in the `build` directory. The script fields in `block.json` should pass relative paths to `block.json` in the same folder.
+
+_Example:_
+
+```json
+{
+ "editorScript": "file:index.js",
+ "script": "file:script.js",
+ "viewScript": "file:view.js"
+}
+```
+
+This allows for the creation of multiple blocks that use a single build process triggered with a simple command:
+
+```bash
+wp-scripts build
+```
+
+The source directory can be customized using the `--source-path` flag and the output directory with the `--output-path` flag.
+
+### Fallback entry point
+
+The fallback entry point is `src/index.js` (other supported extensions: `.jsx`, `.ts`, and `.tsx`) in case there is no `block.json` file found. In that scenario, the output generated will be written to `build/index.js`.
+
+### Importing styles in JavaScript
_Example:_
@@ -694,19 +690,19 @@ When you run the build using the default command `wp-scripts build` (also applie
1. `index.css` – all imported CSS files are bundled into one chunk named after the entry point, which defaults to `index.js`, and thus the file created becomes `index.css`. This is for styles used only in the editor.
2. `style-index.css` – imported `style.css` file(s) (applies to PCSS, SASS and SCSS extensions) get bundled into one `style-index.css` file that is meant to be used both on the front-end and in the editor.
-You can also have multiple entry points as described in the docs for the script:
+For example, when the project has two entry points:
```bash
-wp-scripts start entry-one.js entry-two.js --output-path=custom
+wp-scripts build entry-one.js entry-two.js
```
-If you do so, then CSS files generated will follow the names of the entry points: `entry-one.css` and `entry-two.css`.
+In that case, the CSS generated based on import statements in the JavaScript code will follow the names of the entry points: `entry-one.css` and `entry-two.css`.
-Avoid using `style` keyword in an entry point name, this might break your build process.
+_Important:_ Avoid using `style` keyword in an entry point name, this might break your build process.
You can also bundle CSS modules by prefixing `.module` to the extension, e.g. `style.module.scss`. Otherwise, these files are handled like all other `style.scss`. They will also be extracted into `style-index.css`.
-#### Using fonts and images
+### Using fonts and images
It is possible to reference font (`woff`, `woff2`, `eot`, `ttf` and `otf`) and image (`bmp`, `png`, `jpg`, `jpeg`, `gif` and `wepb`) files from CSS that is controlled by webpack as explained in the previous section.
@@ -724,7 +720,7 @@ _Example:_
}
```
-#### Using SVG
+### Using SVG
_Example:_
@@ -739,18 +735,37 @@ const App = () => (
);
```
-#### Provide your own webpack config
+## Advanced Usage
+
+This package should generally be used with the set of recommended config files. While it’s possible to override every config file provided, if you have to do it, your use case is far more complicated than anticipated. If that happens, it would be better to avoid using the whole abstraction layer and set up your project with full control over the tooling used.
+
+### Default webpack config
+
+`@wordpress/scripts` bundles the default webpack config used as a base by the WordPress editor. These are the defaults:
+
+- [Entry](https://webpack.js.org/configuration/entry-context/#entry): the entry points for your project get detected by scanning all script fields in `block.json` files located in the `src` directory. The fallback entry point is `src/index.js` (other supported extensions: `.jsx`, `.ts`, and `.tsx`) in case there is no `block.json` file found.
+- [Output](https://webpack.js.org/configuration/output): `build/[name].js`, for example: `build/index.js`, or `build/my-block/index.js`.
+- [Loaders](https://webpack.js.org/loaders/):
+ - [`babel-loader`](https://webpack.js.org/loaders/babel-loader/) allows transpiling JavaScript and TypeScript files using Babel and webpack.
+ - [`@svgr/webpack`](https://www.npmjs.com/package/@svgr/webpack) and [`url-loader`](https://webpack.js.org/loaders/url-loader/) makes it possible to handle SVG files in JavaScript code.
+ - [`css-loader`](https://webpack.js.org/loaders/css-loader/) chained with [`postcss-loader`](https://webpack.js.org/loaders/postcss-loader/) and [sass-loader](https://webpack.js.org/loaders/sass-loader/) let webpack process CSS, SASS or SCSS files referenced in JavaScript files.
+- [Plugins](https://webpack.js.org/configuration/plugins) (among others):
+ - [`CopyWebpackPlugin`](https://webpack.js.org/plugins/copy-webpack-plugin/) copies all `block.json` files discovered in the `src` directory to the build directory.
+ - [`MiniCssExtractPlugin`](https://webpack.js.org/plugins/mini-css-extract-plugin/) extracts CSS into separate files. It creates a CSS file per JavaScript entry point which contains CSS.
+ - [`@wordpress/dependency-extraction-webpack-plugin`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/dependency-extraction-webpack-plugin/README.md) is used with the default configuration to ensure that WordPress provided scripts are not included in the built bundle.
+
+### Provide your own webpack config
Should there be any situation where you want to provide your own webpack config, you can do so. The `build` and `start` commands will use your provided file when:
- the command receives a `--config` argument. Example: `wp-scripts build --config my-own-webpack-config.js`.
- there is a file called `webpack.config.js` or `webpack.config.babel.js` in the top-level directory of your project (at the same level as `package.json`).
-##### Extending the webpack config
+#### Extending the webpack config
To extend the provided webpack config, or replace subsections within the provided webpack config, you can provide your own `webpack.config.js` file, `require` the provided `webpack.config.js` file, and use the [`spread` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) to import all of or part of the provided configuration.
-In the example below, a `webpack.config.js` file is added to the root folder extending the provided webpack config to include custom logic to parse module's source and convert it to a JavaScript object using [`toml`](https://www.npmjs.com/package/toml). It may be useful to import toml or other non-JSON files as JSON, without specific loaders:
+In the example below, a `webpack.config.js` file is added to the root folder extending the provided webpack config to include custom logic to parse module’s source and convert it to a JavaScript object using [`toml`](https://www.npmjs.com/package/toml). It may be useful to import toml or other non-JSON files as JSON, without specific loaders:
```javascript
const toml = require( 'toml' );
@@ -781,8 +796,8 @@ If you follow this approach, please, be aware that:
## Contributing to this package
-This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
+This is an individual package that’s part of the Gutenberg project. The project is organized as a monorepo. It’s made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
-To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
+To find out more about contributing to this package or Gutenberg as a whole, please read the project’s main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
diff --git a/packages/scripts/config/webpack.config.js b/packages/scripts/config/webpack.config.js
index c7be796c12c02..f0e425a8d5998 100644
--- a/packages/scripts/config/webpack.config.js
+++ b/packages/scripts/config/webpack.config.js
@@ -30,7 +30,7 @@ const {
hasArgInCLI,
hasCssnanoConfig,
hasPostCSSConfig,
- getWordPressSrcDirectory,
+ getProjectSourcePath,
getWebpackEntryPoints,
getAsBooleanFromENV,
getBlockJsonModuleFields,
@@ -302,14 +302,14 @@ const scriptConfig = {
} ),
new PhpFilePathsPlugin( {
- context: getWordPressSrcDirectory(),
+ context: getProjectSourcePath(),
props: [ 'render', 'variations' ],
} ),
new CopyWebpackPlugin( {
patterns: [
{
from: '**/block.json',
- context: getWordPressSrcDirectory(),
+ context: getProjectSourcePath(),
noErrorOnMissing: true,
transform( content, absoluteFrom ) {
const convertExtension = ( path ) => {
@@ -346,7 +346,7 @@ const scriptConfig = {
const runtimePath = relative(
dirname( absoluteFrom ),
fromProjectRoot(
- getWordPressSrcDirectory() +
+ getProjectSourcePath() +
sep +
'runtime.js'
)
@@ -375,7 +375,7 @@ const scriptConfig = {
},
{
from: '**/*.php',
- context: getWordPressSrcDirectory(),
+ context: getProjectSourcePath(),
noErrorOnMissing: true,
filter: ( filepath ) => {
return (
@@ -415,7 +415,7 @@ if ( hasExperimentalModulesFlag ) {
/** @type {ReadonlyArray} */
this.blockJsonFiles = glob( '**/block.json', {
absolute: true,
- cwd: fromProjectRoot( getWordPressSrcDirectory() ),
+ cwd: fromProjectRoot( getProjectSourcePath() ),
} );
}
diff --git a/packages/scripts/scripts/build.js b/packages/scripts/scripts/build.js
index 0eef2afb451bf..8c7b768ba3e69 100644
--- a/packages/scripts/scripts/build.js
+++ b/packages/scripts/scripts/build.js
@@ -7,31 +7,11 @@ const { sync: resolveBin } = require( 'resolve-bin' );
/**
* Internal dependencies
*/
-const { getWebpackArgs, hasArgInCLI, getArgFromCLI } = require( '../utils' );
+const { getWebpackArgs } = require( '../utils' );
const EXIT_ERROR_CODE = 1;
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
-if ( hasArgInCLI( '--experimental-modules' ) ) {
- process.env.WP_EXPERIMENTAL_MODULES = true;
-}
-
-if ( hasArgInCLI( '--webpack-no-externals' ) ) {
- process.env.WP_NO_EXTERNALS = true;
-}
-
-if ( hasArgInCLI( '--webpack-bundle-analyzer' ) ) {
- process.env.WP_BUNDLE_ANALYZER = true;
-}
-
-if ( hasArgInCLI( '--webpack-copy-php' ) ) {
- process.env.WP_COPY_PHP_FILES_TO_DIST = true;
-}
-
-process.env.WP_SRC_DIRECTORY = hasArgInCLI( '--webpack-src-dir' )
- ? getArgFromCLI( '--webpack-src-dir' )
- : 'src';
-
const { status } = spawn( resolveBin( 'webpack' ), getWebpackArgs(), {
stdio: 'inherit',
} );
diff --git a/packages/scripts/scripts/start.js b/packages/scripts/scripts/start.js
index 6296192ef302b..fd0a191f168e9 100644
--- a/packages/scripts/scripts/start.js
+++ b/packages/scripts/scripts/start.js
@@ -7,33 +7,9 @@ const { sync: resolveBin } = require( 'resolve-bin' );
/**
* Internal dependencies
*/
-const { getArgFromCLI, getWebpackArgs, hasArgInCLI } = require( '../utils' );
+const { getWebpackArgs, hasArgInCLI } = require( '../utils' );
const EXIT_ERROR_CODE = 1;
-if ( hasArgInCLI( '--experimental-modules' ) ) {
- process.env.WP_EXPERIMENTAL_MODULES = true;
-}
-
-if ( hasArgInCLI( '--webpack-no-externals' ) ) {
- process.env.WP_NO_EXTERNALS = true;
-}
-
-if ( hasArgInCLI( '--webpack-bundle-analyzer' ) ) {
- process.env.WP_BUNDLE_ANALYZER = true;
-}
-
-if ( hasArgInCLI( '--webpack--devtool' ) ) {
- process.env.WP_DEVTOOL = getArgFromCLI( '--webpack--devtool' );
-}
-
-if ( hasArgInCLI( '--webpack-copy-php' ) ) {
- process.env.WP_COPY_PHP_FILES_TO_DIST = true;
-}
-
-process.env.WP_SRC_DIRECTORY = hasArgInCLI( '--webpack-src-dir' )
- ? getArgFromCLI( '--webpack-src-dir' )
- : 'src';
-
const webpackArgs = getWebpackArgs();
if ( hasArgInCLI( '--hot' ) ) {
webpackArgs.unshift( 'serve' );
diff --git a/packages/scripts/utils/config.js b/packages/scripts/utils/config.js
index 3d99f3784859d..be6f183137891 100644
--- a/packages/scripts/utils/config.js
+++ b/packages/scripts/utils/config.js
@@ -9,6 +9,7 @@ const { sync: glob } = require( 'fast-glob' );
* Internal dependencies
*/
const {
+ getArgFromCLI,
getArgsFromCLI,
getFileArgsFromCLI,
hasArgInCLI,
@@ -114,9 +115,37 @@ const getWebpackArgs = () => {
// Gets all args from CLI without those prefixed with `--webpack`.
let webpackArgs = getArgsFromCLI( [
'--experimental-modules',
+ '--source-path',
'--webpack',
] );
+ if ( hasArgInCLI( '--experimental-modules' ) ) {
+ process.env.WP_EXPERIMENTAL_MODULES = true;
+ }
+
+ if ( hasArgInCLI( '--source-path' ) ) {
+ process.env.WP_SOURCE_PATH = getArgFromCLI( '--source-path' );
+ } else if ( hasArgInCLI( '--webpack-src-dir' ) ) {
+ // Backwards compatibility.
+ process.env.WP_SOURCE_PATH = getArgFromCLI( '--webpack-src-dir' );
+ }
+
+ if ( hasArgInCLI( '--webpack-bundle-analyzer' ) ) {
+ process.env.WP_BUNDLE_ANALYZER = true;
+ }
+
+ if ( hasArgInCLI( '--webpack-copy-php' ) ) {
+ process.env.WP_COPY_PHP_FILES_TO_DIST = true;
+ }
+
+ if ( hasArgInCLI( '--webpack--devtool' ) ) {
+ process.env.WP_DEVTOOL = getArgFromCLI( '--webpack--devtool' );
+ }
+
+ if ( hasArgInCLI( '--webpack-no-externals' ) ) {
+ process.env.WP_NO_EXTERNALS = true;
+ }
+
const hasWebpackOutputOption =
hasArgInCLI( '-o' ) || hasArgInCLI( '--output' );
if (
@@ -136,10 +165,6 @@ const getWebpackArgs = () => {
const pathToEntry = ( path ) => {
const entryName = basename( path, '.js' );
- if ( ! path.startsWith( './' ) ) {
- path = './' + path;
- }
-
return [ entryName, path ];
};
@@ -162,7 +187,11 @@ const getWebpackArgs = () => {
const [ entryName, path ] = fileArg.includes( '=' )
? fileArg.split( '=' )
: pathToEntry( fileArg );
- entry[ entryName ] = path;
+ entry[ entryName ] = fromProjectRoot(
+ process.env.WP_SOURCE_PATH
+ ? join( process.env.WP_SOURCE_PATH, path )
+ : path
+ );
} );
process.env.WP_ENTRY = JSON.stringify( entry );
}
@@ -176,20 +205,20 @@ const getWebpackArgs = () => {
};
/**
- * Returns the WordPress source directory. It defaults to 'src' if the
- * `process.env.WP_SRC_DIRECTORY` variable is not set.
+ * Returns the project source path. It defaults to 'src' if the
+ * `process.env.WP_SOURCE_PATH` variable is not set.
*
* @return {string} The WordPress source directory.
*/
-function getWordPressSrcDirectory() {
- return process.env.WP_SRC_DIRECTORY || 'src';
+function getProjectSourcePath() {
+ return process.env.WP_SOURCE_PATH || 'src';
}
/**
- * Detects the list of entry points to use with webpack. There are three ways to do this:
- * 1. Use the legacy webpack 4 format passed as CLI arguments.
- * 2. Scan `block.json` files for scripts.
- * 3. Fallback to `src/index.*` file.
+ * Detects the list of entry points to use with webpack. There are three alternative ways to do this:
+ * 1. Use the recommended command format that lists the paths to JavaScript files.
+ * 2. Scan `block.json` files to detect referenced JavaScript and PHP files automatically.
+ * 3. Fallback to the `src/index.*` file.
*
* @see https://webpack.js.org/concepts/entry-points/
*
@@ -200,31 +229,32 @@ function getWebpackEntryPoints( buildType ) {
* @return {Object} The list of entry points.
*/
return () => {
- // 1. Handles the legacy format for entry points when explicitly provided with the `process.env.WP_ENTRY`.
+ // 1. Uses the recommended command format that lists entry points as paths to JavaScript files.
+ // Example: `wp-scripts build one.js two.js`.
if ( process.env.WP_ENTRY ) {
return buildType === 'script'
? JSON.parse( process.env.WP_ENTRY )
: {};
}
- // Continue only if the source directory exists.
- if ( ! hasProjectFile( getWordPressSrcDirectory() ) ) {
+ // Continues only if the source directory exists. Defaults to "src" if not explicitly set in the command.
+ if ( ! hasProjectFile( getProjectSourcePath() ) ) {
warn(
- `Source directory "${ getWordPressSrcDirectory() }" was not found. Please confirm there is a "src" directory in the root or the value passed to --webpack-src-dir is correct.`
+ `Source directory "${ getProjectSourcePath() }" was not found. Please confirm there is a "src" directory in the root or the value passed with "--output-path" is correct.`
);
return {};
}
// 2. Checks whether any block metadata files can be detected in the defined source directory.
- // It scans all discovered files looking for JavaScript assets and converts them to entry points.
+ // It scans all discovered files, looks for JavaScript assets, and converts them to entry points.
const blockMetadataFiles = glob( '**/block.json', {
absolute: true,
- cwd: fromProjectRoot( getWordPressSrcDirectory() ),
+ cwd: fromProjectRoot( getProjectSourcePath() ),
} );
if ( blockMetadataFiles.length > 0 ) {
const srcDirectory = fromProjectRoot(
- getWordPressSrcDirectory() + sep
+ getProjectSourcePath() + sep
);
const entryPoints = {};
@@ -276,7 +306,7 @@ function getWebpackEntryPoints( buildType ) {
) }" listed in "${ blockMetadataFile.replace(
fromProjectRoot( sep ),
''
- ) }". File is located outside of the "${ getWordPressSrcDirectory() }" directory.`
+ ) }". File is located outside of the "${ getProjectSourcePath() }" directory.`
);
continue;
}
@@ -290,7 +320,7 @@ function getWebpackEntryPoints( buildType ) {
`${ entryName }.?(m)[jt]s?(x)`,
{
absolute: true,
- cwd: fromProjectRoot( getWordPressSrcDirectory() ),
+ cwd: fromProjectRoot( getProjectSourcePath() ),
}
);
@@ -302,7 +332,7 @@ function getWebpackEntryPoints( buildType ) {
) }" listed in "${ blockMetadataFile.replace(
fromProjectRoot( sep ),
''
- ) }". File does not exist in the "${ getWordPressSrcDirectory() }" directory.`
+ ) }". File does not exist in the "${ getProjectSourcePath() }" directory.`
);
continue;
}
@@ -322,15 +352,15 @@ function getWebpackEntryPoints( buildType ) {
}
// 3. Checks whether a standard file name can be detected in the defined source directory,
- // and converts the discovered file to entry point.
+ // and converts the discovered file to entry point.
const [ entryFile ] = glob( 'index.[jt]s?(x)', {
absolute: true,
- cwd: fromProjectRoot( getWordPressSrcDirectory() ),
+ cwd: fromProjectRoot( getProjectSourcePath() ),
} );
if ( ! entryFile ) {
warn(
- `No entry file discovered in the "${ getWordPressSrcDirectory() }" directory.`
+ `No entry file discovered in the "${ getProjectSourcePath() }" directory.`
);
return {};
}
@@ -412,10 +442,10 @@ function getPhpFilePaths( context, props ) {
module.exports = {
getJestOverrideConfigFile,
+ getPhpFilePaths,
+ getProjectSourcePath,
getWebpackArgs,
- getWordPressSrcDirectory,
getWebpackEntryPoints,
- getPhpFilePaths,
hasBabelConfig,
hasCssnanoConfig,
hasJestConfig,
diff --git a/packages/scripts/utils/index.js b/packages/scripts/utils/index.js
index dc4008b16197d..b26df4bd479d9 100644
--- a/packages/scripts/utils/index.js
+++ b/packages/scripts/utils/index.js
@@ -13,10 +13,10 @@ const {
} = require( './cli' );
const {
getJestOverrideConfigFile,
+ getPhpFilePaths,
+ getProjectSourcePath,
getWebpackArgs,
- getWordPressSrcDirectory,
getWebpackEntryPoints,
- getPhpFilePaths,
hasBabelConfig,
hasCssnanoConfig,
hasJestConfig,
@@ -40,10 +40,10 @@ module.exports = {
getJestOverrideConfigFile,
getNodeArgsFromCLI,
getPackageProp,
+ getPhpFilePaths,
+ getProjectSourcePath,
getWebpackArgs,
- getWordPressSrcDirectory,
getWebpackEntryPoints,
- getPhpFilePaths,
getBlockJsonModuleFields,
getBlockJsonScriptFields,
hasArgInCLI,