What if CodeMirror v6 dev setup uses Degit internally to clone packages?

In this article, we explore the idea of using Degit to clone/download core/non core packages required to setup the development environment for CodeMirror V6.

Pay attention to the run function in the above image.

run("git", ["clone", origin, pkg.dir])

What this does is that it uses child_process execSyncFile API to execute this “git clone” command programmatically in Node.js. But instead of cloning, what if we use degit? you might be wondering what a degit is at this point.

Degit

degit makes copies of git repositories. When you run degit some-user/some-repo, it will find the latest commit on https://github.com/some-user/some-repo and download the associated tar file to ~/.degit/some-user/some-repo/commithash.tar.gz if it doesn’t already exist locally. (This is much quicker than using git clone, because you’re not downloading the entire git history.)

Degit can quickly download the latest commit of any public repository but this does not get you the entire
history.

Would it make sense to use Degit?

Short answer — no, long answer would be CodeMirror does not use monorepo architecture and clones public repositories from CodeMirror organization. What Degit does is it downloads the latest commit of all these packages that make up the CodeMirror but it does not have entire git history

Without Git history, you can’t blame anyone, you wouldn’t know who changed a line of code when there is no history. Degit can be used to download templates/starters to download the latest commit and make it quick. Remotion uses degit

Since this clone execution is part of development setup for CodeMirror v6, you would definitely want the entire git history of core/non core packages used.

About us:

At Thinkthroo, we study large open source projects and provide architectural guides. We have developed reusable Components, built with tailwind, that you can use in your project. We offer Next.js, React and Node development services.

Book a meeting with us to discuss your project.

References

1. https://github.com/Rich-Harris/degit
2. https://github.com/codemirror/dev/blob/main/bin/cm.js#L90C7-L90C45
3. https://github.com/codemirror/dev/blob/main/bin/cm.js#L64-L66
4. https://github.com/remotion-dev/remotion/blob/main/packages/create-video/src/degit.ts