@mearie/codegen 0.0.0 → 0.0.1-next.1
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 +5 -50
- package/package.json +16 -12
- package/src/index.ts +0 -4
package/README.md
CHANGED
|
@@ -1,55 +1,10 @@
|
|
|
1
1
|
# @mearie/codegen
|
|
2
2
|
|
|
3
|
-
Code
|
|
3
|
+
Code generator for Mearie GraphQL client.
|
|
4
4
|
|
|
5
|
-
This package
|
|
5
|
+
This package generates TypeScript types from GraphQL schema and operations. It
|
|
6
|
+
is used internally by build plugins and is not intended for direct use.
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
+
## Documentation
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
- **Generator**: Generates TypeScript types from GraphQL operations and schema
|
|
11
|
-
- **Writer**: Writes generated types to the filesystem
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { runCodegen, scanDocuments, generateTypes, writeTypes } from '@mearie/codegen';
|
|
17
|
-
|
|
18
|
-
// High-level API
|
|
19
|
-
await runCodegen({
|
|
20
|
-
schema: 'schema.graphql',
|
|
21
|
-
documents: 'src/**/*.ts',
|
|
22
|
-
cwd: process.cwd(),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Low-level API for custom workflows
|
|
26
|
-
const operations = await scanDocuments(
|
|
27
|
-
{
|
|
28
|
-
include: 'src/**/*.ts',
|
|
29
|
-
exclude: 'node_modules/**',
|
|
30
|
-
},
|
|
31
|
-
process.cwd(),
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const { types, augmentation } = await generateTypes(operations, schemaContent);
|
|
35
|
-
|
|
36
|
-
await writeTypes({ types, augmentation });
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## API
|
|
40
|
-
|
|
41
|
-
### `runCodegen(config: CodegenConfig): Promise<void>`
|
|
42
|
-
|
|
43
|
-
Runs the complete code generation pipeline.
|
|
44
|
-
|
|
45
|
-
### `scanDocuments(patterns: ScanPatterns, cwd: string): Promise<ExtractedDocument[]>`
|
|
46
|
-
|
|
47
|
-
Scans files for GraphQL operations.
|
|
48
|
-
|
|
49
|
-
### `generateTypes(operations: ExtractedDocument[], schema: string): Promise<GeneratedCode>`
|
|
50
|
-
|
|
51
|
-
Generates TypeScript types from operations and schema.
|
|
52
|
-
|
|
53
|
-
### `writeTypes(code: GeneratedCode, outputDir?: string): Promise<WrittenFiles>`
|
|
54
|
-
|
|
55
|
-
Writes generated types to the filesystem.
|
|
10
|
+
Full documentation is available at <https://mearie.dev/config/codegen>.
|
package/package.json
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearie/codegen",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.0.1-next.1",
|
|
4
|
+
"sideEffects": false,
|
|
6
5
|
"type": "module",
|
|
7
|
-
"main": "./
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
8
7
|
"files": [
|
|
9
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"package.json",
|
|
10
|
+
"README.md"
|
|
10
11
|
],
|
|
11
12
|
"dependencies": {
|
|
12
13
|
"picomatch": "^4.0.3",
|
|
13
14
|
"tinyglobby": "^0.2.15",
|
|
14
|
-
"@mearie/
|
|
15
|
-
"@mearie/
|
|
16
|
-
"@mearie/
|
|
17
|
-
"@mearie/native": "0.0.
|
|
15
|
+
"@mearie/config": "0.0.1-next.1",
|
|
16
|
+
"@mearie/extractor": "0.0.1-next.1",
|
|
17
|
+
"@mearie/core": "0.0.1-next.1",
|
|
18
|
+
"@mearie/native": "0.0.1-next.1"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"@types/picomatch": "^4.0.2",
|
|
21
|
-
"tsdown": "^0.15.
|
|
22
|
+
"tsdown": "^0.15.8",
|
|
22
23
|
"vitest": "^3.2.4"
|
|
23
24
|
},
|
|
24
25
|
"publishConfig": {
|
|
@@ -34,6 +35,9 @@
|
|
|
34
35
|
"types": "./dist/index.d.ts",
|
|
35
36
|
"import": "./dist/index.js",
|
|
36
37
|
"require": "./dist/index.cjs"
|
|
37
|
-
}
|
|
38
|
-
|
|
38
|
+
},
|
|
39
|
+
"./package.json": "./package.json"
|
|
40
|
+
},
|
|
41
|
+
"module": "./dist/index.js",
|
|
42
|
+
"types": "./dist/index.d.ts"
|
|
39
43
|
}
|
package/src/index.ts
DELETED