What might this look like:
Each of the folders within packages would have their own package.json file which would allow us to publish separate packages for katex itself as well as each of our extensions. Right now we bundle all of the extensions with each update to katex but the code in contrib hardly ever changes.
The devserver folder would have it's own package.json which would allow us to develop a more fully featured local testing app using React. Although it has it's own package.json we wouldn't publish this or website to npm.
Many of these packages will need to require each other as dependencies, e.g. katex-define-font would have katex as a dependency and devserver would require katex along with all the extension packages.
All of these dependencies can be managed relatively easily using yarn workspaces. The gist of workspaces is that all sub-package dependencies are hoisted into the root's node_modules folder. We've started doing this for a new project at Khan Academy and I've been quite pleased so far with the set up. See https://yarnpkg.com/lang/en/docs/workspaces/ for more details about yarn workspaces.
I was thinking the exactly same thing. Major projects like Babel, React, Jest, and many more already do this. And it can be easily done using tools like Lerna.
I think we can move katex-fonts and possibly katex-test-fonts repo back to the main repo. And for consistency, I think we can have devserver and website under the packages, but exclude them from publishing.
Some thoughts:
KaTeX/
โโโ .circleci/
โโโ docs/
โโโ devserver/
โโโ packages/
โ โโโ katex/
โ โ โโโ src/
โ โ โโโ test/
โ โโโ katex-auto-render/
โ โโโ katex-copy-tex/
โ โโโ katex-fonts/
โ โโโ katex-mathtex-script-type/
โ โโโ katex-screenshotter/
โ โโโ katex-texcmp/
โโโ scripts/
โ โโโ check-node-version.js
โ โโโ release.sh
โ โโโ update-sri.js
โโโ website/
Nice ascii diagram. Would katex-screenshot and katex-texcmp be dependencies of katex? We may also want to think about whether we want to publish scoped packages in the future. Scoped packages can maybe be a 2.0 kind of thing.
As part of this we might consider moving some of the configuration files in folders too. There are a lot of files at the root level which probably don't need to be there.
@kevinbarabash I wonder Khan Academy is still using Phabricator/Arcanist for KaTeX reviews. If not, we could remove .arcconfig, .arclint, and lint_blacklist.txt.
@ylemkimon we use phabricator internally for other projects and may have used it for the initial KaTeX development work. We can get rid of these on this repo.
Most helpful comment
Some thoughts: