@graphql-markdown/docusaurus 1.20.3 → 1.21.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import type { LoadContext, Plugin, PluginOptions } from "@docusaurus/types";
2
+ export default function pluginGraphQLDocGenerator(_: LoadContext, options: PluginOptions): Plugin;
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@graphql-markdown/core");
4
+ const logger_1 = require("@graphql-markdown/logger");
5
+ const NAME = "docusaurus-graphql-doc-generator";
6
+ const COMMAND = "graphql-to-doc";
7
+ const DESCRIPTION = "Generate GraphQL Schema Documentation";
8
+ const DEFAULT_ID = "default";
9
+ function pluginGraphQLDocGenerator(_, options) {
10
+ const loggerModule = require.resolve("@docusaurus/logger");
11
+ (0, logger_1.Logger)(loggerModule);
12
+ const isDefaultId = options.id === DEFAULT_ID;
13
+ const command = isDefaultId ? COMMAND : `${COMMAND}:${options.id}`;
14
+ const description = isDefaultId
15
+ ? DESCRIPTION
16
+ : `${DESCRIPTION} for configuration with id ${options.id}`;
17
+ return {
18
+ name: NAME,
19
+ extendCli(cli) {
20
+ cli
21
+ .command(command)
22
+ .description(description)
23
+ .option("-s, --schema <schema>", "Schema location")
24
+ .option("-r, --root <rootPath>", "Root folder for doc generation")
25
+ .option("-b, --base <baseURL>", "Base URL to be used by Docusaurus")
26
+ .option("-l, --link <linkRoot>", "Root for links in documentation")
27
+ .option("-h, --homepage <homepage>", "File location for doc landing page")
28
+ .option("--noCode", "Disable code section for types")
29
+ .option("--noPagination", "Disable page navigation buttons")
30
+ .option("--noParentType", "Disable parent type name as field prefix")
31
+ .option("--noRelatedType", "Disable related types sections")
32
+ .option("--noToc", "Disable page table of content")
33
+ .option("--noTypeBadges", "Disable badges for types")
34
+ .option("--index", "Enable generated index for categories")
35
+ .option("-f, --force", "Force document generation")
36
+ .option("-d, --diff <diffMethod>", "Set diff method")
37
+ .option("-t, --tmp <tmpDir>", "Set temp dir for schema diff")
38
+ .option("-gbd, --groupByDirective <@directive(field|=fallback)>", "Group documentation by directive")
39
+ .option("--skip <@directive...>", "Skip type with matching directive")
40
+ .option("--deprecated <option>", "Option for printing deprecated entities: `default`, `group` or `skip`")
41
+ .option("--pretty", "Prettify generated files")
42
+ .action(async (cliOptions) => {
43
+ const config = await (0, core_1.buildConfig)(options, cliOptions, options.id);
44
+ await (0, core_1.generateDocFromSchema)({
45
+ ...config,
46
+ loggerModule: loggerModule,
47
+ });
48
+ });
49
+ },
50
+ };
51
+ }
52
+ exports.default = pluginGraphQLDocGenerator;
package/package.json CHANGED
@@ -5,12 +5,12 @@
5
5
  "bugs": {
6
6
  "url": "https://github.com/graphql-markdown/graphql-markdown/issues"
7
7
  },
8
- "version": "1.20.3",
8
+ "version": "1.21.0-next.0",
9
9
  "license": "MIT",
10
- "main": "src/index.js",
11
10
  "repository": {
12
11
  "type": "git",
13
- "url": "https://github.com/graphql-markdown/graphql-markdown.git"
12
+ "url": "graphql-markdown/graphql-markdown",
13
+ "directory": "packages/docusaurus"
14
14
  },
15
15
  "keywords": [
16
16
  "docusaurus",
@@ -24,15 +24,39 @@
24
24
  "author": {
25
25
  "name": "Gregory Heitz"
26
26
  },
27
+ "main": "dist/index.js",
28
+ "types": "dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "require": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "import": {
36
+ "types": "./dist/index.d.ts",
37
+ "default": "./dist/index.js"
38
+ },
39
+ "default": {
40
+ "types": "./dist/index.d.ts",
41
+ "default": "./dist/index.js"
42
+ }
43
+ },
44
+ "./package.json": "./package.json"
45
+ },
27
46
  "scripts": {
28
47
  "prepack": "pinst --disable",
29
48
  "postpack": "pinst --enable",
30
- "test": "jest",
31
- "stryker": "stryker run"
49
+ "stryker": "stryker run",
50
+ "clean": "rm -rf ./dist"
32
51
  },
33
52
  "dependencies": {
34
- "@graphql-markdown/core": "^1.6.3",
35
- "@graphql-markdown/printer-legacy": "^1.4.3"
53
+ "@graphql-markdown/core": "^1.7.0-next.0",
54
+ "@graphql-markdown/logger": "^1.0.0-next.0",
55
+ "@graphql-markdown/printer-legacy": "^1.5.0-next.0"
56
+ },
57
+ "devDependencies": {
58
+ "@docusaurus/types": "^2.4.1",
59
+ "@graphql-markdown/types": "^1.0.0-next.0"
36
60
  },
37
61
  "peerDependencies": {
38
62
  "@docusaurus/logger": "*"
@@ -44,6 +68,13 @@
44
68
  "node": ">=16.14"
45
69
  },
46
70
  "publishConfig": {
71
+ "directory": "dist",
47
72
  "access": "public"
48
- }
73
+ },
74
+ "typescript": {
75
+ "definition": "dist/index.d.ts"
76
+ },
77
+ "files": [
78
+ "dist"
79
+ ]
49
80
  }
package/src/index.js DELETED
@@ -1,70 +0,0 @@
1
- /* istanbul ignore file */
2
- const { generateDocFromSchema, config } = require("@graphql-markdown/core");
3
- const { logger: Logger } = require("@graphql-markdown/utils");
4
-
5
- const NAME = "docusaurus-graphql-doc-generator";
6
- const COMMAND = "graphql-to-doc";
7
- const DESCRIPTION = "Generate GraphQL Schema Documentation";
8
- const DEFAULT_ID = "default";
9
-
10
- // eslint-disable-next-line node/no-missing-require
11
- const LOGGER_MODULE = require.resolve("@docusaurus/logger");
12
-
13
- Logger.setInstance(LOGGER_MODULE);
14
-
15
- module.exports = function pluginGraphQLDocGenerator(_, configOptions) {
16
- const isDefaultId = configOptions.id === DEFAULT_ID;
17
-
18
- const command = isDefaultId ? COMMAND : `${COMMAND}:${configOptions.id}`;
19
- const description = isDefaultId
20
- ? DESCRIPTION
21
- : `${DESCRIPTION} for configuration with id ${configOptions.id}`;
22
-
23
- return {
24
- name: NAME,
25
- extendCli(cli) {
26
- cli
27
- .command(command)
28
- .description(description)
29
- .option("-s, --schema <schema>", "Schema location")
30
- .option("-r, --root <rootPath>", "Root folder for doc generation")
31
- .option("-b, --base <baseURL>", "Base URL to be used by Docusaurus")
32
- .option("-l, --link <linkRoot>", "Root for links in documentation")
33
- .option(
34
- "-h, --homepage <homepage>",
35
- "File location for doc landing page",
36
- )
37
- .option("--noCode", "Disable code section for types")
38
- .option("--noPagination", "Disable page navigation buttons")
39
- .option("--noParentType", "Disable parent type name as field prefix")
40
- .option("--noRelatedType", "Disable related types sections")
41
- .option("--noToc", "Disable page table of content")
42
- .option("--noTypeBadges", "Disable badges for types")
43
- .option("--index", "Enable generated index for categories")
44
- .option("-f, --force", "Force document generation")
45
- .option("-d, --diff <diffMethod>", "Set diff method")
46
- .option("-t, --tmp <tmpDir>", "Set temp dir for schema diff")
47
- .option(
48
- "-gbd, --groupByDirective <@directive(field|=fallback)>",
49
- "Group documentation by directive",
50
- )
51
- .option("--skip <@directive...>", "Skip type with matching directive")
52
- .option(
53
- "--deprecated <option>",
54
- "Option for printing deprecated entities: `default`, `group` or `skip`",
55
- )
56
- .option("--pretty", "Prettify generated files")
57
- .action(async (cliOptions) => {
58
- const options = config.buildConfig(
59
- configOptions,
60
- cliOptions,
61
- configOptions.id,
62
- );
63
- await generateDocFromSchema({
64
- ...options,
65
- loggerModule: LOGGER_MODULE,
66
- });
67
- });
68
- },
69
- };
70
- };