1
0
Эх сурвалжийг харах

feat(docs): Re-organize plugin API docs & plugins guide

Michael Bromley 6 жил өмнө
parent
commit
b46d201e8a

+ 0 - 2
.gitignore

@@ -21,8 +21,6 @@ docs/content/docs/typescript-api/*
 docs/data/build.json
 !docs/content/docs/typescript-api/_index.md
 docs/content/docs/graphql-api/*
-docs/content/docs/plugins/*
-!docs/content/docs/plugins/*.*
 !docs/content/docs/graphql-api/_index.md
 !docs/content/docs/graphql-api/shop/_index.md
 !docs/content/docs/graphql-api/admin/_index.md

+ 1 - 1
docs/content/blog/2019-08-28-summer-update/index.md

@@ -33,7 +33,7 @@ So in summary, Vendure should still be considered to be in "beta", as per the ma
 
 Over the past couple of months, a new version has been released roughly weekly. Each release typically includes a whole host of new features and fixes. Here are some highlights from the recent releases:
 
-* A new [plugin format]({{< ref "docs/plugins" >}}) which allows any [NestJS module](https://docs.nestjs.com/modules) to be plugged directly into Vendure. This major change allows you to harness the full power of NestJS in extending the Vendure server.
+* A new [plugin format]({{< ref "docs/developer-guide/plugins" >}}) which allows any [NestJS module](https://docs.nestjs.com/modules) to be plugged directly into Vendure. This major change allows you to harness the full power of NestJS in extending the Vendure server.
 * Extended [custom fields configuration options]({{< ref "docs/typescript-api/custom-fields" >}}). Now you can extend your models with a rich set of custom data types, as well as specifying contraints, defaults and validation functions.
 * A timeline view of each Order's history, including state transitions, payments, fulfillments and notes.
 * A vastly improved product creation flow in the Admin UI.

+ 1 - 1
docs/content/docs/developer-guide/customizing-models.md

@@ -33,4 +33,4 @@ With the example config above, the following will occur:
 
 1. The database schema will be altered and a column will be added for each custom field. Note: this step requires the [TypeORM synchronize option](https://typeorm.io/#/connection-options/common-connection-options) to be set to `true` as above.
 2. The GraphQL APIs will be modified on bootstrap to add the custom fields to the `Product` and `User` types respectively.
-3. If you are using the [admin-ui-plugin]({{< relref "/docs/plugins/admin-ui-plugin" >}}), the Admin UI detail pages will now contain form inputs to allow the custom field data to be added or edited.
+3. If you are using the [admin-ui-plugin]({{< relref "/docs/typescript-api/admin-ui-plugin" >}}), the Admin UI detail pages will now contain form inputs to allow the custom field data to be added or edited.

+ 1 - 1
docs/content/docs/developer-guide/overview/_index.md

@@ -32,4 +32,4 @@ Vendure supports multiple databases. Currently it is tested with MySQL/MariaDB,
 
 ## Custom Business Logic (Plugins)
 
-Not shown on the diagram (for the sake of simplicity) are plugins. Plugins are the mechanism by which you extend Vendure with your own business logic and functionality. See [the Plugins docs]({{< relref "/docs/plugins" >}})
+Not shown on the diagram (for the sake of simplicity) are plugins. Plugins are the mechanism by which you extend Vendure with your own business logic and functionality. See [the Plugins docs]({{< relref "/docs/developer-guide/plugins" >}})

+ 0 - 0
docs/content/docs/plugins/_index.md → docs/content/docs/developer-guide/plugins/_index.md


+ 0 - 0
docs/content/docs/plugins/plugin_architecture.png → docs/content/docs/developer-guide/plugins/plugin_architecture.png


+ 1 - 1
docs/content/docs/plugins/writing-a-vendure-plugin.md → docs/content/docs/developer-guide/plugins/writing-a-vendure-plugin.md

@@ -111,7 +111,7 @@ Some explanations of this code are in order:
 * The `@Resolver()` decorator tells Nest that this class contains GraphQL resolvers.
 * We are able to use Nest's dependency injection to inject an instance of our `CatFetcher` class into the constructor of the resolver. We are also injecting an instance of the built-in `ProductService` class, which is responsible for operations on Products.
 * We use the `@Mutation()` decorator to mark this method as a resolver for a mutation with the corresponding name.
-* The `@Allow()` decorator enables us to define permissions restrictions on the mutation. Only those users whose permissions include `UpdateCatalog` may perform this operation. For a full list of available permissions, see the [Permission enum]({{< relref "../graphql-api/admin/enums" >}}#permission).
+* The `@Allow()` decorator enables us to define permissions restrictions on the mutation. Only those users whose permissions include `UpdateCatalog` may perform this operation. For a full list of available permissions, see the [Permission enum]({{< relref "../../graphql-api/admin/enums" >}}#permission).
 * The `@Ctx()` decorator injects the current `RequestContext` into the resolver. This provides information about the current request such as the current Session, User and Channel. It is required by most of the internal service methods.
 * The `@Args()` decorator injects the arguments passed to the mutation as an object.
 

+ 8 - 0
packages/common/src/shared-types.ts

@@ -90,6 +90,14 @@ export interface AdminUiConfig {
     authTokenHeaderKey: string;
 }
 
+/**
+ * @description
+ * Defines extensions to the Admin UI application by specifying additional
+ * Angular [NgModules](https://angular.io/guide/ngmodules) which are compiled
+ * into the application.
+ *
+ * @docsCategory AdminUiPlugin
+ */
 export interface AdminUiExtension {
     id?: string;
     type: 'shared' | 'lazy';

+ 4 - 16
scripts/docs/generate-typescript-docs.ts

@@ -19,28 +19,16 @@ const sections: DocsSectionConfig[] = [
         sourceDirs: [
             'packages/core/src/',
             'packages/common/src/',
+            'packages/admin-ui-plugin/src/',
+            'packages/asset-server-plugin/src/',
+            'packages/email-plugin/src/',
+            'packages/elasticsearch-plugin/src/',
         ],
         exclude: [
             /generated-shop-types/,
         ],
         outputPath: 'typescript-api',
     },
-    {
-        sourceDirs: ['packages/asset-server-plugin/src/'],
-        outputPath: 'plugins',
-    },
-    {
-        sourceDirs: ['packages/email-plugin/src/'],
-        outputPath: 'plugins',
-    },
-    {
-        sourceDirs: ['packages/admin-ui-plugin/src/'],
-        outputPath: 'plugins',
-    },
-    {
-        sourceDirs: ['packages/elasticsearch-plugin/src/'],
-        outputPath: 'plugins',
-    },
 ];
 
 generateTypescriptDocs(sections);

+ 7 - 7
scripts/docs/typescript-docs-renderer.ts

@@ -1,21 +1,21 @@
 // tslint:disable:no-console
 import fs from 'fs-extra';
-import klawSync from 'klaw-sync';
 import path from 'path';
-import ts from 'typescript';
 
 import { assertNever } from '../../packages/common/src/shared-utils';
 
-import { deleteGeneratedDocs, generateFrontMatter } from './docgen-utils';
+import { generateFrontMatter } from './docgen-utils';
 import {
     ClassInfo,
-    DeclarationInfo, DocsPage,
+    DeclarationInfo,
+    DocsPage,
     EnumInfo,
     FunctionInfo,
-    InterfaceInfo, MethodParameterInfo,
-    ParsedDeclaration,
+    InterfaceInfo,
+    MethodParameterInfo,
     TypeAliasInfo,
-    TypeMap, VariableInfo,
+    TypeMap,
+    VariableInfo,
 } from './typescript-docgen-types';
 
 export class TypescriptDocsRenderer {