|
|
%!s(int64=5) %!d(string=hai) anos | |
|---|---|---|
| .. | ||
| archetypes | %!s(int64=7) %!d(string=hai) anos | |
| assets | %!s(int64=5) %!d(string=hai) anos | |
| content | %!s(int64=5) %!d(string=hai) anos | |
| data | %!s(int64=5) %!d(string=hai) anos | |
| diagrams | %!s(int64=5) %!d(string=hai) anos | |
| layouts | %!s(int64=5) %!d(string=hai) anos | |
| static | %!s(int64=5) %!d(string=hai) anos | |
| README.md | %!s(int64=5) %!d(string=hai) anos | |
| build.js | %!s(int64=6) %!d(string=hai) anos | |
| config.toml | %!s(int64=5) %!d(string=hai) anos | |
| package.json | %!s(int64=5) %!d(string=hai) anos | |
| tsconfig.json | %!s(int64=7) %!d(string=hai) anos | |
| webpack.config.ts | %!s(int64=7) %!d(string=hai) anos | |
| yarn.lock | %!s(int64=5) %!d(string=hai) anos | |
This is the source for the Vendure documentation website. Docs are written in markdown and the website is generated with Hugo.
yarn install or npm install in this directory.docs:build script from the root of this repo.This task will:
docs/public directory.Run docs:watch when developing the docs site. This will run all of the above in watch mode, so you can go to http://localhost:1313 to view the docs site. It will auto-reload the browser on any changes to the server source, the docs script/styles assets, or the Hugo templates.
All of the documentation for the interal APIs (configuration docs) and the GraphQL API is auto-generated.
The GraphQL API docs are generated from the schema.json file which is created as part of the "generate-gql-types" script.
The configuration docs are generated from the TypeScript source files by running the "generate-config-docs" script:
yarn generate-config-docs [-w]
This script uses the TypeScript compiler API to traverse the server source code and extract data about the types as well as other information such as descriptions and default values.
Currently, any interface, class or type which includes the JSDoc @docCategory tag will be extracted into a markdown file in the content/docs/api directory. Hugo can then build the API documentation from these markdown files.
@docsCategoryThis is required as its presence determines whether the declaration is extracted into the docs. Its value should be a string corresponding to the API sub-section that this declaration belongs to, e.g. "payment", "shipping" etc.
@docsPageThis optional tag can be used to group declarations together onto a single page. This is useful e.g. in the case of utility functions or type aliases, which may be considered too trivial to get an entire page to themselves.
@docsWeightThis optional tag can be used to define the order of definitions on a single page. By default, multiple definitions on a page are sorted alphabetically,
but this sometimes leaves the "main" definition near the bottom. In this case, the @docsWeight tag can promote it to the top (0 is first).
@descriptionThis tag specifies the text description of the declaration. It supports markdown, but should not be used for code blocks, which should be tagged with @example (see below). Links to other declarations can be made with the {@link SomeOtherDeclaration} syntax. Also applies to class/interface members.
@exampleThis tag should be used to include any code blocks. Remember to specify the language after the opening delimiter for correct highlighting. Also applies to class/interface members.
@defaultThis is used to specify the default value of a property, e.g. when documenting an optional configuration option.
@internalThis is used to exlude members from appearing in the docs. For example, a class may need a particular public method for internal use, but this method is not intended to be used by external consumers of that class.
/**
* @description
* Greets people with a friendly message.
* Used by the {@link AppInitializer} during the start-up process.
*
* @example
* ```ts
* const greeter = new Greeter();
* console.log(greeter.greet('mike'));
* // -> 'Hi, mike, good to see you!'
* ```
*
* @docsCategory helpers
*/
export class Greeter {
/**
* @description
* Greets the person by name
*/
greet(name: string): string {
return `Hi, ${name}, good to see you!`;
}
/**
* Required as a work-around for issue #1234
* @internal
*/
someMethodUsedOnlyByVendureCore() {
// ...
}
}
The docs site also uses the Clarity icons to maintain consistency with the Vendure admin ui app. However, currently this bug makes the use of the custom-elements based icons unfeasible since it adds about 400kb to the JS bundle size. This is unacceptable for what is essentially a static HTML site.
So for now we are hand-picking the icons as svg files from https://icongr.am/clarity and using them as regular images. The downside is that to get different colours, the svg files themselves must be edited.
This is a pain but for the small number of icons planned, it is workable.