Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typos in READMEs #2272

Merged
merged 1 commit into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The purpose of this monorepo is to give the GraphQL Community:

### Proposed Ecosystem

As we re-write for `graphiql@2.x` ecosystem, this monorepo will contain an sdk and plugins.
As we re-write for `graphiql@2.x` ecosystem, this monorepo will contain a sdk and plugins.

![Diagram of the proposed Monorepo and third party ecosystem](https://raw.githubusercontent.com/graphql/graphiql/main/resources/images/proposed-ecosystem.jpg)

Expand All @@ -65,7 +65,7 @@ The GraphiQL IDE, implemented in React, currently using [GraphQL mode for CodeMi

### How To Setup/Implement GraphiQL

[codesandbox.io graphiql exmaple](https://codesandbox.io/s/graphiql-js-example-oc851)
[codesandbox.io graphiql example](https://codesandbox.io/s/graphiql-js-example-oc851)
[stackblitz.com graphiql example](https://stackblitz.com/edit/react-ts-jpnmod)

**The [GraphiQL Readme](packages/graphiql#readme) explains** some of the ways to implement GraphiQL, and we also have the [examples](examples) directory as well!
Expand All @@ -79,7 +79,7 @@ The GraphiQL IDE, implemented in React, currently using [GraphQL mode for CodeMi

Provides monaco editor with a powerful, schema-driven graphql language mode.

See the [webpack example](examples/monaco-graphql-webpack#readme) for a plain javascript demo using github API
See the [webpack example](examples/monaco-graphql-webpack#readme) for a plain javascript demo using GitHub API

## [`codemirror-graphql`](packages/codemirror-graphql#readme)

Expand Down
2 changes: 1 addition & 1 deletion packages/codemirror-graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typeahead hinter powered by your GraphQL Schema.

### Getting Started

```
```sh
npm install --save codemirror-graphql
```

Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-2-rfc-context/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

# GraphiQL 2.x - React Context RFC Proposal

This effort was merge to master in spring of 2020, and then moved to this workspace for the time being until we address some of the issues
This effort was merged to master in spring of 2020, and then moved to this workspace for the time being until we address some of the issues

## Features

- hooks rewrite for react 16. _gets rid of deprecated methods_
- swap out codemirror for monaco
- partial re-themeing with new component library and a customizeable`theme-ui`
- partial re-theming with new component library and a customizable `theme-ui`
- context implementation
- i18n using `i18n-next`

Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ You can use the `graphiql` module, however bear in mind that `react` `react-dom`

With `npm`:

```
```sh
npm install --save graphiql react react-dom graphql
```

Expand All @@ -67,7 +67,7 @@ yarn add graphiql react react-dom graphql

### UMD

With `unpkg`/`jsdelivr`, etc:
With `unpkg`/`jsdelivr`, etc.:

```html
<link href="https://unpkg.com/graphiql/graphiql.min.css" rel="stylesheet" />
Expand Down
7 changes: 3 additions & 4 deletions packages/graphql-language-service-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ Only node 9 or greater, and npm or yarn are required dependencies.

with `yarn`:

```
```sh
yarn global add graphql-language-service-cli
```

with `npm`:

```
```sh
npm i -g graphql-language-service-cli
```

Expand All @@ -64,8 +64,7 @@ The custom graphql language configurations are:

The node executable contains several commands: `server` and the command-line language service methods (`validate`, `autocomplete`, `outline`).

```

```text
GraphQL Language Service Command-Line Interface.

Usage: graphql-lsp <command> <file>
Expand Down
18 changes: 10 additions & 8 deletions packages/graphql-language-service-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Supported features include:

### Dependencies

An LSP compatible client with it's own file watcher, that sends watch notifications to the server.
An LSP compatible client with its own file watcher, that sends watch notifications to the server.

**DROPPED**: GraphQL Language Service no longer depends on [Watchman](https://facebook.github.io/watchman/)

Expand Down Expand Up @@ -89,7 +89,9 @@ extensions:
#### `.graphqlrc` or `.graphqlrc.json` or `graphql.config.json`

```json
{ "schema": "https://localhost:8000" }
{
"schema": "https://localhost:8000"
}
```

#### `graphql.config.js` or `.graphqlrc.js`
Expand Down Expand Up @@ -117,7 +119,7 @@ await startServer({
// rootDir is same as `configDir` before, the path where the graphql config file would be found by cosmic-config
rootDir: 'config/',
// or - the relative or absolute path to your file
filePath: 'exact/path/to/config.js' // (also supports yml, json, ts, toml)
filePath: 'exact/path/to/config.js', // (also supports yml, json, ts, toml)
// myPlatform.config.js/json/yaml works now!
configName: 'myPlatform',
},
Expand All @@ -130,13 +132,13 @@ The graphql-config features we support are:
module.exports = {
extensions: {
// add customDirectives *legacy*. you can now provide multiple schema pointers to config.schema/project.schema, including inline strings
"customDirectives": ["@myExampleDirective"],
// a function that returns rules array with parameter `ValidationContext` from `graphql/validation`
"customValidationRules": require('./config/customValidationRules')
"languageService": {
customDirectives: ["@myExampleDirective"],
// a function that returns rules array with parameter `ValidationContext` from `graphql/validation`
customValidationRules: require('./config/customValidationRules'),
languageService: {
// should the language service read schema for lookups from a cached file based on graphql config output?
cacheSchemaFileForLookup: true
// NOTE: this will disable all definition lookup for local SDL files
// NOTE: this will disable all definition lookup for local SDL files
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-language-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The goal is to provide methods for creating [Language Server Protocol](https://l

## Parser

A standalone online, immutable, dependeancy-free parser for [GraphQL](http://graphql.org/), used by the LSP interface methods
A standalone online, immutable, dependency-free parser for [GraphQL](http://graphql.org/), used by the LSP interface methods

## Utils

Expand Down
73 changes: 36 additions & 37 deletions packages/monaco-graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GraphQL language plugin for the Monaco Editor. You can use it to build vscode/co

- [webpack example](https://github.com/graphql/graphiql/tree/main/examples/monaco-graphql-webpack/) using plain javascript, shows how to change schemas
- [vite + react example](https://stackblitz.com/edit/monaco-graphql-react-vite?file=src%2FApp.tsx&terminal=dev) - minimal example with variables (C)JSON support using react
- [live demo](https://monaco-graphql.netlify.com) of the monaco webpack example (prompts for github access token!)
- [live demo](https://monaco-graphql.netlify.com) of the monaco webpack example (prompts for GitHub access token!)

> **NOTE:** This is in pre-release state as we build towards GraphiQL 2.0.x. [`codemirror-graphql`](https://github.com/graphql/graphiql/tree/main/packages/codemirror-graphql) has more features (such as JSON variables validation) and is more stable.

Expand Down Expand Up @@ -127,7 +127,7 @@ This will cover the basics, making an HTTP POST with the default `introspectionQ

### Variables JSON Support!

In `monaco-graphql@0.5.0` we introduced a method `getVariablesJSONSchema` that allows you to retrive a `JSONSchema` description for the declared variables for any given set of operations
In `monaco-graphql@0.5.0` we introduced a method `getVariablesJSONSchema` that allows you to retrieve a `JSONSchema` description for the declared variables for any given set of operations

## Full Sync Demo with Variables JSON

Expand All @@ -148,16 +148,16 @@ window.MonacoEnvironment = {
};

// the language service will be instantiated once the schema is available
const MonacoGraphQLAPI = initializeMode({
schemas: [{
// anything that monaco.URI.from() is compatible with
uri: 'https://myschema.com',
// match the monaco file uris for this schema.
// accepts specific filenames and anything `picomatch` supports.
fileMatch: ["**/*.graphql"],
schema: myGraphqlSchema as GraphQLSchema
}],
})
const MonacoGraphQLAPI = initializeMode({
schemas: [{
// anything that monaco.URI.from() is compatible with
uri: 'https://myschema.com',
// match the monaco file uris for this schema.
// accepts specific filenames and anything `picomatch` supports.
fileMatch: ["**/*.graphql"],
schema: myGraphqlSchema as GraphQLSchema
}],
})


const operationModel = monaco.editor.createModel(
Expand Down Expand Up @@ -192,26 +192,25 @@ const variablesEditor = monaco.editor.create(
},
);

// high-level method for configuring json variables validation
MonacoGraphQLAPI.setDiagnosticSettings({
validateVariablesJson: {
// Urls, uris, anything that monaco.URI.from() is compatible with.
// Match operation model to variables editor,
// and the language service will automatically listen for changes,
// and compute the json schema using the GraphQLWorker.
// This is in the main process is applied to the global monaco json settings
// for validation, completion and more using monaco-json's built-in JSON Schema support.
[operationModel.uri.toString()]: [variablesModel.uri.toString()]
},
jsonDiagnosticSettings: {
allowComments: true, // allow json, parse with a jsonc parser to make requests
}
})
// TODO: document manual alternative approach
})();
// high-level method for configuring json variables validation
MonacoGraphQLAPI.setDiagnosticSettings({
validateVariablesJson: {
// Urls, uris, anything that monaco.URI.from() is compatible with.
// Match operation model to variables editor,
// and the language service will automatically listen for changes,
// and compute the json schema using the GraphQLWorker.
// This is in the main process is applied to the global monaco json settings
// for validation, completion and more using monaco-json's built-in JSON Schema support.
[operationModel.uri.toString()]: [variablesModel.uri.toString()]
},
jsonDiagnosticSettings: {
allowComments: true, // allow json, parse with a jsonc parser to make requests
}
})
// TODO: document manual alternative approach
```

You can also experiment with the built-in I think `jsonc`? (MSFT json5-ish syntax, for `tsconfig.json` etc) and the 3rd party `monaco-yaml` language modes for completion of other types of variable input. you can also experiment with editor methods to parse detected input into different formats, etc (`yaml` pastes as `json`, etc)
You can also experiment with the built-in I think `jsonc`? (MSFT json5-ish syntax, for `tsconfig.json` etc.) and the 3rd party `monaco-yaml` language modes for completion of other types of variable input. you can also experiment with editor methods to parse detected input into different formats, etc (`yaml` pastes as `json`, etc.)

You could of course prefer to generate a `jsonschema` form for variables input using a framework of your choice, instead of an editor. Enjoy!

Expand Down Expand Up @@ -248,7 +247,7 @@ const api = intializeMode(config);
same as the above, except it overwrites the entire schema config.

you can provide multiple, and use `fileMatch` to map to various uri "directory" globs or specific files.
`uri` can be a url or file path, anything parsable
`uri` can be an url or file path, anything parsable

```ts
// you can load it lazily
Expand Down Expand Up @@ -278,7 +277,7 @@ const api = intializeMode({ schemas });

// add another schema. this will cause language workers and features to reset
api.setSchemaConfig([
..schemas,
...schemas,
{
introspectionJSON: myIntrospectionJSON,
fileMatch: ['specific/monaco/uri.graphql'],
Expand Down Expand Up @@ -374,11 +373,11 @@ the plain javascript [webpack example](https://github.com/graphql/graphiql/tree/

## Custom Webworker (for passing non-static config to worker)

If you want to pass a custom parser and/or or validation rules, it is supported, however the setup is a bit more complicated.
If you want to pass a custom parser and/or validation rules, it is supported, however the setup is a bit more complicated.

You can add any `LanguageServiceConfig` ([typedoc](https://graphiql-test.netlify.app/typedoc/modules/graphql_language_service.html#graphqllanguageconfig-1)) configuration options you like here to `languageConfig` as below.

This is because we can't pass non-static configuration to the existing worker programatically, so you must import these and build the worker custom with those functions. Part of the (worthwile) cost of crossing runtimes!
This is because we can't pass non-static configuration to the existing worker programmatically, so you must import these and build the worker custom with those functions. Part of the (worthwhile) cost of crossing runtimes!

you'll want to create your own `mygraphql.worker.ts` file, and add your custom config such as `schemaLoader` to `createData`:

Expand Down Expand Up @@ -432,9 +431,9 @@ or, if you have webpack configured for it:
window.MonacoEnvironment = {
getWorkerUrl(_workerId: string, label: string) {
if (label === 'graphql') {
return 'mygraphql.worker.js`;
return 'mygraphql.worker.js';
}
return 'editor.worker.js`;
return 'editor.worker.js';
},
};
```
Expand Down Expand Up @@ -469,7 +468,7 @@ If you are familiar with Codemirror/Atom-era terminology and features, here's so
- command palette and right click context menu are important
- you can extend the standard completion/linting/etc provided. for example, `editor.setModelMarkers()`
- [Monaco Editor API Docs](https://microsoft.github.io/monaco-editor/api/index.html)
- [Monaco Editor Samples](https://github.com/Microsoft/monaco-editor-samples) repository is great for tips on implementing with different bundlers, runtimes, etc
- [Monaco Editor Samples](https://github.com/Microsoft/monaco-editor-samples) repository is great for tips on implementing with different bundlers, runtimes, etc.

## TODO

Expand Down