Skip to content
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

RFC: Putting code, tests and docs of plugins next to each other #443

Open
not-my-profile opened this issue Jul 6, 2023 · 1 comment
Open

Comments

@not-my-profile
Copy link
Contributor

not-my-profile commented Jul 6, 2023

The files making up a plugin are currently scattered across three different locations:

  • plugins/ in the lume repository contains the actual code, e.g. plugins/katex.ts
  • tests/ in the lume repository contains the test code, e.g. tests/katex.test.ts
  • plugins/ in the lume.land repository contains the documentation, e.g. plugins/katex.md

I think it would make sense to instead put all these files next to each other in this repository, e.g. we could have:

  • plugins/katex/katex.ts
  • plugins/katex/katex.test.ts
  • plugins/katex/README.md

The reasoning being that if you update the code, you likely also should update the tests and the documentation as well and that's easier to do when the files are all next to each other. Putting them next to each other also makes it easier to spot discrepancies. (Especially having the .md files in another repository makes contributing to plugins more difficult since you'd often need two PRs.)

@not-my-profile not-my-profile changed the title RFC: Putting code, tests and documentation of plugins next to each other RFC: Putting code, tests and docs of plugins next to each other Jul 6, 2023
@oscarotero
Copy link
Member

oscarotero commented Jul 6, 2023

Yeah, it makes sense but I can see some drawbacks:

  • From users POV, it requires to repeat the plugin name in the imported url. It's clearer to import it from lume/plugins/katext.ts thank lume/plugins/katext/katext.ts.
  • It's a breaking change: all sites built with Lume would break
  • Tests are not only TypeScript files (like katex.test.ts) but they need assets (stored in /tests/assets) and they generate snapshots (stored in /tests/__snapshots__).
  • Some plugins need other plugins to work. For example, Tailwind requires Postcss, or SourceMap is used by other plugins like Postcss, Esbuild, SASS, etc.
  • We must to figure out a way to import the plugins documentation in the lume.land site if they are in different repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants