diff --git a/docs/tooling/package-metadata.md b/docs/tooling/package-metadata.md index 673fe57edc..e5bd2b55cf 100644 --- a/docs/tooling/package-metadata.md +++ b/docs/tooling/package-metadata.md @@ -37,3 +37,17 @@ If you are creating a module for an existing package that is not part of your pr ### `repository` This field can be generated by the `backstage-cli repo fix --publish` command. The only requirement is that the `package.json` in your workspace root has the `repository` field documented. + +### `main` + +The main entry point of the package, pointing to the source file for development. This field along with other entry point fields such as `module` and `types` are rewritten when packaging the package for distribution. You can read more about this process in the [publishing](./cli/02-build-system.md#publishing) section, and it is also used for [backend production builds](./cli/02-build-system.md#backend-production). + +### `exports` + +The exports of the package, as defined by [Node.js](https://nodejs.org/api/packages.html#exports). This field is used to define the entry points of the package. As with other entry point fields, the exports should point to source files for development. They will the be rewritten when packaging the package for distribution. You can read more about this in the [sub-path exports](./cli/02-build-system.md#subpath-exports) section. + +### `typeVersions` + +This field is used to specify the type entry points for the package, the TypeScript equivalent of the `exports` field. TypeScript also supports defining this in the `exports` field, but that requires that the `moduleResolution` option in `tsconfig.json` is set to `node16` or `bundler`, which we currently do not support. + +This field can be generated by the `backstage-cli repo fix` command. First fill out the `exports` field to point to source fields, which will then be used to generate the `typeVersions`.