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

[Create Block] Allows custom keys to be generated in block.json files and package.json files #44649

Merged
merged 10 commits into from
Oct 7, 2022
4 changes: 4 additions & 0 deletions packages/create-block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### New Feature

- Add new `customPackageJSON` and `customBlockJSON` keys to allow templates to define custom keys for the resulting `package.json` and `block.json` files respectively.[#44649](https://github.com/WordPress/gutenberg/pull/44649)

## 4.2.0 (2022-09-21)

## 4.0.0 (2022-08-24)
Expand Down
2 changes: 2 additions & 0 deletions packages/create-block/lib/init-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ async function initBlockJSON( {
editorScript,
editorStyle,
style,
customBlockJSON,
} ) {
info( '' );
info( 'Creating a "block.json" file.' );
Expand Down Expand Up @@ -56,6 +57,7 @@ async function initBlockJSON( {
editorScript,
editorStyle,
style,
...customBlockJSON,
} ).filter( ( [ , value ] ) => !! value )
),
null,
Expand Down
2 changes: 2 additions & 0 deletions packages/create-block/lib/init-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = async ( {
npmDevDependencies,
customScripts,
isDynamicVariant,
customPackageJSON,
} ) => {
const cwd = join( process.cwd(), slug );

Expand Down Expand Up @@ -58,6 +59,7 @@ module.exports = async ( {
...( wpEnv && { env: 'wp-env' } ),
...customScripts,
},
...customPackageJSON,
} ).filter( ( [ , value ] ) => !! value )
)
);
Expand Down
4 changes: 4 additions & 0 deletions packages/create-block/lib/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ module.exports = async (
editorStyle,
style,
variantVars,
customPackageJSON,
customBlockJSON,
}
) => {
slug = slug.toLowerCase();
Expand Down Expand Up @@ -99,6 +101,8 @@ module.exports = async (
editorScript,
editorStyle,
style,
customPackageJSON,
customBlockJSON,
...variantVars,
};

Expand Down