Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

feat: auto-generate operator README.mdx #65

Merged

Conversation

jvallesm
Copy link
Collaborator

@jvallesm jvallesm commented Feb 23, 2024

What is the purpose of this PR?

CleanShot 2024-02-23 at 12 31 08

Because

  • Component docs get outdated easily and keeping them up-to-date is a (mostly) mechanical task.

This PR

Excluded operators

  • start and end, as their structure is special and shouldn't be treated as operators
  • image, as $ref schema isn't supported by compogen yet

Next steps / improvements

The main goal of compogen is minimizing the maintenance cost of the component docs at instill.tech. That's why the output is an MDX document. However, having a Markdown version of the document would be beneficial for developers using this repository, removing the need to access an external website (or offering the rendered Markdown in GitHub at the root of the component). Transforming MDX to Markdown should be feasible but I didn't manage to automate the process.

It would be interesting to add input / output code samples, either by adding an example field at the task level in tasks.json or by checking if all the required fields have an example field.

If this proves useful and production-ready, we can implement an GitHub action that generates the documents automatically when changes are introduced in tasks.json or definitions.json. We can even push these changes to the website repo.

- When validating the field for README autogeneration, the field didn't
  pass go-playground/validator `url` validator.
- When rendering the value in a README, it reference a relative path
  instead of an absolute one.

Automatically updated with some `jq` magic:

```sh
for p in $(fd definitions.json); do
  jq '.[0].source_url = "https://" + .[0].source_url ' $p > tmp.json && mv tmp.json $p
done;
```
Just running go generate ./... will update the documents.
This is a requirement for README doc auto-generation
@jvallesm jvallesm self-assigned this Feb 23, 2024
Copy link

linear bot commented Feb 23, 2024

@jvallesm jvallesm marked this pull request as ready for review February 23, 2024 11:33
Copy link

codecov bot commented Feb 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.84%. Comparing base (ca146c3) to head (66aae12).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #65   +/-   ##
=======================================
  Coverage   70.84%   70.84%           
=======================================
  Files           7        7           
  Lines         758      758           
=======================================
  Hits          537      537           
  Misses        175      175           
  Partials       46       46           
Flag Coverage Δ
unittests 70.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Some operators are excluded:

- `start` and `end` as their structure is special and shouldn't be
  treated as operators
- `image` as `$ref` schema isn't supported by `compogen` yet
@jvallesm jvallesm force-pushed the jvalles/ins-3584-create-component-readme-through-templates branch from 7111cd4 to 66aae12 Compare February 26, 2024 06:57
@jvallesm jvallesm merged commit 0647a26 into main Feb 26, 2024
10 checks passed
@jvallesm jvallesm deleted the jvalles/ins-3584-create-component-readme-through-templates branch February 26, 2024 07:01
donch1989 pushed a commit that referenced this pull request Feb 29, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.9.0-beta](v0.8.0-beta...v0.9.0-beta)
(2024-02-29)


### Features

* auto-generate operator README.mdx
([#65](#65))
([0647a26](0647a26))


### Bug Fixes

* add missing `array:` instillFormat in operator output
([#63](#63))
([ca146c3](ca146c3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants