-
Notifications
You must be signed in to change notification settings - Fork 2
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
Finish v4 rewrite of Prettier's CLI #154
Comments
i think if you pick something up, its worth creating an issue in the cli repo or posting here so people are aware, too (less stepping on toes) this is great though. if we can work through this together, we can start migrating people to the new CLI for sure |
i've created prettier/prettier-cli#19 to help people pick tests to move across if you can post in there if you do any, or if you find one we shouldn't migrate, i will update the list |
We are using this Discord thread in the e18e server for coordinating on this also. |
I have a work-in-progress rewrite of Prettier's CLI here. It should be very usable already, but it's probably not mature enough to be shipped to millions of people yet.
I had written a blog post about it here, and basically this is the performance improvement I had measured against Babel's repo.
We should get this shipped as stable sooner rather than later, but I've been short on free time compared to when I started the rewrite, so I could use some help for pushing this across the finish line and actually ship it to millions of people.
If you are interested in helping out I think 90% of the remaining work is basically just porting existing integration tests from Prettier's repo to the new CLI's repo, to fix some minor differences between the two implementations when it makes sense to do so, or at least document these minor differences when it's dubious whether the behavior of the old CLI is more desirable or not.
How to port an integration test
For how to port a test in practice you should read some of the recent commits that port tests here, it's boring but it's the most useful thing you can do to ramp up. For example:
cli/with-shebang
andcli/write
fixture folders, which were copied here and here respectively. The linked commit doesn't copy them over because they had been copied over already as they were needed for other tests.Now, if you want to help out I think we should do it this way:
runCli("cli/foo", ...
calls in it into the explicitly importedrunCli("foo", ...
calls. Tests are still executed via Jest, but in a different way, as I couldn't figure out the extremely convoluted way tests were being ran in the old implementation, so I reimplemented that differently, here's the new implementation. Some minor things are not implemented, like thestdoutIsTTY
option.npm run test
, which will execute the following:cross-env NODE_OPTIONS=--experimental-vm-modules jest --rootDir test/__tests__ --testTimeout 60000
.NODE_OPTIONS=--experimental-vm-modules npx jest --rootDir test/__tests__ FILE_NAME.js
. Now, if you are particularly lucky all tests will simply pass, in which case feel free to just make a PR with your changes, which I'll approve. Most probably there will be some issues, at this point we need to do some of the following:.skip
the test for now and deal with it later, or you can submit a patch for that too if you know what the change should be, or feel free to just ask about what should be done in the open issue or the open PR, some issues are weird.Basically just porting over the file with some
.skip
ped tests in it is already valuable, all changes should be known and documented in preparation of the changelog for the stable release, and for some failing tests we are fine with the new behavior so we can just tweak the tests, while for others there is actually something to change in the rewritten CLI or its dependencies.Almost every dependency of the rewritten CLI is something I maintain, so if something should be changed there it's not a problem to submit a patch there directly too, we don't need to wait on anybody else to fix things.
That's about it for porting tests over. The remaining work before a stable release can be made is basically about adding some extra tests for new options, and going over some of the TODOs and FIXMEs inlined in the repo.
Thanks for reading, and especially if you want to help! ❤️
Feel free to ping me anywhere you like if you need some clarifications or if you need to be unblocked on something.
The text was updated successfully, but these errors were encountered: