Skip to content

Commit 803db66

Browse files
alinsimocardatan
authored andcommitted
[deploy_website] integrated guild-docs as website (#3085)
API routes generation fix docs & components update; routing fixes gitignore update fix(deps): update dependency extract-files to v11 (#3065) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update dependency tslib to ~2.3.0 (#3067) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update dependency the-guild-components to v1.3.1 (#3070) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update dependency apollo-upload-client to v16 (#3066) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update typescript-eslint monorepo to v4.27.0 (#3071) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update babel monorepo to v7.14.6 (#3072) Co-authored-by: Renovate Bot <[email protected]> [deploy_website] Update generate-schema.md (#3074) corrected grammar fix(deps): update dependency globby to v11.0.4 (#3077) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update dependency ws to v7.5.0 (#3078) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency typescript to v4.3.3 (#3083) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency typedoc to v0.20.37 (#3082) Co-authored-by: Renovate Bot <[email protected]> Jest Transformer for GraphQL (#1887) * Jest Transformer for GraphQL * Changeset * Align versions * Fix package.json * yarn.lock * Fix Co-authored-by: Arda TANRIKULU <[email protected]> chore(deps): update dependency @types/ws to v7.4.5 (#3084) Co-authored-by: Renovate Bot <[email protected]> Safer use of `Object.prototype.hasOwnProperty` (#3069) * Safer use of `Object.prototype.hasOwnProperty` Fixes an error I get when GraphQL JS passes a prototypeless object into the resolver ``` ReferenceError: maybeRef is not defined at eval (eval at <anonymous> (/Users/mattalexander/Projects/edge-sites-schema/tests/regression.test.js:67:7), <anonymous>:1:38) at forEach (/projectpath/tests/regression.test.js:67:7) at Array.forEach (<anonymous>) at Object.<anonymous> (/projectpath/tests/regression.test.js:65:17) ``` * changeset and test Co-authored-by: Arda TANRIKULU <[email protected]> BugFix: Handle parsing endpoints when there are no mutations (#3076) * BugFix: Handle parsing endpoints when there are no mutations * changeset and test * pass tests Co-authored-by: itai <[email protected]> Co-authored-by: Arda TANRIKULU <[email protected]> chore(deps): update dependency typescript to v4.3.4 (#3086) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency typedoc to v0.21.0 (#3087) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency typedoc-plugin-markdown to v3.10.0 (#3088) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency eslint to v7.29.0 (#3089) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency graphql to v15.5.1 (#3091) Co-authored-by: Renovate Bot <[email protected]> enable typescript strict mode (#3010) * enable noImplicitThis * enable `strictBindCallApply` * enable `strictFunctionTypes` 1: testing * enable `strictFunctionTypes` 2: utils * enable strictFunctionTypes 3: schema * enable strictFunctionTypes 4: batch-execute * enable strictFunctionTypes 5 `load` * enable strictFunctionTypes 6 `loaders/url` * enable strictFunctionTypes 7 `webpack-loader` * enable strictFunctionTypes 8 `links` * enable strictFunctionTypes 9 `delegate` and `batch-delegate` * enable `strictFunctionTypes` 10 `wrap` * enable `strictFunctionTypes` 11 `stitch` and `stitching-directive` * enable `strictFunctionTypes` final tsconfig * remove unnecessary generic params * enable `strictNullChecks` 1 `utils` * enable `strictNullChecks` 2 `schema` * enable `strictNullChecks` 3 `resolvers-composition` * enable `strictNullChecks` 4 `webpack-loader` * enable `strictNullChecks` 5 `batch-execute` * enable `strictNullChecks` 6 `graphql-tag-plug` * enable `strictNullChecks` 7 `import` * enable `strictNullChecks` 8 `loaders/url` * enable `strictNullChecks` 8 `loaders/prisma` * enable `strictNullChecks` 8 `loaders/module` * enable `strictNullChecks` 9 `loaders/github` * enable `strictNullChecks` 12 `loaders/code-file` * enable `strictNullChecks` 13 `load` * enable `strictNullChecks` 14 `delegate` * enable `strictNullChecks` 15 `batch-delegate` * interlude: move commonly used stuff to testing folder * enable `strictNullChecks` 16 `wrap` * enable `strictNullChecks` 17 `stitch` * enable `strictNullChecks` 18 `load-files` * enable `strictNullChecks` 19 `load-typedefs` * enable `strictNullChecks` 20 `merge` * enable `strictNullChecks` 21 `node-require` * enable `strictNullChecks` 22 `mock` * enable `strictNullChecks` 22 `stitching-directive` * enable `strictNullChecks` flag in tsconfig * fix: graphql-js 14 compat * fix `strictPropertyInitialization` errors * enable strictPropertyInitialization rule * strict mode!!! * enable `noPropertyAccessFromIndexSignature` * enable `noFallthroughCasesInSwitch` and `noPropertyAccessFromIndexSignature` * Add strict to new changes * fix: remove casts as upstream issue is fixed * fix: throw if we cannot identify the operation type. #3010 (comment) #3010 (comment) * fix: change wording of error #3010 (comment) * fix: make error message more clear #3010 (comment) * refactor: use null/undefined instead of falsey check * fix: assert operation from document #3010 (comment) * fix: type narrowing not working due to generics #3010 (comment) * fix: apply feedback for relocateError * Make wrapSchema generic. Fix #3064 (#1) * Fix Build Co-authored-by: Arda TANRIKULU <[email protected]> Co-authored-by: Augustin Le Fèvre <[email protected]> Huge cleanup before major release (breaking) (#3081) * Breaking cleanup before major release * Fix TS * More chore(deps): update typescript-eslint monorepo to v4.28.0 (#3093) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update babel monorepo to v7.14.7 (#3094) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update jest monorepo to v27.0.5 (#3095) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency @vue/compiler-sfc to v3.1.2 (#3097) Co-authored-by: Renovate Bot <[email protected]> fix build errors Huge cleanup before major release (breaking) (#3081) * Breaking cleanup before major release * Fix TS * More chore(deps): update typescript-eslint monorepo to v4.28.0 (#3093) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update babel monorepo to v7.14.7 (#3094) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update jest monorepo to v27.0.5 (#3095) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency @vue/compiler-sfc to v3.1.2 (#3097) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update dependency the-guild-components to v1.4.0 (#3098) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency @types/node to v14.17.4 (#3101) Co-authored-by: Renovate Bot <[email protected]> Some other refactor (#3096) * Fix typing errors in tests * ReplaObject.keys/values and forEach with for..in and for..of loops * Improve Type Checking * Update CI workflow * Fix linting * Fix TS errors for v14 * More * More * Allow incremental builds * Finish * Fix Type Check * Disable sourcemaps * Fix type issues Better changelog Respect and in and more changes chore(CI): Ability to release canaries on demand Make AggregateError spec compliant reintegration docs update updated tgc version and removed Poppins import Able to release with custom tags chore(deps): update dependency typedoc-plugin-markdown to v3.10.2 (#3107) Co-authored-by: Renovate Bot <[email protected]> Prevent TS Server to die on VSCode chore(deps): update dependency typedoc to v0.21.1 (#3108) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency graphql-tag to v2.12.5 (#3109) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency prettier to v2.3.2 (#3110) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency typedoc to v0.21.2 (#3111) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency @types/babel__traverse to v7.14.0 (#3112) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update jest monorepo to v27.0.6 (#3115) Co-authored-by: Renovate Bot <[email protected]> Remove Subscriber and use only Executor (#3117) * Remove Subscriber and use only Executor * Fix introspectSchema * Fix tests * Cleanup fix(deps): update dependency ws to v7.5.1 (#3118) Co-authored-by: Renovate Bot <[email protected]> enhance(url-loader): refactor Fix rawSDL issue enhance(delegate): skip validation by default and add validateRequest option to enable chore(deps): update dependency typescript to v4.3.5 (#3122) Co-authored-by: Renovate Bot <[email protected]> fix(file-loader): location path must be normalized (#3121) chore(deps): update dependency husky to v7 (#3123) Co-authored-by: Renovate Bot <[email protected]> feat(graphql-tag-pluck): keep locationOffset and return graphql-js Source instead of string chore(deps): update dependency @vue/compiler-sfc to v3.1.3 (#3125) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency @vue/compiler-sfc to v3.1.4 (#3126) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update dependency @types/websocket to v1.0.3 (#3129) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency @types/ws to v7.4.6 (#3128) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency eslint to v7.30.0 (#3130) Co-authored-by: Renovate Bot <[email protected]> fix(deps): update dependency ws to v7.5.2 (#3131) Co-authored-by: Renovate Bot <[email protected]> fix(url-loader): fix node support for EventSource feat(resolvers-composition): add support for glob patterns (#3132) * feat(resolvers-composition): add support for glob patterns * fix(resolvers-composition): add typings for micromatch * feat(resolvers-composition): add unit tests for glob patterns * chore(resolver-compositions): cleanup * feat(docs): added samples for resolver composition path matcher format * chore: added changeset * fix(docs): typo * fix(changeset): change patch to minor * Fix tests and cleanup Co-authored-by: Arda TANRIKULU <[email protected]> chore(deps): pin dependency @types/micromatch to 4.0.1 (#3133) Co-authored-by: Renovate Bot <[email protected]> chore(deps): update dependency nock to v13.1.1 (#3134) Co-authored-by: Renovate Bot <[email protected]> don't throw on errors that should not be relocated (#3136) refactor: internal StitchingInfo properties (#3137) to never be undefined docs update docs update after review Some fixes update tgc version
1 parent c23b5b8 commit 803db66

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3499
-5169
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ junit.xml
7777

7878
package-lock.json
7979
website/yarn.lock
80+
website/api-sidebar.json
81+
website/docs/api

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
},
9898
"resolutions": {
9999
"graphql": "15.5.1",
100+
"esbuild": "^0.12.8",
100101
"@changesets/apply-release-plan": "5.0.0"
101102
}
102103
}

scripts/build-api-docs.js

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ async function buildApiDocs() {
3434
const packageJsonContent = require(path.join(__dirname, '..', packageJsonPath));
3535
// Do not include private and large npm package that contains rest
3636
if (
37+
!packageJsonPath.includes('./website/') &&
3738
!packageJsonContent.private &&
3839
packageJsonContent.name !== MONOREPO &&
3940
!packageJsonContent.name.endsWith('/container')
@@ -80,6 +81,13 @@ async function buildApiDocs() {
8081
// Escape angle brackets
8182
.replace(/</g, '&lt;')
8283
.replace(/>/g, '&gt;')
84+
// Fix title
85+
.replace(/^# .+/g, function (match) {
86+
return `---
87+
title: '${match.replace('# ', '')}'
88+
---
89+
${match}`;
90+
})
8391
// Fix links
8492
.replace(/\[([^\]]+)\]\(([^)]+).md\)/g, '[$1]($2)')
8593
.replace(/\[([^\]]+)\]\((\.\.\/(classes|interfaces|enums)\/([^\)]+))\)/g, '[$1](/docs/api/$3/$4)');
@@ -109,8 +117,8 @@ async function buildApiDocs() {
109117
})
110118
);
111119

112-
// Remove the generated "index.md" file
113-
// fs.unlinkSync(path.join(outputDir, 'index.md'));
120+
// Remove the generated "README.md" file
121+
fs.unlinkSync(path.join(outputDir, 'README.md'));
114122

115123
// Update each module 's frontmatter and title
116124
await Promise.all(
@@ -142,20 +150,27 @@ sidebar_label: "${id}"
142150
fs.writeFileSync(
143151
sidebarsPath,
144152
JSON.stringify(
145-
[
146-
{
147-
Modules: modules.map(([name]) => `api/modules/${convertNameToId(name)}`),
148-
},
149-
{
150-
Classes: getSidebarItemsByDirectory(path.join(outputDir, 'classes')),
151-
},
152-
{
153-
Interfaces: getSidebarItemsByDirectory(path.join(outputDir, 'interfaces')),
154-
},
155-
{
156-
Enums: getSidebarItemsByDirectory(path.join(outputDir, 'enums')),
153+
{
154+
$name: 'API Reference',
155+
_: {
156+
modules: {
157+
$name: 'Modules',
158+
$routes: getSidebarItemsByDirectory(path.join(outputDir, 'modules')),
159+
},
160+
classes: {
161+
$name: 'Classes',
162+
$routes: getSidebarItemsByDirectory(path.join(outputDir, 'classes')),
163+
},
164+
interfaces: {
165+
$name: 'Interfaces',
166+
$routes: getSidebarItemsByDirectory(path.join(outputDir, 'interfaces')),
167+
},
168+
enums: {
169+
$name: 'Enums',
170+
$routes: getSidebarItemsByDirectory(path.join(outputDir, 'enums')),
171+
},
157172
},
158-
],
173+
},
159174
null,
160175
2
161176
)
@@ -183,8 +198,7 @@ sidebar_label: "${id}"
183198
const absoluteFilePath = path.join(dirName, fileName);
184199
const fileLstat = fs.lstatSync(absoluteFilePath);
185200
if (fileLstat.isFile()) {
186-
const relativeDirName = path.relative(outputDir, dirName);
187-
return `api/${relativeDirName}/${path.parse(fileName).name}`;
201+
return path.parse(fileName).name;
188202
} else {
189203
return getSidebarItemsByDirectory(absoluteFilePath);
190204
}

scripts/typedoc-theme/theme.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
const MarkdownTheme = require('typedoc-plugin-markdown/dist/theme');
1+
const { default: MarkdownTheme } = require('typedoc-plugin-markdown/dist/theme');
2+
23
const { PageEvent } = require('typedoc/dist/lib/output/events');
34

4-
exports.default = class DocusaurusTheme extends MarkdownTheme {
5+
module.exports = class DocusaurusTheme extends MarkdownTheme {
56
/**
67
* Escape characters for mdx support after render
78
*/

website/.gitignore

Lines changed: 0 additions & 26 deletions
This file was deleted.

website/README.md

Lines changed: 0 additions & 42 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

website/docs/generate-schema.md renamed to website/docs/guides/generate-schema.mdx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ This example has the entire type definition in one string and all resolvers in o
105105

106106
## Extending Types
107107

108-
It's easy to add additional fields to existing types using the `extend` keyword. Using `extend` is particularly useful in avoiding a large list of fields on root Queries and Mutations. You can use it like this:
108+
It's easy to add additional fields to existing types using the `extend` keyword. Using `extend` is particularly useful in avoiding a large list of fields on root Queries and Mutations. You can use it like this:
109109

110110
```js
111-
const typeDefs = [`
111+
const typeDefs = [
112+
`
112113
schema {
113114
query: Query
114115
}
@@ -120,15 +121,17 @@ const typeDefs = [`
120121
type Bar {
121122
id
122123
}
123-
`, `
124+
`,
125+
`
124126
type Foo {
125127
id: String!
126128
}
127129
128130
extend type Query {
129131
foos: [Foo]!
130132
}
131-
`]
133+
`,
134+
];
132135
```
133136

134137
If one of the types extended needs a resolver you can use `makeExecutableSchema` like this:
@@ -138,39 +141,42 @@ const barsResolver = {
138141
Query: {
139142
bars(parent, args, context, info) {
140143
// ...
141-
}
142-
}
144+
},
145+
},
143146
};
144147

145148
const foosResolver = {
146149
Query: {
147150
foos(parent, args, context, info) {
148151
// ...
149-
}
150-
}
151-
}
152+
},
153+
},
154+
};
152155

153156
const schema = makeExecutableSchema({
154157
typeDefs,
155-
resolvers: [barsResolver, foosResolver]
156-
})
158+
resolvers: [barsResolver, foosResolver],
159+
});
157160
```
158161

159162
## Learning the GraphQL schema language
160163

161164
The official documentation on graphql.org now has [a section about GraphQL schemas](http://graphql.org/learn/schema/) which explains all of the different schema features and how to use them with the schema language.
162165

163166
The type definitions must define a query type, which means a minimal schema would look something like this:
167+
164168
```js
165-
const typeDefs = [`
169+
const typeDefs = [
170+
`
166171
schema {
167172
query: RootQuery
168173
}
169174
170175
type RootQuery {
171176
aNumber: Int
172177
}
173-
`];
178+
`,
179+
];
174180
```
175181

176182
## Descriptions & Deprecations
@@ -232,16 +238,16 @@ const jsSchema = makeExecutableSchema({
232238
- `parseOptions` is an optional argument which allows customization of parse when specifying `typeDefs` as a string.
233239

234240
- `resolverValidationOptions` is an optional argument with the following properties, each of which can be set to `error`, `warn`, or `ignore`:
241+
235242
- `requireResolversForArgs` will cause `makeExecutableSchema` to throw an error (`error`) or issue a warning (`warn`)unless a resolver is defined for every field with arguments. The default is `ignore`, causing this validator to be skipped.
236243

237244
- `requireResolversForNonScalar` require a resolver for every non-scalar field. Default is `ignore`.
238245

239-
- `requireResolversForAllFields` asserts that *all* fields have valid resolvers. This option cannot be set in combination with the previous two validators. Default is `ignore`.
246+
- `requireResolversForAllFields` asserts that _all_ fields have valid resolvers. This option cannot be set in combination with the previous two validators. Default is `ignore`.
240247

241248
- `requireResolversForResolveType` will require a `resolveType()` method for Interface and Union types. This can be passed in with the field resolvers as `__resolveType()`. Default is `ignore`.
242249

243250
- `requireResolversToMatchSchema` requires every resolver within the resolver map to correspond to a GraphQL entity within the schema. Defaults to `error`, to help catch common errors.
244251

245252
- `inheritResolversFromInterfaces` GraphQL Objects that implement interfaces will inherit missing resolvers from their interface types defined in the `resolvers` object.
246253

247-
File renamed without changes.

0 commit comments

Comments
 (0)