Skip to content

README generation and repo specific package metadata

Karsten Schmidt edited this page Jan 11, 2024 · 3 revisions

Work is underway adding various pieces of metadata to all packages to provide better (and more unified) documentation and facilitate related infrastructure. Currently, this metadata is only used for the generation of README.md files for each package in the repo, however, I imagine these data points also feeding into other documentation efforts in the future.

The script generating the new readme files is located here: /tools/src/readme.ts.

The script uses a package's tpl.readme.md template file and the following data fields in package.json.

Note for contributors: Please only ever edit the tpl.readme.md files, since README.md files will be generated from those templates.

package.json fields

name

Full package name

description

brief package overview

dependencies

Formatted as a list of links to dependencies

thi.ng

An object of project-specific metadata with the following keys (all are optional, as is the presence of the object itself):

blog

An array of { title: string, url: string } objects to related blog posts

branch

Name of the (feature) branch to use in links. Mainly intended for upcoming/WIP packages.

parent

Fully qualified name of parent package (only used in support packages).

related

Array of short package names related (but not a dependency) to this package.

status

A string indicating general development status, one of:

  • "alpha" - bleeding edge / work-in-progress
  • "beta" - possibly breaking changes forthcoming
  • "stable" - used in production
  • "refactor" - undergoing major refactoring

year

Year the project was started (for copyright message)

Example project metadata

The thi.ng object can also be used in example projects (under /examples) and uses these relevant fields:

readme

A boolean (default: false) or an array of short package names (i.e. without the @thi.ng/ scope prefix). The example will only be included in the readme file if the value is true or the package name for which the readme is being generated is in the list.

screenshot

An image path to a screenshot (or another related image), relative to the repo's /assets directory.

Other metadata planned

api

Unique function reference names referring to TSDoc refs in the API JSON reports generated by API extractor. The switch to this new doc system and the refactoring/updating of doc strings in all packages is ongoing separately on the feature/api-extractor branch, and once ready, will hopefully provide some easy ways to inject a selection of curated API docs into the readme... A test repo with the generated results is here:

https://github.com/thi-ng/umbrella-docs-temp/blob/master/index.md

The api metadata field would be an array of TSDoc refs to include docs for and would then be looked up from the .ae/<packagename>.api.json reports.

AUTHORS.md

The readme.ts script also uses AUTHORS.md files to inject contributor details into the readme.