Skip to content

[create-block] Add npmDevDependencies as a template variable.#39723

Merged
gziolo merged 7 commits intoWordPress:trunkfrom
ryanwelcher:try/add-npm-dev-dependencies-to-template
Mar 25, 2022
Merged

[create-block] Add npmDevDependencies as a template variable.#39723
gziolo merged 7 commits intoWordPress:trunkfrom
ryanwelcher:try/add-npm-dev-dependencies-to-template

Conversation

@ryanwelcher
Copy link
Copy Markdown
Contributor

@ryanwelcher ryanwelcher commented Mar 24, 2022

What?

This PR adds a new template variable to the create-block package to allow templates to define devDependencies.

Closes #39722

Why?

Some blocks require devDependences that should not be added to regular dependencies.

How?

This is done by introducing a npmDevDependencies variable

Testing Instructions

  1. Download https://github.com/ryanwelcher/dynamic-block-template and add a npmDevDependencies entry to the index.js and add an array of dependencies
    Run ./node_modules/.bin/wp-create-block --template={pathTo}/dynamic-block-template

@ryanwelcher ryanwelcher added [Type] Enhancement A suggestion for improvement. [Tool] Create Block /packages/create-block Developer Experience Ideas about improving block and theme developer experience labels Mar 24, 2022
@ryanwelcher ryanwelcher requested review from gziolo and mkaz as code owners March 24, 2022 15:30
Copy link
Copy Markdown
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't had a chance to test that yet. The changes proposed in the PR look great though 👍🏻

Any idea why CI jobs didn't start?

@ryanwelcher
Copy link
Copy Markdown
Contributor Author

ryanwelcher commented Mar 25, 2022

Thanks, @gziolo! Not sure about the CI either, I tried pushing another commit to restart the jobs but that did nothing.

@ryanwelcher ryanwelcher force-pushed the try/add-npm-dev-dependencies-to-template branch from 875e7ae to 99f86ed Compare March 25, 2022 15:13
Copy link
Copy Markdown
Contributor

@dgwyer dgwyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just updated a couple of typos.

Comment thread packages/create-block/CHANGELOG.md Outdated
Co-authored-by: David Gwyer <dgwyer@users.noreply.github.com>
@ryanwelcher
Copy link
Copy Markdown
Contributor Author

For posterity, I was able to get the CI job to re-run by rebasing from trunk and force-pushing the changes as per @c4rl0sbr4v0 in WP Make slack.

@gziolo gziolo merged commit 41325b9 into WordPress:trunk Mar 25, 2022
@github-actions github-actions bot added this to the Gutenberg 13.0 milestone Mar 25, 2022
@bph bph added the Needs Dev Note Requires a developer note for a major WordPress release cycle label Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Developer Experience Ideas about improving block and theme developer experience Needs Dev Note Requires a developer note for a major WordPress release cycle [Tool] Create Block /packages/create-block [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow devDependencies to be defined for a template

4 participants