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

typing support for public capabilities of Greenwood #1250

Open
thescientist13 opened this issue Jun 21, 2024 · 2 comments
Open

typing support for public capabilities of Greenwood #1250

thescientist13 opened this issue Jun 21, 2024 · 2 comments
Labels
documentation Greenwood specific docs enhancement Improve something existing (e.g. no docs, new APIs, etc)
Milestone

Comments

@thescientist13
Copy link
Member

thescientist13 commented Jun 21, 2024

Summary

While Greenwood is a build tool without much of a public API other than its CLI and plugins, there are some areas that should probably provide typing to users through JSDocs, maybe TS but I'm not super keen on TypeScript in libraries.

Details

Most obvious ones that come to mind are:

  1. greenwood.config.js, even if just JS Docs style, ex.
    /** @type {import('@greenwood/cli').GreenwoodConfig} */
    export default {
      /* config options here */
    }
  2. plugins (and get rid of that silly ResourceInterface lol)
  3. Content as Data
  4. others?

We would also want to make sure we validate these through CI somehow, ideally using these config files in our own projects and / or test cases.


Raised in #1292 (comment), a good point was raised about authoring Greenwood plugins (and probably also _greenwood.config.js in TypeScript. Might need to make another issue for that once we can land this one first, unless its easy to do it all in one go with something like sucrase, which we are using now in WCC.

@thescientist13 thescientist13 added enhancement Improve something existing (e.g. no docs, new APIs, etc) documentation Greenwood specific docs labels Jun 21, 2024
@thescientist13 thescientist13 added this to the 1.0 milestone Jun 21, 2024
@thescientist13 thescientist13 changed the title typing support for public features typing support for public capabilities of Greenwood Jun 21, 2024
@lschierer
Copy link
Contributor

I do like writing my config files in typescript, with typing support, because it helps avoid problems where you write an invalid configuration file and unexpected things do and do not work. I'm not sure which is worse, when a program fails to start on an invalid config file and you have no clue why or where in the file you go something wrong because the file is entirely untyped, or where it loads a partial file and you can't tell if the config file is wrong or the feature doesn't work as expected.

@thescientist13
Copy link
Member Author

Indeed!

This will definitely be looked into as part of the next batch of work we take on (just finishing up a new release line as we speak), and for sure even just typing the configuration file alone would be a really nice quality of life enhancement; be it JS Doc style annotations, or just full on TS support, e.g. greenwood.config.ts. 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Greenwood specific docs enhancement Improve something existing (e.g. no docs, new APIs, etc)
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants