@graphql-markdown/docusaurus 1.36.0 → 1.38.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.
package/README.md CHANGED
@@ -11,10 +11,10 @@
11
11
  ## Installation
12
12
 
13
13
  ```shell
14
- npm init docusaurus my-website https://github.com/graphql-markdown/template.git
14
+ npm create graphql-markdown-docs@latest -- --framework docusaurus
15
15
  ```
16
16
 
17
- > _If you already have an existing Docusaurus installation, then see the [documentation](https://graphql-markdown.dev/docs/get-started/#existing-docusaurus-site) for an alternative installation._
17
+ > _If you already have an existing Docusaurus installation, then see the [documentation](https://graphql-markdown.dev/docs/get-started/#existing-docusaurus-site) for alternative options._
18
18
 
19
19
  ## Usage
20
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAWzE;;;;;;;;GAQG;AACH,wBAA8B,yBAAyB,CACrD,CAAC,EAAE,WAAW,EACd,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,GAC1D,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AA4CzE;;;;;;;;GAQG;AACH,wBAA8B,yBAAyB,CACrD,CAAC,EAAE,WAAW,EACd,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,GAC1D,OAAO,CAAC,MAAM,CAAC,CAiCjB;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC"}
package/dist/index.js CHANGED
@@ -11,6 +11,16 @@ const logger_1 = __importDefault(require("@graphql-markdown/logger"));
11
11
  const NAME = "docusaurus-graphql-doc-generator";
12
12
  const LOGGER_MODULE = "@docusaurus/logger";
13
13
  const MDX_PACKAGE = "@graphql-markdown/docusaurus/mdx";
14
+ const isCommanderCompatibleCommand = (value) => {
15
+ return (typeof value === "object" &&
16
+ value !== null &&
17
+ typeof value.name === "function");
18
+ };
19
+ const assertCommanderCompatibleCommand = (value) => {
20
+ if (!isCommanderCompatibleCommand(value)) {
21
+ throw new TypeError("GraphQL-Markdown CLI command is not compatible with Docusaurus commander interface.");
22
+ }
23
+ };
14
24
  /**
15
25
  * Docusaurus plugin wrapper that wires GraphQL-Markdown into the build,
16
26
  * optionally running the CLI during `docusaurus build` and registering
@@ -33,17 +43,16 @@ async function pluginGraphQLDocGenerator(_, options) {
33
43
  * @returns void
34
44
  */
35
45
  extendCli(cli) {
36
- // @graphql-markdown/cli uses commander v15; @docusaurus/types types extendCli
37
- // with commander v5's Command. The two are structurally compatible at runtime
38
- // but TypeScript sees them as different types due to dual-version resolution.
39
- cli.addCommand((0, cli_1.getGraphQLMarkdownCli)({
46
+ const command = (0, cli_1.getGraphQLMarkdownCli)({
40
47
  ...options,
41
48
  docOptions: {
42
49
  generatorFrameworkName: "docusaurus",
43
50
  generatorFrameworkVersion: utils_1.DOCUSAURUS_VERSION,
44
51
  ...options.docOptions,
45
52
  },
46
- }, LOGGER_MODULE, options.formatter ?? options.mdxParser ?? MDX_PACKAGE));
53
+ }, LOGGER_MODULE, options.formatter ?? MDX_PACKAGE);
54
+ assertCommanderCompatibleCommand(command);
55
+ cli.addCommand(command);
47
56
  },
48
57
  };
49
58
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "bugs": {
6
6
  "url": "https://github.com/graphql-markdown/graphql-markdown/issues"
7
7
  },
8
- "version": "1.36.0",
8
+ "version": "1.38.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",