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
Bump wp-scripts to 22.1.0 and webpack config to v5 #1339
Bump wp-scripts to 22.1.0 and webpack config to v5 #1339
Conversation
…ncludes SCSS syntax
…ig of `@wordpress/scripts`
34ca73d
to
0167ec4
Compare
ae8e464
to
a455f0a
Compare
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.
❓ / 🚧
When I run the Tests in my IDE they fail. If I roll back to develop, it works normally.
Example of command:
/Users/miguelperezpellicer/.nvm/versions/node/v14.19.0/bin/node --require /Applications/PhpStorm.app/Contents/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-stdin-fix.js /Users/miguelperezpellicer/Sites/wp16-test/wordpress/wp-content/plugins/google-listings-and-ads/node_modules/jest/bin/jest.js --colors --reporters /Applications/PhpStorm.app/Contents/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-reporter.js --verbose --testNamePattern=^Performance Card --runTestsByPath /Users/miguelperezpellicer/Sites/wp16-test/wordpress/wp-content/plugins/google-listings-and-ads/js/src/dashboard/summary-section/performance-card.test.js
result:
Test suite failed to run
TypeError: Cannot read properties of undefined (reading 'cwd')
at Object.getCacheKey (node_modules/@wordpress/scripts/node_modules/babel-jest/build/index.js:299:33)
❓ WDYT about fixing package.json to prevent errors in |
❓/ 💅 Seems like this is checking as well vendor folder???? 😕 But in the documentation it says is not checking it. WDYT about removing it? |
FWIW, 😕 Works on my end |
📜 I'd rather make it a separate PR, to make both easier to review. |
📜 https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/scripts/lint-md-docs.js#L47 I can volunteer to do that. edit: done at WordPress/gutenberg#39724 |
The reported line is:
Is it possible that your IDE does not load jest config properly? I got the same result when I tried running in CLI:
Does running just |
I guess it's a mismatch of config vs jest version. Can you try set up your IDE to use |
❔ BTW, @eason9487 why do we need to
|
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.
FWIW, I tested locally, reviewed the code changes, LGTM.
So the question is how much it is a deal-breaker for @puntope . We do not depend or use jest directly, and testing via wp-scripts works (at least for me).
I guess we can solve it on your end either via setting up IDE, or bumping @woocommerce/e2e-*
packages that install the lower version of jest
, but that's yet another can of worms, which I'd move to a separate PR.
@tomalec, thanks for the review, investigation, suggestions, and upstream reporting and fixing! 🙏
The main reason is that CopyPlugin will cause any changes to files in the src folder to trigger an unwanted webpack rebuild. It doesn't affect the building results, but it's a bit distracting. Also, although we don't have any block.js files, the fact that the behavior of automatically copying them to the I added a code comment to remedy the reason in 6dd5777. |
@puntope, thanks for the review!
I agree with this #1339 (comment). Or we could also fix it in the clean-up stage. Although GPL-2.0 or later is suggested by WordPress linter, I'm not sure if the original license is for any reason, and this repo has third-party partner involvement. So I think there must be more sufficient confirmation before changing the
I did some surveys and got the same thoughts as @tomalec's investigation in #1339 (comment) and #1339 (comment). I tried on my local env and checked the JavaScript Unit Tests job on GitHub Actions, they both work correctly. Probably needs more surveys on your end. |
Yes, is mainly a problem of IDE. npm run test:js works perfectly fine. I will check around my IDE config. Thanks |
Changes proposed in this Pull Request:
It's the stage 1 of #1333
💡 There are a lot of stylelint fixes. It should be easier to review with
Upgraded packages
@wordpress/scripts
~22.1.0
to only accept patch releases because version 22.2.0 seems to have a potential breaking change.@wordpress/dependency-extraction-webpack-plugin
@wordpress/prettier-config
@wordpress/stylelint-config
postcss
prettier
stylelint
🔒 Since
eslint
also extends the version and config of@woocommerce/eslint-plugin
, it is currently not upgradeable. And this brings some new workarounds to the codebase.Breaking changes
Webpack building
path
(path-browserify
) polyfill of native node.js module forpostcss
.path-browserify
package.process
polyfill of native node.js module for@wordpress/compose
that@wordpress/components
depends on.browserslist
config to package.json to avoid the IE11 incompatible warnings when building CSS.CopyPlugin
(CopyWebpackPlugin) plugin from the default webpack config of@wordpress/scripts
.wp-scripts
commandslint:js
- Fix the path resolving problem of .js files and a module.lint:css
- Fix the breaking change thatstylelint
v14 no longer includes SCSS syntax.stylelint-config-standard-scss
package.test:js
- Update the dependent packages ofjest
and a related testing library.@testing-library/react
jest-environment-jsdom
lint:md:js
was originally broken and seems to have not been in use, so this PR won't fix it.Detailed test instructions:
tweak/1333-stg1-upgrade-wp-scripts
branch.npm run install
packages-update
andlint:md:js
, run all wp-scripts related commands to see if they work properly.npm start
npm run dev
npm run build
npm run lint:css
npm run lint:js
npm run test:js
npm run test:js:watch
npm run format:js
npm run check-engines
npm run lint:md:docs
npm run lint:pkg-json
npm run check-licenses
Additional details:
The
nanoid
package to be fixed in #1353 should be resolved with the merging of this PR intodevelop
.Changelog entry