diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 403befb5d8917..5ce6e02492b9f 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -2,12 +2,24 @@ ## Unreleased +### New Feature + +- Automatically copy PHP files located in the `src` folder and its subfolders to the output directory (`build` by default) ([#38715](https://github.com/WordPress/gutenberg/pull/38715)). + +### Bug Fix + +- Return a default entry object in the `build` command when no entry files discovered in the project ([#38737](https://github.com/WordPress/gutenberg/pull/38737)). + ## 21.0.0 (2022-02-10) ### Breaking Changes - The bundled `puppeteer-core` dependency has been updated from requiring `^11.0.0` to requiring `^13.2.0` ([#37078](https://github.com/WordPress/gutenberg/pull/37078)). +### Bug Fix + +- Fix the handling for entry points when running `build` command ([#38584](https://github.com/WordPress/gutenberg/pull/38584)). + ## 20.0.2 (2022-01-31) ### Bug Fix diff --git a/packages/scripts/utils/config.js b/packages/scripts/utils/config.js index 1f1a271137ce9..ba2966a15e19b 100644 --- a/packages/scripts/utils/config.js +++ b/packages/scripts/utils/config.js @@ -16,7 +16,6 @@ const { } = require( './cli' ); const { fromConfigRoot, fromProjectRoot, hasProjectFile } = require( './file' ); const { hasPackageProp } = require( './package' ); -const { exit } = require( './process' ); const { log } = console; // See https://babeljs.io/docs/en/config-files#configuration-file-types. @@ -184,6 +183,11 @@ function getWebpackEntryPoints() { return JSON.parse( process.env.WP_ENTRY ); } + // Continue only if the `src` directory exists. + if ( ! hasProjectFile( 'src' ) ) { + return {}; + } + // 2. Checks whether any block metadata files can be detected in the `src` directory. // It scans all discovered files looking for JavaScript assets and converts them to entry points. const blockMetadataFiles = glob( 'src/**/block.json', { @@ -269,9 +273,9 @@ function getWebpackEntryPoints() { } ); if ( ! entryFile ) { log( - chalk.bold.red( 'No entry files discovered in the "src" folder.' ) + chalk.yellow( 'No entry file discovered in the "src" directory.' ) ); - exit( 1 ); + return {}; } return {