-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
There was a problem hiding this 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. 🍣
@@ -270,10 +270,12 @@ function delete_files( string|array $paths ) { | |||
'.eslintrc.json', | |||
'.nvmrc', | |||
'.stylelintrc.json', | |||
'babel.config.json', | |||
'babel.config.js', |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
// For transformations with .ts and .tsx files. | ||
...tsjPreset.transform, | ||
// For transformations with .js and .jsx files. | ||
'^.+\\.(js|jsx)$': 'babel-jest', |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this 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 @@ | |||
/** |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Adds support for building blocks using
@wordpress/scripts
as described in #78@wordpress/scripts
Webpack configuration for customizations.@wordpress/scripts
..ts
and.tsx
files are compiled.