Skip to content
Open
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
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub Personal Access Token for GraphQL Codegen
GITHUB_TOKEN=some-pat
17 changes: 4 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,15 @@ build/
# Dependency directories
node_modules/

# Generated GraphQL Files
schema.graphql

# Coverage directory used by tools like istanbul
coverage
*.lcov

# Logs
logs
*.log
npm-debug.log*

# Environment configuration
# Environment properties
.env

# Optional npm cache directory
.npm

# Temporary folders
tmp/
temp/

# Mac Files
.DS_Store
2 changes: 2 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"recommendations": [
"biomejs.biome",
"bradlc.vscode-tailwindcss",
"GraphQL.vscode-graphql",
"GraphQL.vscode-graphql-syntax",
"SonarSource.sonarlint-vscode"
]
}
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ pnpm install
> OAUTH_CLIENT_ID="123" OAUTH_CLIENT_SECRET="456789" pnpm build
> ```

Copy the `.env.template` to `.env` and add update `GITHUB_TOKEN` with a GitHub Personal Access Token. This is used for fetching the latest GitHub GraphQL API schema for `graphql-codegen`.
```shell
GITHUB_TOKEN=<some personal access token>
```

To watch for changes (`webpack`) in the `src` directory:

```shell
Expand Down
3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
"files": {
"includes": ["**", "!**/generated/**/*"]
},
"assist": {
"actions": {
"source": {
Expand Down
34 changes: 34 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { CodegenConfig } from '@graphql-codegen/cli';
import dotenv from 'dotenv';

dotenv.config();

const config: CodegenConfig = {
overwrite: true,
schema: {
'https://api.github.com/graphql': {
// Add a custom header for authorization using your PAT
headers: {
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
},
},
},
documents: ['src/renderer/utils/api/**/*.graphql'],
generates: {
'src/renderer/utils/api/graphql/generated/': {
preset: 'client',
config: {
documentMode: 'string',
useTypeImports: true,
},
},
'src/renderer/utils/api/graphql/generated/schema.graphql': {
plugins: ['schema-ast'],
config: {
includeDirectives: true,
},
},
},
};

export default config;
7 changes: 7 additions & 0 deletions graphql.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { IGraphQLConfig } from 'graphql-config';

const config: IGraphQLConfig = {
schema: './src/renderer/utils/api/graphql/generated/schema.graphql',
};

export default config;
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build:main": "webpack --config ./config/webpack.config.main.prod.ts",
"build:preload": "webpack --config ./config/webpack.config.preload.prod.ts",
"build:renderer": "webpack --config ./config/webpack.config.renderer.prod.ts",
"watch": "concurrently --names \"main,preload,renderer\" --prefix-colors \"blue,magenta,green\" \"pnpm watch:main\" \"pnpm watch:preload\" \"pnpm watch:renderer\"",
"watch": "concurrently --names \"main,preload,renderer,codegen\" --prefix-colors \"blue,magenta,green,cyan\" \"pnpm watch:main\" \"pnpm watch:preload\" \"pnpm watch:renderer\" \"pnpm watch:codegen\"",
"watch:codegen": "pnpm codegen --watch",
"watch:main": "webpack --watch --config ./config/webpack.config.main.base.ts",
"watch:preload": "webpack --watch --config ./config/webpack.config.preload.base.ts",
"watch:renderer": "webpack --watch --config ./config/webpack.config.renderer.base.ts",
Expand All @@ -20,7 +21,8 @@
"lint": "biome check --fix",
"test": "jest",
"start": "electron . --enable-logging",
"prepare": "husky"
"prepare": "husky",
"codegen": "graphql-codegen --config codegen.ts"
},
"engines": {
"node": ">=24"
Expand Down Expand Up @@ -79,6 +81,9 @@
"@biomejs/biome": "2.3.8",
"@discordapp/twemoji": "16.0.1",
"@electron/notarize": "3.1.1",
"@graphql-codegen/cli": "6.1.0",
"@graphql-codegen/schema-ast": "5.0.0",
"@parcel/watcher": "2.5.1",
"@primer/css": "22.0.2",
"@primer/octicons-react": "19.21.1",
"@primer/primitives": "11.3.1",
Expand All @@ -101,10 +106,11 @@
"css-loader": "7.1.2",
"css-minimizer-webpack-plugin": "7.0.3",
"date-fns": "4.1.0",
"dotenv": "17.2.3",
"electron": "39.2.6",
"electron-builder": "26.0.12",
"final-form": "5.0.0",
"graphql-tag": "2.12.6",
"graphql": "16.12.0",
"html-webpack-plugin": "5.6.5",
"husky": "9.1.7",
"identity-obj-proxy": "3.0.0",
Expand Down Expand Up @@ -132,9 +138,9 @@
"pnpm": {
"onlyBuiltDependencies": [
"@biomejs/biome",
"@parcel/watcher",
"@tailwindcss/oxide",
"electron",
"esbuild"
"electron"
]
},
"lint-staged": {
Expand Down
Loading