-
Notifications
You must be signed in to change notification settings - Fork 32
Transition to Yarn Workspaces #459
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
base: master
Are you sure you want to change the base?
Conversation
There are still many tasks left to be done, this is far from complete, but I thought I'd open this now for feedback. I'm especially concerned that the structure of the repository looks a lot more complex now, so I'm wondering if there's any need for simplifying things. |
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.
RFC: Effectively the modules repository has three kinds of documentation:
Should we unify all of these under one documentation server? I'm not even sure how we would go about doing that. I have also been experimenting with using Typedoc to generate Markdown that can be used with Vitepress to document things like our common React components library (which probably will need to become its own fully fledged thing in the future). |
@leeyi45 I agree we should move from GitHub Wiki to source code for docs, it's been something in my TODO for a while now. I also agree Vitepress is better, having (unsuccessfully tried Docusaurus in the past. Though I think since we are now moving it to source code, we should standardize and use something like markdownlint to format our Markdown files. My original plan for the above-linked repo was to continually pull documentation files from the various individual repositories (added as git submodules), but I am second-guessing it now since it seems like it would be quite messy hmm (though technically doable). |
Separately, given the size of codebase, do you have any thoughts on using biome/oxlint over Prettier/ESLint for formatting/linting? |
At some point I'm thinking about re-incorporating Prettier, but right now I think that would just contribute to the scope creep that this PR is becoming I have added some configuration to ESLint for linting our markdown and JSON files. Outside of ESLint I have no experience with any other linters so I can't comment on those. |
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.
Hmm, possible to run some of these steps in parallel using multiple jobs/a matrix strategy?
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.
I gave this a brief go, but I'm most certainly not experienced enough with Github Actions to make this work. I've left some of my work in the repository and have just left the old workflow in place
…installations work better
It runs for changed files that are changed relative to the master branch. I don't know why the CI is taking so long to run. If there is some way to like cache dependencies (especially skipping the playwright install phase) that would be great |
I figured out the issue: I think its worth investigating how to cache the libraries, but for now I think I've finally ironed out most of the issues. |
Transition to Yarn Workspaces
Yarn has supported Workspaces since Yarn 1, but it has matured over later versions and we can now use it since we have moved to using Yarn 4.
The main motivations for doing this are:
@jscad/modeling
patch forcsg
). Also each bundle/tab can customize its owntsconfig
etc..Migration to
vitest
This repository was migrated to
vitest
, which has been designed as a drop in replacement forjest
. I find that gettingjest
to work with the wide mix of ESM and CJS syntaxes has been a major headache, and configuration forjest
has always been needlessly complicated.vitest
supports TypeScript and ESM out of the box and has generally provided a far smoother experience, especially when dealing with dependencies that need to be tested (liketypedoc
).Playwright Testing
We haven't exactly been able to properly test the interactive functionalities of our tabs and other React components. Now, using playwright, we can do just that.
Further work needs to be done to figure out how to better handle playwright installation.
Why I hate Jest
Basically some scripts relied on__dirname
, which is only available in CJS, and so would not work if compiled to ESM. But the scripts also used top level await, so compiling to CJS wasn't an option. Thus,import.meta.dirname
would have to be used instead, but that meant thatjest
couldn't transform these files unless it was run in its experimental ESM mode, which would then cause many of the CJS bundled dependencies to break because they don't use imports with extensions.The alternatives would have been significantly bulkier
jest
configurations or major changes to the code, and even after trying both of those I still ended up with errors becausejest
wouldn't properly transform dependencies.Also because
jest
insists on transforming to CJS, we can't useverbatimModuleSyntax: true
intsconfig
, instead requiring some weird configuration as a workaround.Upgrading Module Manifests
This PR is the beginning of the steps required to address #57. Bundles will now be able to specify a
requires
field in their manifest that specifies the minimum version of Source that the bundle can be used with.A bundle manifest can now look like:
Each bundle specifies its own manifest, which is then collated by the build tools automatically.
Bundles will also be able to specify versions to help work toward resolving #79. The version field in
package.json
gets merged with the manifest during compilation.Vitepress Docs Server
The Modules Repo's wiki has been quite the disorganized mess (oops). While I was thinking about how to go about documenting the changes introduced by this repository I realized that we were probably going to need something more serious than the Github Wiki.
So I've begun porting the Wiki over to this new Vitepress server (found in
./docs
) whilst trying to update any outdated documentation.