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

@graphiql/plugin-utils & docs, redo #3328 #3346

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

acao
Copy link
Member

@acao acao commented Jul 13, 2023

see #3328 for details & discussion

update:

the canary releases from the previous PR must be being auto-scanned by a vulnerability detection system of some kind? these libraries have no dependents, and we haven't consumed any of these canaries, so I don't understand what's going on here 😆

TODO:

  • fix umd build, currently react jsx runtime is inlined and tries to read process?

@changeset-bot
Copy link

changeset-bot bot commented Jul 13, 2023

⚠️ No Changeset found

Latest commit: 6a66998

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jul 13, 2023

The latest changes of this PR are available as canary in npm (based on the declared changesets):

@acao acao changed the base branch from main to simplify-build July 13, 2023 14:01
@acao acao force-pushed the graphiql-plugin-utils-main branch from 4e27388 to 2a121a9 Compare July 13, 2023 14:04
@acao acao changed the title @graphiql/plugin-utils & docs, redo #3328 off main @graphiql/plugin-utils & docs, redo #3328 off simplify-build Jul 13, 2023
@acao acao changed the title @graphiql/plugin-utils & docs, redo #3328 off simplify-build @graphiql/plugin-utils & docs, redo #3328 against simplify-build Jul 13, 2023
@acao acao force-pushed the graphiql-plugin-utils-main branch from 2a896b4 to 6b76b9e Compare July 13, 2023 17:35
@acao acao force-pushed the graphiql-plugin-utils-main branch from 6b76b9e to 6fada52 Compare July 14, 2023 14:30
@acao acao force-pushed the simplify-build branch 2 times, most recently from 8ba096a to 1ef3601 Compare July 14, 2023 19:02
@acao acao force-pushed the graphiql-plugin-utils-main branch from 6fada52 to d96a33b Compare July 14, 2023 19:07
Base automatically changed from simplify-build to main July 16, 2023 10:01
@acao acao force-pushed the graphiql-plugin-utils-main branch 3 times, most recently from ba3c8e8 to 9ff7e66 Compare July 16, 2023 11:09
@acao acao changed the title @graphiql/plugin-utils & docs, redo #3328 against simplify-build @graphiql/plugin-utils & docs, redo #3328 Jul 18, 2023
@acao acao force-pushed the graphiql-plugin-utils-main branch from 48b006a to 903bec8 Compare July 22, 2023 12:31
@acao acao force-pushed the graphiql-plugin-utils-main branch from 903bec8 to 89197e6 Compare August 1, 2023 08:57
@netlify
Copy link

netlify bot commented Aug 1, 2023

Deploy Preview for graphiql-test ready!

Name Link
🔨 Latest commit 6d53c4d
🔍 Latest deploy log https://app.netlify.com/sites/graphiql-test/deploys/64c93e0f1aa6b70007874767
😎 Deploy Preview https://deploy-preview-3346--graphiql-test.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@acao acao force-pushed the graphiql-plugin-utils-main branch from 5160d71 to 6a66998 Compare August 12, 2023 18:11
@codecov
Copy link

codecov bot commented Aug 12, 2023

Codecov Report

Merging #3346 (6a66998) into main (2348641) will increase coverage by 0.10%.
Report is 10 commits behind head on main.
The diff coverage is 98.38%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3346      +/-   ##
==========================================
+ Coverage   55.75%   55.85%   +0.10%     
==========================================
  Files         110      110              
  Lines        5243     5256      +13     
  Branches     1426     1432       +6     
==========================================
+ Hits         2923     2936      +13     
  Misses       1897     1897              
  Partials      423      423              
Files Changed Coverage Δ
...nguage-service/src/utils/getVariablesJSONSchema.ts 94.59% <98.38%> (+0.71%) ⬆️

Copy link
Contributor

@TallTed TallTed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, human facing.

Comment on lines +25 to +27
// TODO: process.env.npm_package_json_path is no longer present in vite. study
try {
// more vite plugins to see how others load the full package.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO: process.env.npm_package_json_path is no longer present in vite. study
try {
// more vite plugins to see how others load the full package.json
// TODO: process.env.npm_package_json_path is no longer present in vite. study
// more vite plugins to see how others load the full package.json
try {

Comment on lines +5 to +6
Developing GraphiQL plugins has always been possible since we introduced them in `graphiql@2`, but the configuration has been a bit tricky
For this, we've created [`@graphiql/plugin-utils`](../../graphiql-plugin-utils/) to help minimize the configuration footprint, set some conventions, and get you up and running
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Developing GraphiQL plugins has always been possible since we introduced them in `graphiql@2`, but the configuration has been a bit tricky
For this, we've created [`@graphiql/plugin-utils`](../../graphiql-plugin-utils/) to help minimize the configuration footprint, set some conventions, and get you up and running
Developing GraphiQL plugins has always been possible since we introduced them in `graphiql@2`, but the configuration has been a bit tricky.
For this, we've created [`@graphiql/plugin-utils`](../../graphiql-plugin-utils/) to help minimize the configuration footprint, set some conventions, and get you up and running.

Comment on lines +10 to +13
1. copy `packages/graphiql-plugin-explorer` to get started
1. customize the package `name`, `description`, and `dependencies`, etc as needed
1. in `vite.config.ts`, change the `umdExportName`. this is how users will load your plugin in the commonly used UMD mode (aka cdn mode, see below)
1. now, begin authoring your plugin in `src/index.tsx`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. copy `packages/graphiql-plugin-explorer` to get started
1. customize the package `name`, `description`, and `dependencies`, etc as needed
1. in `vite.config.ts`, change the `umdExportName`. this is how users will load your plugin in the commonly used UMD mode (aka cdn mode, see below)
1. now, begin authoring your plugin in `src/index.tsx`
1. Copy `packages/graphiql-plugin-explorer` to get started.
1. Customize the package `name`, `description`, and `dependencies`, etc., as needed.
1. In `vite.config.ts`, change the `umdExportName`. This is how users will load your plugin in the commonly used UMD mode (a/k/a cdn mode; see below).
1. Now, begin authoring your plugin in `src/index.tsx`.


## Use the `@graphiql/react` SDK

you can use the `@graphiql/react` hooks as needed, as your plugin will be able to access all needed contexts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
you can use the `@graphiql/react` hooks as needed, as your plugin will be able to access all needed contexts
You can use the `@graphiql/react` hooks as needed, as your plugin will be able to access all needed contexts.


## Export a plugin definition

now, your default export can be the entire plugin definition:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
now, your default export can be the entire plugin definition:
Now, your default export can be the entire plugin definition:


## Usage: ESM

Now that it's published to npm or in your monorepo, you can use the plugin in ESM bundler mode easily
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Now that it's published to npm or in your monorepo, you can use the plugin in ESM bundler mode easily
Now that it's published to `npm` or in your `monorepo`, you can easily use the plugin in ESM bundler mode.

});
```

So we use that UMD global in our script:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
So we use that UMD global in our script:
We use that UMD global in our script:

<body>
<div id="graphiql"></div>
</body>
<!-- be sure to include all the other imports, such as react, react-dom and graphiql itself, see /examples/graphiql-cdn -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<!-- be sure to include all the other imports, such as react, react-dom and graphiql itself, see /examples/graphiql-cdn -->
<!-- Be sure to include all the other imports, such as react, react-dom, and graphiql itself. See /examples/graphiql-cdn. -->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants