@graphcommerce/graphql-codegen-markdown-docs 6.0.0-canary.26 → 6.0.0-canary.28

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/CHANGELOG.md ADDED
@@ -0,0 +1,309 @@
1
+ # Change Log
2
+
3
+ ## 6.0.0-canary.28
4
+
5
+ ## 6.0.0-canary.27
6
+
7
+ ## 6.0.0-canary.26
8
+
9
+ ## 6.0.0-canary.25
10
+
11
+ ## 6.0.0-canary.24
12
+
13
+ ## 6.0.0-canary.23
14
+
15
+ ## 6.0.0-canary.22
16
+
17
+ ## 6.0.0-canary.21
18
+
19
+ ## 6.0.0-canary.20
20
+
21
+ ## 5.2.0-canary.12
22
+
23
+ ## 5.2.0-canary.11
24
+
25
+ ## 5.2.0-canary.10
26
+
27
+ ## 5.2.0-canary.9
28
+
29
+ ## 5.2.0-canary.8
30
+
31
+ ## 5.2.0-canary.7
32
+
33
+ ## 5.2.0-canary.6
34
+
35
+ ## 5.2.0-canary.5
36
+
37
+ ## 5.2.0-canary.4
38
+
39
+ ## 5.2.0-canary.3
40
+
41
+ ## 5.2.0-canary.2
42
+
43
+ ## 5.2.0-canary.1
44
+
45
+ ## 5.2.0-canary.0
46
+
47
+ ## 5.1.1
48
+
49
+ ## 5.1.1-canary.1
50
+
51
+ ## 5.1.1-canary.0
52
+
53
+ ## 5.1.0
54
+
55
+ ### Patch Changes
56
+
57
+ - [#1752](https://github.com/graphcommerce-org/graphcommerce/pull/1752) [`2a6a4d9ec`](https://github.com/graphcommerce-org/graphcommerce/commit/2a6a4d9ecfa1b58a66ba9b9d00016d6feda9aa95) - Updated dependencies to latest versions, except for nextjs; Solve tons of peer dependency issues.
58
+
59
+ - Updated the @mui/material package
60
+ - Removed dependencies on react-hook-form-mui and @playwright/test
61
+ - Upgraded dependencies including type-fest and graphql-mesh
62
+ - Solved peer dependency issues ([@paales](https://github.com/paales))
63
+
64
+ ## 5.1.0-canary.11
65
+
66
+ ## 5.1.0-canary.10
67
+
68
+ ## 5.1.0-canary.9
69
+
70
+ ## 5.1.0-canary.8
71
+
72
+ ## 5.1.0-canary.7
73
+
74
+ ## 5.1.0-canary.6
75
+
76
+ ## 5.1.0-canary.5
77
+
78
+ ## 5.1.0-canary.4
79
+
80
+ ## 5.1.0-canary.3
81
+
82
+ ### Patch Changes
83
+
84
+ - [#1752](https://github.com/graphcommerce-org/graphcommerce/pull/1752) [`2a6a4d9ec`](https://github.com/graphcommerce-org/graphcommerce/commit/2a6a4d9ecfa1b58a66ba9b9d00016d6feda9aa95) - Updated dependencies to latest versions, except for nextjs; Solve tons of peer dependency issues.
85
+
86
+ - Updated the @mui/material package
87
+ - Removed dependencies on react-hook-form-mui and @playwright/test
88
+ - Upgraded dependencies including type-fest and graphql-mesh
89
+ - Solved peer dependency issues ([@paales](https://github.com/paales))
90
+
91
+ ## 5.1.0-canary.2
92
+
93
+ ## 5.1.0-canary.1
94
+
95
+ ## 5.1.0-canary.0
96
+
97
+ ## 5.0.0
98
+
99
+ ### Major Changes
100
+
101
+ - [#1734](https://github.com/graphcommerce-org/graphcommerce/pull/1734) [`e4c7fe17e`](https://github.com/graphcommerce-org/graphcommerce/commit/e4c7fe17e413e37362ceae92e67f1b3a5f62d398) - Bump major version of all packages ([@github-actions](https://github.com/apps/github-actions))
102
+
103
+ ### Minor Changes
104
+
105
+ - [#1738](https://github.com/graphcommerce-org/graphcommerce/pull/1738) [`bd3a30438`](https://github.com/graphcommerce-org/graphcommerce/commit/bd3a30438cf6b69cd37a191406c8190a20e572cc) - Created directive @env(if: String!) on FRAGMENT_DEFINITION to conditionally include a fragment ([@paales](https://github.com/paales))
106
+
107
+ ## 5.0.0-canary.14
108
+
109
+ ## 4.0.0-canary.1
110
+
111
+ ### Major Changes
112
+
113
+ - [`e4c7fe17e`](https://github.com/graphcommerce-org/graphcommerce/commit/e4c7fe17e413e37362ceae92e67f1b3a5f62d398) - Bump major version of all packages ([@paales](https://github.com/paales))
114
+
115
+ ## 3.1.0-canary.0
116
+
117
+ ### Minor Changes
118
+
119
+ - [#1738](https://github.com/graphcommerce-org/graphcommerce/pull/1738) [`bd3a30438`](https://github.com/graphcommerce-org/graphcommerce/commit/bd3a30438cf6b69cd37a191406c8190a20e572cc) - Created directive @env(if: String!) on FRAGMENT_DEFINITION to conditionally include a fragment ([@paales](https://github.com/paales))
120
+
121
+ ## 3.0.19
122
+
123
+ ### Patch Changes
124
+
125
+ - [#1702](https://github.com/graphcommerce-org/graphcommerce/pull/1702) [`abb15ef4a`](https://github.com/graphcommerce-org/graphcommerce/commit/abb15ef4a79b12eddb32cc006e5d1d31dd06ac2d) Thanks [@paales](https://github.com/paales)! - Added canary releases to GraphCommerce
126
+
127
+ ## 3.0.19-canary.0
128
+
129
+ ### Patch Changes
130
+
131
+ - [`abb15ef4a`](https://github.com/graphcommerce-org/graphcommerce/commit/abb15ef4a79b12eddb32cc006e5d1d31dd06ac2d) Thanks [@paales](https://github.com/paales)! - Added canary releases to GraphCommerce
132
+
133
+ ## 3.0.18
134
+
135
+ ### Patch Changes
136
+
137
+ - [#1607](https://github.com/graphcommerce-org/graphcommerce/pull/1607) [`860b4afc0`](https://github.com/graphcommerce-org/graphcommerce/commit/860b4afc0a2f79b1e660a5f9ce204532ce4fca47) Thanks [@paales](https://github.com/paales)! - Print error message directly instead of masking the error as it hides more than it helps
138
+
139
+ ## 3.0.17
140
+
141
+ ### Patch Changes
142
+
143
+ - [#1598](https://github.com/graphcommerce-org/graphcommerce/pull/1598) [`707dbc73d`](https://github.com/graphcommerce-org/graphcommerce/commit/707dbc73d181204d88fdbbd2e09340e25b2b5f7b) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
144
+
145
+ ## 3.0.16
146
+
147
+ ### Patch Changes
148
+
149
+ - [#1501](https://github.com/graphcommerce-org/graphcommerce/pull/1501) [`475d23197`](https://github.com/graphcommerce-org/graphcommerce/commit/475d23197a6ce4b08cc325f872834ca592aa28dc) Thanks [@paales](https://github.com/paales)! - Native windows support added: Directory separator differences and package.json interpretation differences
150
+
151
+ ## 3.0.15
152
+
153
+ ### Patch Changes
154
+
155
+ - [#1552](https://github.com/graphcommerce-org/graphcommerce/pull/1552) [`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce) Thanks [@paales](https://github.com/paales)! - Updated to Next.js v12.2.2 and other packages and made compatible
156
+
157
+ ## 3.0.14
158
+
159
+ ### Patch Changes
160
+
161
+ - [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
162
+
163
+ ## 3.0.13
164
+
165
+ ### Patch Changes
166
+
167
+ - [#1451](https://github.com/graphcommerce-org/graphcommerce/pull/1451) [`50188e378`](https://github.com/graphcommerce-org/graphcommerce/commit/50188e378b4c77561ebc600958ea11cd114fa61a) Thanks [@paales](https://github.com/paales)! - Loosen node requirement
168
+
169
+ ## 3.0.12
170
+
171
+ ### Patch Changes
172
+
173
+ - [#1439](https://github.com/graphcommerce-org/graphcommerce/pull/1439) [`25ef6cf08`](https://github.com/graphcommerce-org/graphcommerce/commit/25ef6cf08c278105307d6f604b7135d637e9046c) Thanks [@paales](https://github.com/paales)! - Updated dependencies
174
+
175
+ ## 3.0.11
176
+
177
+ ### Patch Changes
178
+
179
+ - [#1426](https://github.com/graphcommerce-org/graphcommerce/pull/1426) [`100f4c38c`](https://github.com/graphcommerce-org/graphcommerce/commit/100f4c38c8fcda4bc6e0425e38028b550b60adc2) Thanks [@paales](https://github.com/paales)! - Upgrade packages
180
+
181
+ ## 3.0.10
182
+
183
+ ### Patch Changes
184
+
185
+ - [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`da0ae7d02`](https://github.com/graphcommerce-org/graphcommerce/commit/da0ae7d0236e4908ba0bf0fa16656be516e841d4) Thanks [@paales](https://github.com/paales)! - Updated dependencies
186
+
187
+ ## 3.0.9
188
+
189
+ ### Patch Changes
190
+
191
+ - [#1369](https://github.com/graphcommerce-org/graphcommerce/pull/1369) [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
192
+
193
+ ## 3.0.8
194
+
195
+ ### Patch Changes
196
+
197
+ - [#1356](https://github.com/graphcommerce-org/graphcommerce/pull/1356) [`9f2de0f7b`](https://github.com/graphcommerce-org/graphcommerce/commit/9f2de0f7b0fe8f20fd3ac70ddcd9616c28e2f68e) Thanks [@timhofman](https://github.com/timhofman)! - Include filepath when when duplicate fragments are found
198
+
199
+ ## 3.0.7
200
+
201
+ ### Patch Changes
202
+
203
+ - [#1341](https://github.com/graphcommerce-org/graphcommerce/pull/1341) [`2e29c5852`](https://github.com/graphcommerce-org/graphcommerce/commit/2e29c585247d356e3027be92beb7815f2070c855) Thanks [@paales](https://github.com/paales)! - upgrade dependencies
204
+
205
+ ## 3.0.6
206
+
207
+ ### Patch Changes
208
+
209
+ - [#1326](https://github.com/graphcommerce-org/graphcommerce/pull/1326) [`df0b3e7d5`](https://github.com/graphcommerce-org/graphcommerce/commit/df0b3e7d5f5fee963731a999cb3a8891580cb6fe) Thanks [@paales](https://github.com/paales)! - Latest version of GraphQL Mesh is broken, reverting to older version
210
+
211
+ ## 3.0.5
212
+
213
+ ### Patch Changes
214
+
215
+ - [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655) Thanks [@paales](https://github.com/paales)! - All default exports are now named exports internally and all `index.tsx` are renamed to the component name.
216
+
217
+ * [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef) Thanks [@paales](https://github.com/paales)! - upgrade dependencies
218
+
219
+ ## 3.0.4
220
+
221
+ ### Patch Changes
222
+
223
+ - [#1285](https://github.com/ho-nl/m2-pwa/pull/1285) [`c85294ba6`](https://github.com/ho-nl/m2-pwa/commit/c85294ba6d742ce78c074559a1e95409b25a5017) Thanks [@paales](https://github.com/paales)! - upgraded dependencies
224
+
225
+ ## 3.0.3
226
+
227
+ ### Patch Changes
228
+
229
+ - [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96) Thanks [@paales](https://github.com/paales)! - made packages public
230
+
231
+ ## 3.0.2
232
+
233
+ ### Patch Changes
234
+
235
+ - [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2) Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from `dependencies` to `peerDependencies`. The result of this is that there will be significantly less duplicate packages in the node_modules folders.
236
+
237
+ * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d) Thanks [@paales](https://github.com/paales)! - Upgraded to [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be implementing [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta) soon.
238
+
239
+ This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the frontend to be able to revalidate pages manually.
240
+
241
+ ## 3.0.1
242
+
243
+ ### Patch Changes
244
+
245
+ - [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514) Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files, so that the packages link to back to the website and repository
246
+
247
+ ## 3.0.0
248
+
249
+ ### Major Changes
250
+
251
+ - [#1258](https://github.com/ho-nl/m2-pwa/pull/1258) [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05) Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
252
+
253
+ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
254
+
255
+ ## [2.103.6](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-near-operation-file@2.103.5...@graphcommerce/graphql-codegen-near-operation-file@2.103.6) (2021-10-18)
256
+
257
+ ### Bug Fixes
258
+
259
+ - graphql-mesh missing inmemory lru ([6c71c25](https://github.com/ho-nl/m2-pwa/commit/6c71c256911072ace19037616e0ce2ab478bf070))
260
+
261
+ ## [2.103.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-near-operation-file@2.103.0...@graphcommerce/graphql-codegen-near-operation-file@2.103.1) (2021-09-28)
262
+
263
+ ### Bug Fixes
264
+
265
+ - do not build on install ([254e2a6](https://github.com/ho-nl/m2-pwa/commit/254e2a6f4b2a7e81f46466a0abe06ae2f3a79575))
266
+
267
+ # [2.103.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-near-operation-file@2.102.3...@graphcommerce/graphql-codegen-near-operation-file@2.103.0) (2021-09-28)
268
+
269
+ ### Features
270
+
271
+ - add postinstall commands to run properly on deploy ([d512ee3](https://github.com/ho-nl/m2-pwa/commit/d512ee3ba5c3a9573651ec5333595fe2f1aa141c))
272
+
273
+ ## [2.102.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-near-operation-file@2.102.2...@graphcommerce/graphql-codegen-near-operation-file@2.102.3) (2021-09-27)
274
+
275
+ ### Bug Fixes
276
+
277
+ - build packages before releasing ([c4761cf](https://github.com/ho-nl/m2-pwa/commit/c4761cf6d1810c140fd56f6eac8fca922f8c0edc))
278
+
279
+ ## [2.102.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-near-operation-file@2.102.0...@graphcommerce/graphql-codegen-near-operation-file@2.102.1) (2021-09-27)
280
+
281
+ **Note:** Version bump only for package @graphcommerce/graphql-codegen-near-operation-file
282
+
283
+ # 2.102.0 (2021-09-27)
284
+
285
+ ### Bug Fixes
286
+
287
+ - ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
288
+ - make sure graphql imports import Type correctly ([bc7cce0](https://github.com/ho-nl/m2-pwa/commit/bc7cce0e5013f46acccc316bcb7b90394106b8d2))
289
+
290
+ ### Features
291
+
292
+ - added near-operation-file graphql codegen structure ([e25bdd1](https://github.com/ho-nl/m2-pwa/commit/e25bdd130ac41325619a7d0648e3cb68f2380d32))
293
+ - allow for resolving fragments from directories other than the current target ([26c155b](https://github.com/ho-nl/m2-pwa/commit/26c155b6ff31958ff61cc800db6dc359d7d6ce99))
294
+ - **graphql-codegen-near-operation-file:** do not export fragment documents ([f0f7091](https://github.com/ho-nl/m2-pwa/commit/f0f70911641b368834a12251b48aac733becf3b4))
295
+ - **graphql-codegen:** new [@injectable](https://github.com/injectable) and [@inject](https://github.com/inject)(into: [“FragmentName”]) directives ([f80c96c](https://github.com/ho-nl/m2-pwa/commit/f80c96ce04f83023501fc1f25e7f466810092233))
296
+ - **next-config:** introduced package to streamline the setup of new examples ([b8a3958](https://github.com/ho-nl/m2-pwa/commit/b8a39584e5b529fcaa22db67d3f986b91ae683ad))
297
+ - **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
298
+ - renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of [@reachdigital](https://github.com/reachdigital) ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
299
+ - upgrade to node 14 ([d079a75](https://github.com/ho-nl/m2-pwa/commit/d079a751e9bfd8dc7f5009d2c9f31c336a0c96ab))
300
+
301
+ # [2.101.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/graphql-codegen-near-operation-file@2.100.10...@graphcommerce/graphql-codegen-near-operation-file@2.101.0) (2021-07-26)
302
+
303
+ ### Bug Fixes
304
+
305
+ - ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
306
+
307
+ ### Features
308
+
309
+ - **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
package/dist/index.js CHANGED
@@ -13,20 +13,24 @@ const plugin = (schema, _documents, config) => {
13
13
  }
14
14
  return node.description ? `\n\n${node.description}` : '';
15
15
  };
16
- const res = (0, graphql_1.visit)(astNode, {
16
+ const possibleScalars = ['Boolean', 'String', 'Int', 'Float', 'ID'];
17
+ const content = (0, graphql_1.visit)(astNode, {
17
18
  Document: {
18
- leave: (node) => `<!-- auto generated -->${node.definitions.filter(Boolean).join('\n')}`,
19
+ leave: (node) => `<!-- Automatically generated from Config.graphqls -->${node.definitions
20
+ .filter(Boolean)
21
+ .join('\n')}`,
19
22
  },
20
23
  Name: { leave: (node) => node.value },
21
- NamedType: { leave: (node) => node.name },
24
+ NamedType: {
25
+ leave: (node) => possibleScalars.includes(node.name) ? node.name : `[${node.name}](#${node.name})`,
26
+ },
22
27
  StringValue: { leave: (node) => node.value },
23
28
  ListType: { leave: (node) => `[${node.type}]` },
24
- NonNullType: { leave: (node) => `${node.type}!` },
29
+ NonNullType: {
30
+ leave: (node) => `${node.type}!`,
31
+ },
25
32
  InputValueDefinition: {
26
- leave: (node) => {
27
- const { type } = node;
28
- return `\`${node.name}: ${type}\`${descriptionText(node)}`;
29
- },
33
+ leave: (node) => `\`${node.name}: ${node.type}\`${descriptionText(node)}`,
30
34
  },
31
35
  InputObjectTypeDefinition: {
32
36
  enter: (node) => ({
@@ -34,8 +38,12 @@ const plugin = (schema, _documents, config) => {
34
38
  // Move required fields to the top.
35
39
  fields: [...(node.fields ?? [])].sort((a, b) => a.type.kind === 'NonNullType' && b.type.kind !== 'NonNullType' ? -1 : 1),
36
40
  }),
37
- leave: (node) => `\n## ${node.name}${descriptionText(node)}
38
- ${node.fields?.map((f) => `\n### ${f}`).join('\n')}`,
41
+ leave: (node) => {
42
+ const title = descriptionText(node).trimStart().startsWith('#')
43
+ ? `${descriptionText(node).trimStart()}\n\n### ${node.name}`
44
+ : `### ${node.name}${descriptionText(node)}`;
45
+ return `\n${title}\n${node.fields?.map((f) => `\n#### ${f}`).join('\n')}`;
46
+ },
39
47
  },
40
48
  EnumValueDefinition: {
41
49
  leave: (node) => `${node.name} # ${node.description}`,
@@ -47,9 +55,6 @@ ${node.fields?.map((f) => `\n### ${f}`).join('\n')}`,
47
55
  },
48
56
  },
49
57
  });
50
- return {
51
- // prepend: buildImports(),
52
- content: [res].join('\n'),
53
- };
58
+ return { content };
54
59
  };
55
60
  exports.plugin = plugin;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/graphql-codegen-markdown-docs",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.0.0-canary.26",
5
+ "version": "6.0.0-canary.28",
6
6
  "sideEffects": false,
7
7
  "type": "commonjs",
8
8
  "main": "dist/index.js",
@@ -13,10 +13,6 @@
13
13
  "build": "tsc",
14
14
  "prepack": "tsc"
15
15
  },
16
- "files": [
17
- "dist",
18
- "src"
19
- ],
20
16
  "prettier": "@graphcommerce/prettier-config-pwa",
21
17
  "eslintConfig": {
22
18
  "extends": "@graphcommerce/eslint-config-pwa",
@@ -25,14 +21,14 @@
25
21
  }
26
22
  },
27
23
  "devDependencies": {
28
- "@graphcommerce/eslint-config-pwa": "6.0.0-canary.26",
29
- "@graphcommerce/prettier-config-pwa": "6.0.0-canary.26",
30
- "@graphcommerce/typescript-config-pwa": "6.0.0-canary.26"
24
+ "@graphcommerce/eslint-config-pwa": "6.0.0-canary.28",
25
+ "@graphcommerce/prettier-config-pwa": "6.0.0-canary.28",
26
+ "@graphcommerce/typescript-config-pwa": "6.0.0-canary.28"
31
27
  },
32
28
  "dependencies": {
33
- "@graphql-codegen/add": "4.0.0",
34
- "@graphql-codegen/plugin-helpers": "4.0.0",
35
- "@graphql-codegen/visitor-plugin-common": "3.0.0",
29
+ "@graphql-codegen/add": "4.0.1",
30
+ "@graphql-codegen/plugin-helpers": "4.1.0",
31
+ "@graphql-codegen/visitor-plugin-common": "3.0.1",
36
32
  "@graphql-tools/utils": "^9.2.1",
37
33
  "@types/parse-filepath": "^1.0.0",
38
34
  "graphql": "16.6.0",
package/src/index.ts CHANGED
@@ -20,20 +20,27 @@ export const plugin: PluginFunction<MarkdownDocsPluginConfig, Types.ComplexPlugi
20
20
  return node.description ? `\n\n${node.description}` : ''
21
21
  }
22
22
 
23
- const res = visit<string>(astNode, {
23
+ const possibleScalars = ['Boolean', 'String', 'Int', 'Float', 'ID']
24
+
25
+ const content = visit<string>(astNode, {
24
26
  Document: {
25
- leave: (node) => `<!-- auto generated -->${node.definitions.filter(Boolean).join('\n')}`,
27
+ leave: (node) =>
28
+ `<!-- Automatically generated from Config.graphqls -->${node.definitions
29
+ .filter(Boolean)
30
+ .join('\n')}`,
26
31
  },
27
32
  Name: { leave: (node) => node.value },
28
- NamedType: { leave: (node) => node.name }, // String, Boolean, GraphCommerceDebugConfig, etc.
33
+ NamedType: {
34
+ leave: (node) =>
35
+ possibleScalars.includes(node.name) ? node.name : `[${node.name}](#${node.name})`,
36
+ }, // String, Boolean, GraphCommerceDebugConfig, etc.
29
37
  StringValue: { leave: (node) => node.value },
30
38
  ListType: { leave: (node) => `[${node.type}]` },
31
- NonNullType: { leave: (node) => `${node.type}!` },
39
+ NonNullType: {
40
+ leave: (node) => `${node.type}!`,
41
+ },
32
42
  InputValueDefinition: {
33
- leave: (node) => {
34
- const { type } = node
35
- return `\`${node.name}: ${type}\`${descriptionText(node)}`
36
- },
43
+ leave: (node) => `\`${node.name}: ${node.type}\`${descriptionText(node)}`,
37
44
  },
38
45
  InputObjectTypeDefinition: {
39
46
  enter: (node) => ({
@@ -43,8 +50,13 @@ export const plugin: PluginFunction<MarkdownDocsPluginConfig, Types.ComplexPlugi
43
50
  a.type.kind === 'NonNullType' && b.type.kind !== 'NonNullType' ? -1 : 1,
44
51
  ),
45
52
  }),
46
- leave: (node) => `\n## ${node.name}${descriptionText(node)}
47
- ${node.fields?.map((f) => `\n### ${f}`).join('\n')}`,
53
+ leave: (node) => {
54
+ const title = descriptionText(node).trimStart().startsWith('#')
55
+ ? `${descriptionText(node).trimStart()}\n\n### ${node.name}`
56
+ : `### ${node.name}${descriptionText(node)}`
57
+
58
+ return `\n${title}\n${node.fields?.map((f) => `\n#### ${f}`).join('\n')}`
59
+ },
48
60
  },
49
61
  EnumValueDefinition: {
50
62
  leave: (node) => `${node.name} # ${node.description}`,
@@ -57,8 +69,5 @@ ${node.fields?.map((f) => `\n### ${f}`).join('\n')}`,
57
69
  },
58
70
  })
59
71
 
60
- return {
61
- // prepend: buildImports(),
62
- content: [res].join('\n'),
63
- }
72
+ return { content }
64
73
  }
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "exclude": ["**/node_modules", "tests", "**/.*/"],
3
+ "include": ["**/*.ts", "**/*.tsx"],
4
+ "extends": "@graphcommerce/typescript-config-pwa/node.json",
5
+ "compilerOptions": {
6
+ "noEmit": false,
7
+ "outDir": "dist"
8
+ }
9
+ }