Skip to content

Commit

Permalink
Scripts: Do not exit build when no entry found in src directory
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Feb 11, 2022
1 parent 8c1c614 commit 4e2dfce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 7 additions & 0 deletions packages/scripts/CHANGELOG.md
Expand Up @@ -6,13 +6,20 @@

- 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
Expand Down
11 changes: 6 additions & 5 deletions packages/scripts/utils/config.js
Expand Up @@ -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.
Expand Down Expand Up @@ -184,6 +183,10 @@ function getWebpackEntryPoints() {
return JSON.parse( process.env.WP_ENTRY );
}

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', {
Expand Down Expand Up @@ -268,10 +271,8 @@ function getWebpackEntryPoints() {
absolute: true,
} );
if ( ! entryFile ) {
log(
chalk.bold.red( 'No entry files discovered in the "src" folder.' )
);
exit( 1 );
log( chalk.yellow( 'No entry file discovered in the "src" folder.' ) );
return {};
}

return {
Expand Down

0 comments on commit 4e2dfce

Please sign in to comment.