@graphox/darwin-x64 0.1.13
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/README.md +332 -0
- package/bin/graphox +0 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# Graphox
|
|
2
|
+
|
|
3
|
+
A high-performance GraphQL toolset for TypeScript monorepos, providing LSP, type generation, and validation.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Features](#features)
|
|
8
|
+
- [Quick Start](#quick-start)
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Editor Setup](#editor-setup)
|
|
11
|
+
- [Commands](#commands)
|
|
12
|
+
- [Configuration](#configuration)
|
|
13
|
+
- [Fragment Directives](#fragment-directives)
|
|
14
|
+
- [Build Tool Plugins](./docs/plugins.md)
|
|
15
|
+
- [Validation Rules](./docs/rules.md)
|
|
16
|
+
- [Architecture](./docs/architecture.md)
|
|
17
|
+
- [Common Configurations](./docs/configurations.md)
|
|
18
|
+
- [Contributing](./CONTRIBUTING.md)
|
|
19
|
+
- [Plugin Development](./docs/plugin-development.md)
|
|
20
|
+
- [License](#license)
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
**Language Server (LSP)**
|
|
25
|
+
- Real-time GraphQL validation with granular diagnostics
|
|
26
|
+
- Autocomplete, go-to-definition, hover documentation, and find references
|
|
27
|
+
- Fragment dependency tracking and validation
|
|
28
|
+
- Semantic syntax highlighting and call hierarchy
|
|
29
|
+
- File watching with incremental updates
|
|
30
|
+
- Automatic codegen on file changes
|
|
31
|
+
|
|
32
|
+
**Type Generation (Codegen)**
|
|
33
|
+
- TypeScript type generation from GraphQL operations
|
|
34
|
+
- Apollo AST generation for apollo-client
|
|
35
|
+
- Shared fragment support between packages
|
|
36
|
+
|
|
37
|
+
**Supported Formats**
|
|
38
|
+
- Standalone `.graphql` files
|
|
39
|
+
- Embedded GraphQL in TypeScript/TSX template literals (`gql`, `graphql` tags)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
1. **Install the CLI**
|
|
46
|
+
```bash
|
|
47
|
+
pnpm add @graphox/cli
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. **Create configuration**
|
|
51
|
+
```yaml
|
|
52
|
+
# graphox.yaml
|
|
53
|
+
projects:
|
|
54
|
+
- schema: "schema.graphql"
|
|
55
|
+
include: "src/**/*.{ts,tsx}"
|
|
56
|
+
output_dir: "__generated__"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
3. **Set up your editor** - See [Editor Setup](#editor-setup)
|
|
60
|
+
|
|
61
|
+
4. **Run commands**
|
|
62
|
+
```bash
|
|
63
|
+
pnpm graphox check # Validate GraphQL files
|
|
64
|
+
pnpm graphox codegen # Generate TypeScript types
|
|
65
|
+
pnpm graphox lsp # Start LSP (for editors)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
### NPM Package (Recommended)
|
|
73
|
+
|
|
74
|
+
Install via pnpm to automatically download the correct binary for your platform:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pnpm add @graphox/cli
|
|
78
|
+
npm install @graphox/cli
|
|
79
|
+
yarn add @graphox/cli
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Then use with pnpm:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pnpm graphox lsp
|
|
86
|
+
pnpm graphox check
|
|
87
|
+
pnpm graphox codegen
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or install globally:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pnpm add -g @graphox/cli
|
|
94
|
+
graphox lsp
|
|
95
|
+
graphox check
|
|
96
|
+
graphox codegen
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Manual Binary Installation
|
|
100
|
+
|
|
101
|
+
Download pre-built binaries from the [releases page](https://github.com/soundtrackyourbrand/graphox/releases) for:
|
|
102
|
+
- macOS (x86_64, ARM64)
|
|
103
|
+
- Linux (x86_64, ARM64)
|
|
104
|
+
- Windows (x86_64, ARM64)
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Build Tool Plugins
|
|
109
|
+
|
|
110
|
+
Optimize bundle size by ensuring GraphQL AST files are properly codesplit.
|
|
111
|
+
|
|
112
|
+
| Build Tool | Plugin | Documentation |
|
|
113
|
+
|------------|--------|---------------|
|
|
114
|
+
| rsbuild | SWC Plugin | [plugins/swc/README.md](plugins/swc/README.md) |
|
|
115
|
+
| Turbopack/Next.js | SWC Plugin | [plugins/swc/README.md](plugins/swc/README.md) |
|
|
116
|
+
| React Native (Metro) | Babel Plugin | [plugins/babel/README.md](plugins/babel/README.md) |
|
|
117
|
+
| Webpack | Babel Plugin | [plugins/babel/README.md](plugins/babel/README.md) |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Editor Setup
|
|
122
|
+
|
|
123
|
+
Set up `Graphox` as a language server in your editor:
|
|
124
|
+
|
|
125
|
+
| Editor | Setup Guide |
|
|
126
|
+
|--------|-------------|
|
|
127
|
+
| VSCode | [editors/vscode/README.md](editors/vscode/README.md) |
|
|
128
|
+
| Neovim | [editors/neovim.md](editors/neovim.md) |
|
|
129
|
+
| IntelliJ | [editors/intellij.md](editors/intellij.md) |
|
|
130
|
+
|
|
131
|
+
### Quick Editor Configuration
|
|
132
|
+
|
|
133
|
+
**VSCode:** Install the [Graphox extension](https://marketplace.visualstudio.com/items?itemName=graphox.graphox) or use the npm package.
|
|
134
|
+
|
|
135
|
+
**Neovim:** Configure LSP with `nvim-lspconfig`:
|
|
136
|
+
|
|
137
|
+
```lua
|
|
138
|
+
require('lspconfig').graphox.setup({
|
|
139
|
+
cmd = { 'pnpm', 'exec', 'graphox', 'lsp' },
|
|
140
|
+
filetypes = { 'graphql', 'typescript', 'typescriptreact' },
|
|
141
|
+
})
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**IntelliJ/JetBrains:** Install LSP4IJ plugin and configure to run `pnpm exec graphox lsp`.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Commands
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Start the Language Server
|
|
152
|
+
graphox lsp
|
|
153
|
+
|
|
154
|
+
# Validate GraphQL files
|
|
155
|
+
graphox check
|
|
156
|
+
|
|
157
|
+
# Generate TypeScript types
|
|
158
|
+
graphox codegen
|
|
159
|
+
graphox codegen --clean # Remove generated files and caches
|
|
160
|
+
graphox codegen --watch # Watches and runs codegen of file changes
|
|
161
|
+
|
|
162
|
+
# Run performance benchmarks
|
|
163
|
+
graphox benchmark
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Command Options
|
|
167
|
+
|
|
168
|
+
- `check` - Validates all GraphQL files against the schema
|
|
169
|
+
- `codegen` - Generates TypeScript types for operations
|
|
170
|
+
- `lsp` - Starts the Language Server Protocol server
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Configuration
|
|
175
|
+
|
|
176
|
+
Create a `graphox.yaml` file in your project root.
|
|
177
|
+
|
|
178
|
+
### Basic Example
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
projects:
|
|
182
|
+
- schema: "schema.graphql"
|
|
183
|
+
include: "src/**/*.{ts,tsx}"
|
|
184
|
+
exclude: "**/*.test.ts"
|
|
185
|
+
output_dir: "__generated__"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Full Configuration
|
|
189
|
+
|
|
190
|
+
See [Common Configurations](docs/configurations.md) for detailed examples including:
|
|
191
|
+
- Single and multi-project setups
|
|
192
|
+
- Custom scalars and schema types
|
|
193
|
+
- Performance tuning and LSP tracing
|
|
194
|
+
- Monorepo patterns with shared fragments
|
|
195
|
+
|
|
196
|
+
### Configuration Notes
|
|
197
|
+
|
|
198
|
+
- Configuration is discovered by searching current directory and parent directories for `graphox.yaml` or `graphox.yml`
|
|
199
|
+
- All file paths in the config are resolved relative to the config file location
|
|
200
|
+
- Schema files can be specified as single strings or arrays for multi-file schemas
|
|
201
|
+
- Include/exclude patterns support standard glob syntax (`**/*.ts`, `src/**/*.{ts,tsx}`)
|
|
202
|
+
- Projects are matched in order; the first matching project is used for each file
|
|
203
|
+
|
|
204
|
+
See [Validation Rules](docs/rules.md) for configuring validation rules.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Fragment Directives
|
|
209
|
+
|
|
210
|
+
### @public - Shareable Fragments Across Projects
|
|
211
|
+
|
|
212
|
+
Use `@public` to make fragments available for import in other projects within your monorepo:
|
|
213
|
+
|
|
214
|
+
```graphql
|
|
215
|
+
# In package-a/fragments.graphql
|
|
216
|
+
fragment UserFields on User @public {
|
|
217
|
+
id
|
|
218
|
+
name
|
|
219
|
+
email
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
```graphql
|
|
224
|
+
# In package-b/query.graphql
|
|
225
|
+
query GetUser($id: ID!) {
|
|
226
|
+
user(id: $id) {
|
|
227
|
+
...UserFields # Imports from package-a
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Generated TypeScript types will automatically import the fragment type:
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
// package-b/query.codegen.ts
|
|
236
|
+
import type { UserFields } from "@workspace/package-a";
|
|
237
|
+
|
|
238
|
+
export interface GetUserQuery {
|
|
239
|
+
user: ({ __typename: "User" } & UserFields) | null;
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Configuration requirement:** Set the `import` field in your project config to specify how other projects should import from it:
|
|
244
|
+
|
|
245
|
+
```yaml
|
|
246
|
+
projects:
|
|
247
|
+
- schema: "schema.graphql"
|
|
248
|
+
include: "packages/package-a/**/*.graphql"
|
|
249
|
+
import: "@workspace/package-a" # Other projects import from here
|
|
250
|
+
|
|
251
|
+
- schema: "schema.graphql"
|
|
252
|
+
include: "packages/package-b/**/*.graphql"
|
|
253
|
+
import: "@workspace/package-b"
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### @type_only - Type-Only Fragments
|
|
257
|
+
|
|
258
|
+
Use `@type_only` for fragments that are only used for TypeScript types and never used in actual GraphQL queries:
|
|
259
|
+
|
|
260
|
+
```graphql
|
|
261
|
+
# Define reusable type-only fragment
|
|
262
|
+
fragment UserBaseFields on User @type_only {
|
|
263
|
+
id
|
|
264
|
+
name
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
# Spread it in another fragment to compose types
|
|
268
|
+
fragment UserWithEmail on User {
|
|
269
|
+
...UserBaseFields
|
|
270
|
+
email
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Generated types will include the fragment but **no AST** will be generated:
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
// Only type definition, no DocumentNode/AST
|
|
278
|
+
export interface UserBaseFields {
|
|
279
|
+
__typename: "User";
|
|
280
|
+
id: string;
|
|
281
|
+
name: string;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Full fragment with AST
|
|
285
|
+
export interface UserWithEmail {
|
|
286
|
+
__typename: "User";
|
|
287
|
+
id: string;
|
|
288
|
+
name: string;
|
|
289
|
+
email: string;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export const UserWithEmailFragmentDocument = { /* AST */ };
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
This prevents warnings about unused fragments for these as the tool is not following use of the typescript types.
|
|
296
|
+
The LSP will warn if you accidentally use a `@type_only` fragment in a query and provide a code action to remove it.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Contributing
|
|
301
|
+
|
|
302
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed information on:
|
|
303
|
+
- Development setup and prerequisites
|
|
304
|
+
- Testing your changes (CLI and editor)
|
|
305
|
+
- Code quality commands
|
|
306
|
+
- Release process
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Advanced Topics
|
|
311
|
+
|
|
312
|
+
See [docs/architecture.md](./docs/architecture.md) for in-depth documentation on:
|
|
313
|
+
- System architecture and components
|
|
314
|
+
- Data flow and processing pipeline
|
|
315
|
+
- Performance characteristics
|
|
316
|
+
- Caching strategy
|
|
317
|
+
|
|
318
|
+
See [docs/configurations.md](./docs/configurations.md) for:
|
|
319
|
+
- Multi-project workspace setup
|
|
320
|
+
- Custom scalar mappings
|
|
321
|
+
- Performance tuning
|
|
322
|
+
- LSP tracing configuration
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## License
|
|
327
|
+
|
|
328
|
+
MIT
|
|
329
|
+
|
|
330
|
+
## Repository
|
|
331
|
+
|
|
332
|
+
https://github.com/soundtrackyourbrand/graphox
|
package/bin/graphox
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@graphox/darwin-x64",
|
|
3
|
+
"version": "0.1.13",
|
|
4
|
+
"description": "Graphox CLI binary for darwin-x64",
|
|
5
|
+
"os": [
|
|
6
|
+
"darwin"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"x64"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/graphox"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/soundtrackyourbrand/graphox"
|
|
20
|
+
},
|
|
21
|
+
"license": "UNLICENSED"
|
|
22
|
+
}
|