-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Migrate From Nx to Turborepo #33079
Migrate From Nx to Turborepo #33079
Conversation
📊 Test reports for this pull request have been published and are accessible through the following links:
Latest commit referenced in the reports: Visit the WooCommerce Test Reports homepage to view all published reports. See the FAQs page if you're having problems accessing them. |
6179211
to
e3e8b4f
Compare
Interesting @psealock, I can't seem to reproduce this locally. What version of Composer are you using? It may also be worth noting that |
Thats the issue, all working as it should. Thanks |
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.
@ObliviousHarmony Thanks for working on this!
I found pnpm exec turbo build --filter=woocommerce
is not working for me. And looks like pnpm exec turbo run lint --filter=@woocommerce/admin-library
is broken. 🤔
pnpm exec turbo run lint --filter=@woocommerce/admin-library
• Packages in scope: @woocommerce/admin-library
• Running lint in 1 packages
@woocommerce/admin-library:lint: cache bypass, force executing 9d0a1ee78e1a1cf2
@woocommerce/admin-library:lint:
@woocommerce/admin-library:lint: > @woocommerce/admin-library@3.3.0 lint /Users/chihsuan/Projects/woocommerce/plugins/woocommerce-admin
@woocommerce/admin-library:lint: > pnpm run lint:js && pnpm run lint:css
@woocommerce/admin-library:lint:
@woocommerce/admin-library:lint:
@woocommerce/admin-library:lint: > @woocommerce/admin-library@3.3.0 lint:js /Users/chihsuan/Projects/woocommerce/plugins/woocommerce-admin
@woocommerce/admin-library:lint: > wp-scripts lint-js ./client --ext=js,ts,tsx
@woocommerce/admin-library:lint:
@woocommerce/admin-library:lint: WARNING: No configurations found in configuration directory:/Users/chihsuan/Projects/woocommerce/plugins/woocommerce-admin/config
@woocommerce/admin-library:lint: WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
@woocommerce/admin-library:lint: Error: ESLint configuration in plugin:@woocommerce/eslint-plugin/recommended is invalid:
@woocommerce/admin-library:lint: - Unexpected top-level property "overrides[0].extends".
@woocommerce/admin-library:lint:
@woocommerce/admin-library:lint: Referenced from: /Users/chihsuan/Projects/woocommerce/plugins/woocommerce-admin/.eslintrc.js
@woocommerce/admin-library:lint: at validateConfigSchema (/Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config/config-validator.js:235:15)
@woocommerce/admin-library:lint: at Object.validate (/Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config/config-validator.js:261:5)
@woocommerce/admin-library:lint: at loadFromDisk (/Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config/config-file.js:544:19)
@woocommerce/admin-library:lint: at load (/Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config/config-file.js:587:20)
@woocommerce/admin-library:lint: at /Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config/config-file.js:453:36
@woocommerce/admin-library:lint: at Array.reduceRight (<anonymous>)
@woocommerce/admin-library:lint: at applyExtends (/Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config/config-file.js:431:26)
@woocommerce/admin-library:lint: at loadFromDisk (/Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config/config-file.js:551:22)
@woocommerce/admin-library:lint: at Object.load (/Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config/config-file.js:587:20)
@woocommerce/admin-library:lint: at Config.getLocalConfigHierarchy (/Users/chihsuan/Projects/woocommerce/node_modules/.pnpm/eslint@5.16.0/node_modules/eslint/lib/config.js:240:44)
@woocommerce/admin-library:lint: ELIFECYCLE Command failed with exit code 2.
@woocommerce/admin-library:lint: ELIFECYCLE Command failed with exit code 1.
@woocommerce/admin-library:lint: Error: command finished with error: command (plugins/woocommerce-admin) pnpm run lint exited (1)
command (plugins/woocommerce-admin) pnpm run lint exited (1)
Tasks: 0 successful, 1 total
Cached: 0 cached, 1 total
Time: 1.167s
The other looks great! 👍
✅ Build pnpm exec turbo run build --filter=woocommerce
✅ Test pnpm exec turbo run test --filter=@woocommerce/admin-library
✅ Changelog pnpm changelog --filter=@woocommerce/components add
✅ E2E pnpm exec turbo run e2e --filter=woocommerce
Thanks @chihsuan, could you share the error log for the WooCommerce build failure too? |
@chihsuan Oh, I see. You need the |
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Are you using Node v16 @chihsuan? There are some dependencies that require it. I can't seem to replicate this error locally. If you are using a different version, I would suggest grabbing NVM. Our repository has a |
Yea, I'm using Node v16. Let me try again. 🤔 |
@ObliviousHarmony I just cleaned all the dist folders and it’s working for me now! Sorry for the false positive. |
These were previously in Nx executors. They need to be in a script so that Turbo can run them.
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.
👍 Nice work. Look forward to this being merged.
Hi @ObliviousHarmony, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:
|
This is awesome! Nice work 👏 |
Hello @ObliviousHarmony, I was looking into monorepo tools like nx and Turborepo recently. And would apreciate if you can summarize why did you guys decide to switch from nx to turborepo? Best regards, Erkand. |
Howdy @erkand-imeri, before we begin, I want to be very clear: Nx is a great tool. While it didn't work out for our use case, I don't think that makes it worse. A lot of this comes down to our own workflows and differences between some of our processes and the strong opinions of Nx. With that said, I'll share an explanation from an internal document: Ultimately it a came down to a few things:
With all of these considerations, we had a few choices:
Even at best, then, most of the unique value provided by Nx is lost. We are essentially using it as a
There is a comparison page on Nx's website looking at Turborepo. This is dated December 14th, 2021 and was likely written in response to Vercel’s acquisition of Turborepo. I will take a look at each of the major points and discuss their impact on the decision to migrate.
With all of that said, it felt like the right decision to move to Turborepo. |
All Submissions:
Changes proposed in this Pull Request:
This pull request replaces Nx with Turborepo. This pull request comes with a number of tooling and documentation updates to make sure that everything is clear. I plan to publish internal and external communication prior to and alongside this change to minimize the impact it may have on ongoing work.
Here is a mostly exhaustive list of the changes proposed in this pull request:
pnpm nx composer-install
are no longer present in favor of running package manager commands directly. Note that in the case of Composer, each relevant package has a"postinstall"
script that triggers a composer install automatically.test:e2e
->e2e
test:e2e-debug
->e2e:debug
test:e2e-dev
->e2e:dev
test:unit
-> `testbuild
,lint
,test
, ande2e
commands. Usepnpm exec turbo run {command} --filter={package}
to perform these actions. The output of the commands are cached where appropriate to minimize unnecessary executions. For example,pnpm nx build woocommerce
is nowpnpm exec turbo run build --filter=woocommerce
.pnpm
's filter option to run them in the correct package.pnpm changelog --filter=woocommerce
will run the"changelog"
script from WooCommerce'spackge.json
.woocommerce-admin
is now referred to as@woocommerce/admin-library
since the filtering syntax uses the package name.Closes #32655
How to test the changes in this Pull Request:
pnpm install
build
,lint
,test
, ande2e
commands.Other information:
pnpm nx changelog <project>
?FOR PR REVIEWER ONLY: