Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts: Do not exit build when no entry found in src directory #38737

Merged
merged 2 commits into from Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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' ) ) {
gziolo marked this conversation as resolved.
Show resolved Hide resolved
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.' ) );
gziolo marked this conversation as resolved.
Show resolved Hide resolved
return {};
}

return {
Expand Down