Skip to content

Commit bd13b32

Browse files
committed
Merge branch 'main' into graphiql-6
2 parents 53054cd + 2a46972 commit bd13b32

23 files changed

Lines changed: 373 additions & 101 deletions

File tree

.changeset/config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@2.0.1/schema.json",
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
33
"changelog": ["@changesets/changelog-github", { "repo": "graphql/graphiql" }],
44
"commit": false,
55
"linked": [],
@@ -14,6 +14,10 @@
1414
"example-monaco-graphql-webpack"
1515
],
1616
"updateInternalDependencies": "patch",
17+
"privatePackages": {
18+
"version": true,
19+
"tag": true
20+
},
1721
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
1822
"onlyUpdatePeerDependentsWhenOutOfRange": true
1923
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'vscode-graphql-execution': patch
3+
'vscode-graphql-syntax': patch
4+
'vscode-graphql': patch
5+
---
6+
7+
Burning patch version due to previous release failure.

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
~/.cache/Cypress
148148
key: cypress-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
149149
- name: Cypress run
150-
uses: cypress-io/github-action@v6
150+
uses: cypress-io/github-action@v7
151151
with:
152152
install: false
153153
command: yarn e2e

.github/workflows/release.yml

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
# To enable trusted publishing
3232
id-token: write
3333

34+
outputs:
35+
vscode-published: ${{ steps.vscode.outputs.published }}
36+
published-packages: ${{ steps.changesets.outputs.publishedPackages }}
37+
3438
steps:
3539
- name: Checkout Code
3640
uses: actions/checkout@v6
@@ -42,7 +46,7 @@ jobs:
4246
node-version-file: '.node-version'
4347
cache: yarn
4448

45-
- run: yarn install --frozen-lockfile --immutable
49+
- run: yarn install --immutable
4650

4751
- name: Create Release Pull Request or Publish to npm
4852
id: changesets
@@ -51,8 +55,70 @@ jobs:
5155
version: yarn ci:version
5256
# This expects you to have a script called release which does a build for your packages and calls changeset publish
5357
publish: yarn release
58+
59+
- name: Note VSCode extension release
60+
id: vscode
61+
if: ${{ steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '"name":"vscode-graphql') }}
62+
run: echo "published=true" >> "$GITHUB_OUTPUT"
63+
64+
- name: Build VSCode extension .vsix files
65+
if: ${{ steps.vscode.outputs.published == 'true' }}
66+
env:
67+
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
68+
run: node scripts/release-vscode.mts build
69+
70+
- name: Attach VSCode .vsix files to GitHub Releases
71+
if: ${{ steps.vscode.outputs.published == 'true' }}
72+
env:
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
75+
run: node scripts/release-vscode.mts attach
76+
77+
- name: Upload VSCode extension .vsix artifacts
78+
if: ${{ steps.vscode.outputs.published == 'true' }}
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: vscode-extensions
82+
path: packages/vscode-graphql*/*.vsix
83+
if-no-files-found: error
84+
85+
publish-vscode-extensions:
86+
name: Publish to ${{ matrix.registry }}
87+
needs: release
88+
if: ${{ needs.release.outputs.vscode-published == 'true' }}
89+
runs-on: ubuntu-latest
90+
permissions: {}
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
include:
95+
- registry: VSCode Marketplace
96+
command: publish-vsce
97+
- registry: Open VSX Registry
98+
command: publish-ovsx
99+
steps:
100+
- uses: actions/checkout@v5
101+
102+
- uses: actions/setup-node@v6
103+
with:
104+
node-version-file: '.node-version'
105+
cache: yarn
106+
107+
- run: yarn install --immutable
108+
109+
- uses: actions/download-artifact@v4
110+
with:
111+
name: vscode-extensions
112+
# `upload-artifact` strips the path prefix up to the first wildcard
113+
# segment, so the artifact contains `vscode-graphql*/*.vsix` rather
114+
# than `packages/vscode-graphql*/*.vsix`. Restore the `packages/`
115+
# prefix here so the layout lines up with `vsixPath('vsix', …)` in
116+
# the script.
117+
path: vsix/packages
118+
119+
- name: Publish
54120
env:
55-
# for vscode marketplace, see https://github.com/microsoft/vscode-vsce/blob/194d59b975523696362ead891dc0f3ddd277b3bd/README.md#linux
56121
VSCE_PAT: ${{ secrets.VSCE_PAT }}
57-
# for ovsx, see https://github.com/eclipse/openvsx/blob/master/cli/README.md#publish-extensions
58122
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}
123+
PUBLISHED_PACKAGES: ${{ needs.release.outputs.published-packages }}
124+
run: node scripts/release-vscode.mts ${{ matrix.command }}

RELEASING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
# Cutting New Releases
22

33
TODO: Redo for `changesets`. See [`Changesets Readme`](./.changeset/README.md)
4+
5+
## VSCode extension releases
6+
7+
After Changesets publishes the npm packages, the release workflow hands the
8+
VSCode extension pipeline to [`scripts/release-vscode.mts`](./scripts/release-vscode.mts).
9+
It exposes four commands — `build`, `attach`, `publish-vsce`, `publish-ovsx`
10+
each of which operates only on the extensions actually released in this run
11+
(filtered from the Changesets `publishedPackages` output).
12+
13+
### Why attach to GitHub Releases
14+
15+
We upload each built `.vsix` to its GitHub Release tag in addition to
16+
publishing to the VSCode Marketplace and Open VSX. That makes the artifact
17+
downloadable directly from GitHub — useful when a registry is degraded, when
18+
a PAT has expired and a manual re-upload is needed, or for anyone who wants
19+
the exact bits we shipped without going through a marketplace.
20+
21+
### Why a TS script, not workflow shell
22+
23+
Per-package iteration, version lookups, and registry-API calls are tidier
24+
(and safer) in a type-checked TS file than spread across `run:` blocks of
25+
bash in `release.yml`. The script type-checks under `scripts/tsconfig.json`,
26+
can be run locally with a mocked `PUBLISHED_PACKAGES` env var, and aggregates
27+
failures across packages rather than short-circuiting on the first error.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"svgo": "svgo --pretty --indent 2 --eol lf --final-newline -r -f . --exclude node_modules",
5757
"svgo-check": "yarn svgo && git diff --exit-code -- '*.svg'",
5858
"ci:version": "yarn changeset version && yarn install --no-immutable && yarn build && yarn fix",
59-
"release": "yarn build && yarn build-bundles && (wsrun release --exclude-missing --serial --recursive --changedSince main -- || true) && yarn changeset publish",
59+
"release": "yarn build && yarn build-bundles && yarn changeset publish",
6060
"release:canary": "(node scripts/canary-release.mts && yarn build-bundles && yarn changeset publish --tag canary) || echo Skipping Canary...",
6161
"repo:lint": "manypkg check",
6262
"repo:fix": "manypkg fix",
@@ -128,7 +128,9 @@
128128
"vite": "6.3.4"
129129
},
130130
"devDependencies": {
131+
"@vscode/vsce": "^2.22.1-2",
131132
"jsdom": "^29.0.2",
133+
"ovsx": "0.8.3",
132134
"svgo": "^4.0.1"
133135
}
134136
}

packages/graphiql-react/src/components/operation-editor.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ import { FC, useEffect, useRef } from 'react';
88
import { useMonaco } from '../stores';
99
import { useGraphiQL, useGraphiQLActions } from './provider';
1010
import {
11-
debounce,
1211
getOrCreateModel,
1312
createEditor,
1413
onEditorContainerKeyDown,
15-
pick,
16-
cleanupDisposables,
17-
cn,
18-
} from '../utility';
14+
} from '../utility/create-editor';
15+
import { debounce, pick, cleanupDisposables, cn } from '../utility';
1916
import { Uri, Range } from '../utility/monaco-ssr';
2017
import type { MonacoEditor, EditorProps, SchemaReference } from '../types';
2118
import {

packages/graphiql-react/src/components/provider.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ import {
1111
import { create, useStore, UseBoundStore, StoreApi } from 'zustand';
1212
import { useShallow } from 'zustand/shallow';
1313
import { StorageAPI } from '@graphiql/toolkit';
14+
import { createEditorSlice, type EditorProps } from '../stores/editor';
1415
import {
15-
createEditorSlice,
1616
createExecutionSlice,
1717
createPluginSlice,
1818
createSchemaSlice,
1919
createThemeSlice,
2020
createStorageSlice,
21-
EditorProps,
2221
ExecutionProps,
2322
PluginProps,
2423
SchemaProps,

packages/graphiql-react/src/components/request-headers-editor.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ import { URI_NAME, KEY_BINDINGS, STORAGE_KEY } from '../constants';
55
import {
66
getOrCreateModel,
77
createEditor,
8-
useChangeHandler,
98
onEditorContainerKeyDown,
10-
pick,
11-
cleanupDisposables,
12-
cn,
13-
} from '../utility';
9+
} from '../utility/create-editor';
10+
import { useChangeHandler, pick, cleanupDisposables, cn } from '../utility';
1411
import { useMonaco } from '../stores';
1512

1613
interface RequestHeadersEditorProps extends EditorProps {

packages/graphiql-react/src/components/response-editor.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ import {
77
getOrCreateModel,
88
createEditor,
99
onEditorContainerKeyDown,
10-
pick,
11-
cleanupDisposables,
12-
cn,
13-
} from '../utility';
10+
} from '../utility/create-editor';
1411
import { Range } from '../utility/monaco-ssr';
12+
import { pick, cleanupDisposables, cn } from '../utility';
1513
import { KEY_BINDINGS, URI_NAME } from '../constants';
1614
import type { EditorProps } from '../types';
1715
import type * as monaco from 'monaco-editor';

0 commit comments

Comments
 (0)