Skip to content

Commit

Permalink
docs: Fix code blocks, regenerate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Oct 9, 2023
1 parent 41363e9 commit f68be40
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ type RegisterRouteComponentOptions<Component extends any | BaseDetailComponent<E
path?: string;
query?: T;
getBreadcrumbs?: (entity: Exclude<ResultOf<T>[R], 'Query'>) => BreadcrumbValue;
entityKey?: Component extends BaseDetailComponent<Entity> ? R : undefined;
entityKey?: Component extends BaseDetailComponent<any> ? R : undefined;
variables?: T extends TypedDocumentNode<any, infer V> ? Omit<V, 'id'> : never;
routeConfig?: Route;
} & (Component extends BaseDetailComponent<Entity> ? { entityKey: R } : unknown)
} & (Component extends BaseDetailComponent<any> ? { entityKey: R } : unknown)
```
78 changes: 39 additions & 39 deletions docs/docs/reference/admin-ui-api/ui-devkit/admin-ui-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ import MemberDescription from '@site/src/components/MemberDescription';

<GenerationInfo sourceFile="packages/ui-devkit/src/compiler/types.ts" sourceLine="98" packageName="@vendure/ui-devkit" />

Defines extensions to the Admin UI application by specifying additional
Angular [NgModules](https://angular.io/guide/ngmodules) which are compiled
into the application.

See [Extending the Admin UI](/guides/extending-the-admin-ui/getting-started/) for
Defines extensions to the Admin UI application by specifying additional
Angular [NgModules](https://angular.io/guide/ngmodules) which are compiled
into the application.

See [Extending the Admin UI](/guides/extending-the-admin-ui/getting-started/) for
detailed instructions.

```ts title="Signature"
interface AdminUiExtension extends Partial<TranslationExtension>,
Partial<StaticAssetExtension>,
interface AdminUiExtension extends Partial<TranslationExtension>,
Partial<StaticAssetExtension>,
Partial<GlobalStylesExtension> {
id?: string;
extensionPath: string;
ngModules?: Array<AdminUiExtensionSharedModule | AdminUiExtensionLazyModule>;
providers?: string[];
routes?: Array<{
route: string;
filePath: string;
routes?: Array<{
route: string;
filePath: string;
}>;
pathAlias?: string;
exclude?: string[];
Expand All @@ -46,14 +46,14 @@ interface AdminUiExtension extends Partial<TranslationExtension>,

<MemberInfo kind="property" type={`string`} />

An optional ID for the extension module. Only used internally for generating
An optional ID for the extension module. Only used internally for generating
import paths to your module. If not specified, a unique hash will be used as the id.
### extensionPath

<MemberInfo kind="property" type={`string`} />

The path to the directory containing the extension module(s). The entire contents of this directory
will be copied into the Admin UI app, including all TypeScript source files, html templates,
The path to the directory containing the extension module(s). The entire contents of this directory
will be copied into the Admin UI app, including all TypeScript source files, html templates,
scss style sheets etc.
### ngModules

Expand All @@ -64,27 +64,27 @@ One or more Angular modules which extend the default Admin UI.

<MemberInfo kind="property" type={`string[]`} />

Defines the paths to a file that exports an array of shared providers such as nav menu items, custom form inputs,
Defines the paths to a file that exports an array of shared providers such as nav menu items, custom form inputs,
custom detail components, action bar items, custom history entry components.
### routes

<MemberInfo kind="property" type={`Array&#60;{ route: string; filePath: string; }&#62;`} />
<MemberInfo kind="property" type={`Array&#60;{ route: string; filePath: string; }&#62;`} />

Defines routes that will be lazy-loaded at the `/extensions/` route. The filePath should point to a file
Defines routes that will be lazy-loaded at the `/extensions/` route. The filePath should point to a file
relative to the `extensionPath` which exports an array of Angular route definitions.
### pathAlias

<MemberInfo kind="property" type={`string`} />

An optional alias for the module so it can be referenced by other UI extension modules.

By default, Angular modules declared in an AdminUiExtension do not have access to code outside the directory
defined by the `extensionPath`. A scenario in which that can be useful though is in a monorepo codebase where
a common NgModule is shared across different plugins, each defined in its own package. An example can be found
below - note that the main `tsconfig.json` also maps the target module but using a path relative to the project's
root folder. The UI module is not part of the main TypeScript build task as explained in
[Extending the Admin UI](https://www.vendure.io/docs/plugins/extending-the-admin-ui/) but having `paths`
properly configured helps with usual IDE code editing features such as code completion and quick navigation, as
An optional alias for the module so it can be referenced by other UI extension modules.

By default, Angular modules declared in an AdminUiExtension do not have access to code outside the directory
defined by the `extensionPath`. A scenario in which that can be useful though is in a monorepo codebase where
a common NgModule is shared across different plugins, each defined in its own package. An example can be found
below - note that the main `tsconfig.json` also maps the target module but using a path relative to the project's
root folder. The UI module is not part of the main TypeScript build task as explained in
[Extending the Admin UI](https://www.vendure.io/docs/plugins/extending-the-admin-ui/) but having `paths`
properly configured helps with usual IDE code editing features such as code completion and quick navigation, as
well as linting.

*Example*
Expand Down Expand Up @@ -163,7 +163,7 @@ export class SampleUiExtensionModule {}

<MemberInfo kind="property" type={`string[]`} />

Optional array specifying filenames or [glob](https://github.com/isaacs/node-glob) patterns that should
Optional array specifying filenames or [glob](https://github.com/isaacs/node-glob) patterns that should
be skipped when copying the directory defined by `extensionPath`.

*Example*
Expand All @@ -180,7 +180,7 @@ exclude: ['**/*.spec.ts']

<GenerationInfo sourceFile="packages/ui-devkit/src/compiler/types.ts" sourceLine="18" packageName="@vendure/ui-devkit" />

Defines extensions to the Admin UI translations. Can be used as a stand-alone extension definition which only adds translations
Defines extensions to the Admin UI translations. Can be used as a stand-alone extension definition which only adds translations
without adding new UI functionality, or as part of a full <a href='/reference/admin-ui-api/ui-devkit/admin-ui-extension#adminuiextension'>AdminUiExtension</a>.

```ts title="Signature"
Expand All @@ -195,9 +195,9 @@ interface TranslationExtension {

<MemberInfo kind="property" type={`{ [languageCode in <a href='/reference/typescript-api/common/language-code#languagecode'>LanguageCode</a>]?: string }`} />

Optional object defining any translation files for the Admin UI. The value should be an object with
the key as a 2-character [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes),
and the value being a [glob](https://github.com/isaacs/node-glob) for any relevant
Optional object defining any translation files for the Admin UI. The value should be an object with
the key as a 2-character [ISO 639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes),
and the value being a [glob](https://github.com/isaacs/node-glob) for any relevant
translation files in JSON format.

*Example*
Expand Down Expand Up @@ -231,7 +231,7 @@ interface StaticAssetExtension {

<MemberInfo kind="property" type={`<a href='/reference/admin-ui-api/ui-devkit/admin-ui-extension#staticassetdefinition'>StaticAssetDefinition</a>[]`} />

Optional array of paths to static assets which will be copied over to the Admin UI app's `/static`
Optional array of paths to static assets which will be copied over to the Admin UI app's `/static`
directory.


Expand All @@ -256,7 +256,7 @@ interface GlobalStylesExtension {

<MemberInfo kind="property" type={`string[] | string`} />

Specifies a path (or array of paths) to global style files (css or Sass) which will be
Specifies a path (or array of paths) to global style files (css or Sass) which will be
incorporated into the Admin UI app global stylesheet.


Expand All @@ -281,7 +281,7 @@ interface SassVariableOverridesExtension {

<MemberInfo kind="property" type={`string`} />

Specifies a path to a Sass style file containing variable declarations, which will take precedence over
Specifies a path to a Sass style file containing variable declarations, which will take precedence over
default values defined in Clarity.


Expand All @@ -292,7 +292,7 @@ default values defined in Clarity.

<GenerationInfo sourceFile="packages/ui-devkit/src/compiler/types.ts" sourceLine="251" packageName="@vendure/ui-devkit" />

A static asset can be provided as a path to the asset, or as an object containing a path and a new
A static asset can be provided as a path to the asset, or as an object containing a path and a new
name, which will cause the compiler to copy and then rename the asset.

```ts title="Signature"
Expand Down Expand Up @@ -320,8 +320,8 @@ interface AdminUiExtensionSharedModule {

<MemberInfo kind="property" type={`'shared'`} />

Shared modules are directly imported into the main AppModule of the Admin UI
and should be used to declare custom form components and define custom
Shared modules are directly imported into the main AppModule of the Admin UI
and should be used to declare custom form components and define custom
navigation items.
### ngModuleFileName

Expand Down Expand Up @@ -359,14 +359,14 @@ interface AdminUiExtensionLazyModule {

<MemberInfo kind="property" type={`'lazy'`} />

Lazy modules are lazy-loaded at the `/extensions/` route and should be used for
Lazy modules are lazy-loaded at the `/extensions/` route and should be used for
modules which define new views for the Admin UI.
### route

<MemberInfo kind="property" type={`string`} />

The route specifies the route at which the module will be lazy-loaded. E.g. a value
of `'foo'` will cause the module to lazy-load when the `/extensions/foo` route
The route specifies the route at which the module will be lazy-loaded. E.g. a value
of `'foo'` will cause the module to lazy-load when the `/extensions/foo` route
is activated.
### ngModuleFileName

Expand Down
Loading

0 comments on commit f68be40

Please sign in to comment.