-
Notifications
You must be signed in to change notification settings - Fork 882
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
Optimize build commands & building the plugin js #20874
Conversation
@d-claassen Please be aware that following packages have been abandoned and are not actively maintained anymore:
Please consider using the other packages instead. |
Pull Request Test Coverage Report for Build bbc42abf07c4b5d013194c0c400ca96d0b9a4946Details
💛 - Coveralls |
After an extensive CR session with @igorschoester, we found these steps still need to be taken:
|
3e5f4dc
to
4c5076c
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.
CR 🏗️ ACC ✅
We already have Lerna installed to run linting and tests on all monorepo packages. Lerna has the option to run commands in the packages in a topological order, this means it'll follow the dependency tree from the bottom upwards to the start. So if package A depends on package B, Lerna will first build B before it builds A. This ensures that the build for package A uses the built version of package B. This will build all packages individually, like `@yoast/ui-library`, so removes the need for separate build commands for these packages. It also builds `yoastseo` and `@yoast/analysis-report`. For those packages however, the `main` configuration in the `package.json` file does not point to the build directory. So for these packages, the source files will remain to be used. The old Grunt alias `build-ui-library` is preserved for backward compatibility. It now utilizes the `yarn workspace <pkgName> <cmd>` command to allow more flexibility in the location of the package within the project.
Build sourcemap for analysis-report in development
- Remove unneeded try-catch. This new lint error appeared. It seemed best to just resolve it. - Ignore missing dangling commas in tests - Ignore import/no-unresolved for the premium configuration - Use `jest.spyOn` to replace missing global `spyOn` - Fix paper comparison with partial expectation When an expectation in asynchronous test fails, the `done` callback is never called and the test hangs until the timeout. Calling the `done` callback in the `try..catch` block ensures the test will finish as soon as possible. - Fixes tests that were hitting caches - Disable inclusive language config test - Ensure all `yoastseo` references load from src Without this line, certain `import .. from "yoastseo"` statements would load components from the `build/` directory when it exists. - Clear cache in tests - Remove old `grunt publish` from `yoastseo` Explain fuzzy Jest config for moduleNameMapper
Packages might depend on other packages. Because those packages now have their `main` property pointing to the build version, those build versions need to exist to make the tests pass. This doesn't build the plugin js itself. It has dependencies on javascript from WordProof which would have be built with composer prefixing. That would only lengthen the builds. But the plugin JavaScript isn't needed, because it is the top of the foodchain and will never be a dependency for any of the other packages.
- ESLint to ignore new standard "build" folder - Specify packages to allow unresolved imports from - Align babel-core and jest versions in the monorepo
4c5076c
to
d682985
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.
CR && AT ✅ (once again)
Awaiting merge freeze (22.3-RC1 creation) before merging
Context
main
key in eachpackage.json
).$ yarn build
and packages on the same hierarchical level are built in parallel.NODE_ENV
variable for production/development builds.packages/js
) from the rootpackage.json
to its ownpackage.json
, including other files specifically for building the plugin that now live in the root.Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
shell:build-ui-library
with genericshell:build-packages
, powered by Lerna.$ yarn build
command in the root also build all packages, with the help of Lerna.grunt-eslint
inyoastseo
to align the included ESLint version with other packages (now all on v7.23.0)@wordpress/scripts
to align the included Jest version across packages (now all on v27.5.1)styled-components
or other packages, and are therefore ending up with different class names.yoastseo
specific module name mapper to ensureimport .. from "yoastseo"
in the package itself are resolved to the src files, and not to the build files.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
$ yarn lint
in the root of the project.$ yarn build
in the root of the project.$ yarn test
in the root of the project.$ yarn workspace @yoast/ui-library storybook
in the root of the project.$ yarn why jest
to see asingletwo installments (27 & 29) of Jest in the node_modules, preventing conflicts throughout the monorepo.Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes #