Open cspotcode opened 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
š Inspect: https://vercel.com/formium/tsdx/a53gz5xvv
ā
Preview: https://tsdx-git-yarn2.formium.vercel.app
This PR is marked draft because it is still a work in progress, so it's expected to be broken. I created it so I could ping @merceyz who wanted to follow along.
I got all the tests passing in yarn2. PR is still marked "draft" because the yarn folks have sent a bugfix to jest that may allow me to simplify and speed up the changes I had to make here.
rollup-plugin-pnp-resolve wasn't added but is mentioned in #688 (comment) and #458 (comment)
resolve
, which is used by @rollup/plugin-node-resolve
, has PnP support so that rollup plugin isn't needed anymore.
@agilgur5 thanks for taking a look, I'm working through the review feedback. I've left comments on a few things, am pushing fixes for some, and for other things like jest presets, I'll need to do some research.
It has been helpful to let Github Actions run the tests while I work, which is why I've been pushing code here as I go. Understanding that you've muted this thread, is it ok if I keep pushing code as I go? I can ping you only once I've addressed all review feedback.
I got rid of the npm misnomer and trimmed down the test matrix.
I've reverted the package.json changes. I did some testing and they were only necessary when running jest under PnP. In another branch I'm going to re-implement the changes to run jest under PnP, which should simplify the tests, eliminate some of the messier changes to test infra, and enable unit-testing. I'll see if/how many dependency changes are necessary.
Great to see so much progress on this, if there is a list of follow up tasks that would be great to get some others to input on those.
I mentioned before I would like to sponsor such efforts and I'd like to honour that, please sign up for issuehunt!
@timini how does issuehunt work? Do I need to sign up, or does the tsdx team need to sign up?
As far as getting other people involved with the remaining work, I added a checklist of tasks to the issue description, but at the moment it's a bit messy. I am also iterating in another branch and merging to this PR when major improvements are ready. Trying to cut down on spam over here. https://github.com/cspotcode/tsdx/pull/4
Perhaps more useful than the checklist, I added instructions for installing and testing this version of tsdx today. Yarn 2 users, please feel free to give it a shot on your projects and let me know what's still broken.
Tested creating a yarn 2 monorepo using workspaces. So far i have no issues, i had to setup a tsconfig.json at the workspace root which is extended by the workspace packages
I have done very minimal project setup so far, but it looked promising, its based off https://github.com/cspotcode/tsdx#yarn2
I haven't tried with main line tsdx.
Are there any tests i should make? Is it possible to add tests for this kind of monorepo setup?
OK i tested the same setup using main branch tsdx and encountered issues with yarn install. It seems those issues are resolved by https://github.com/cspotcode/tsdx#yarn2
@timini the "changed I've had to make" section of the OP lists fixes I made for compatibility. The yarn2 bugfix has since been merged and released, so shouldn't be necessary any more. Are you using the latest stable yarn 2?
I'm starting to work on yarn 2 compatibility. I'll see how far I can get.
Try it out today
Yarn 2 users, you can try this branch today and let me know what does / does not work.
I am also working at this other PR so that I can push frequently for CI to run without spamming this thread: https://github.com/cspotcode/tsdx/pull/4
Changes I've had to make:
src/templates/react.ts
src/createJestConfig.ts
Could not find source file:
Related issues that may / may not need fixes
npx tsdx create mylib
worksSimplifications since the last review
This is a list of undesirable changes from my initial submission that I have reverted
yarn
and useprocess.versions.pnp
to detect yarn2jest
runs under pnp, no more spawning externalyarn
processesrequire()
ing them in-processstage-*
directories are no longer being moved elsewhereRelated links: (note to self explain why they're relevant) https://github.com/facebook/jest/pull/10847 https://github.com/facebook/create-react-app/pull/5270