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

Add support for @wordpress/scripts, block.json and create block #82

Merged
merged 46 commits into from
Dec 2, 2022

Conversation

stevenslack
Copy link
Contributor

@stevenslack stevenslack commented Dec 1, 2022

Adds support for building blocks using @wordpress/scripts as described in #78

stevenslack and others added 30 commits November 29, 2022 16:16
Copy link
Member

@kevinfodness kevinfodness left a comment

Choose a reason for hiding this comment

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

This looks great - I left some questions and food for thought, but no blockers. Excited to start using this. We'll continue to iterate as we see how things work in the wild. 🍣

bin/create-block/templates/block/edit.jsx.mustache Outdated Show resolved Hide resolved
bin/create-block/templates/block/render.php.mustache Outdated Show resolved Hide resolved
@@ -270,10 +270,12 @@ function delete_files( string|array $paths ) {
'.eslintrc.json',
'.nvmrc',
'.stylelintrc.json',
'babel.config.json',
'babel.config.js',
Copy link
Member

Choose a reason for hiding this comment

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

Does the babel file still exist / still need to exist since we're using wp-scripts as the build system?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! WP Scripts uses Babel for Typescript and Jest to work correctly.

entries/example-slotfills/index.php Outdated Show resolved Hide resolved
// For transformations with .ts and .tsx files.
...tsjPreset.transform,
// For transformations with .js and .jsx files.
'^.+\\.(js|jsx)$': 'babel-jest',
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary? I thought ts-jest would handle regular JS files also and not require Babel? Could also come back to this later. I'd generally love to live in a Babel-free future (or at least where it's handled by something else and I don't have to touch it).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if there are tests written in js or jsx Jest will fail without this. It is documented in integrating Jest and TS. I would also prefer a babel free future. Unfortunately getting Jest to work with TS with WP Scripts involves using babel.

@srtfisher srtfisher linked an issue Dec 2, 2022 that may be closed by this pull request
Copy link
Member

@srtfisher srtfisher left a comment

Choose a reason for hiding this comment

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

one comment, looks 💯 . I'd love to see TS be the default in the very near future.

@@ -0,0 +1,38 @@
/**
Copy link
Member

Choose a reason for hiding this comment

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

We should split out a ticket to make these .tsx files that are generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created an issue for this: #90

@stevenslack stevenslack merged commit 70660d3 into develop Dec 2, 2022
@stevenslack stevenslack deleted the feature/wp-scripts branch December 2, 2022 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch to wp-scripts for webpack building
3 participants