Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
iamchanii committed Jun 21, 2023
1 parent 19d0a4b commit 89ae883
Show file tree
Hide file tree
Showing 19 changed files with 7,618 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/dist
20 changes: 20 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { typescript, ...restDprintOptions } = require('./dprint.json');

module.exports = {
extends: [
'plugin:perfectionist/recommended-natural',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'dprint-integration'],
root: true,
rules: {
'dprint-integration/dprint': [
'error',
restDprintOptions,
{ typescript },
],
'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 0, maxEOF: 0 }],
},
};
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules
**/dist
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"prettier.enable": false,
"editor.formatOnSave": true,
"eslint.format.enable": true,
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# pothos-plugin-effect
# pothos-plugin-effect

Status: WIP
1 change: 1 addition & 0 deletions demo/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
38 changes: 38 additions & 0 deletions demo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as Effect from '@effect/io/Effect';
import EffectPlugin from '@imchhh/pothos-plugin-effect';
import SchemaBuilder from '@pothos/core';
import { createYoga } from 'graphql-yoga';
import { createServer } from 'node:http';

const builder = new SchemaBuilder({
plugins: [EffectPlugin],
});

builder.queryType({});

const Test = builder.objectRef<{ name: string }>('Test').implement({
fields: t => ({
name: t.exposeString('name'),
}),
});

builder.queryFields(t => ({
ping: t.field({
resolve: () => 'pong',
type: 'String',
}),
pingEffect: t.effect({
resolve: () => {
return Effect.succeed({ name: 'test11111' });
},
type: Test,
}),
}));

const schema = builder.toSchema();

const yoga = createYoga({ schema });

const server = createServer(yoga);

server.listen(43000);
20 changes: 20 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"typescript": {
"quoteStyle": "preferSingle",
"indentWidth": 2,
"importDeclaration.sortNamedImports": "maintain",
"module.sortImportDeclarations": "maintain",
"jsx.quoteStyle": "preferDouble"
},
"json": {},
"markdown": {},
"toml": {},
"includes": ["**/*.{ts,tsx,js,jsx,cjs,mjs,json,md,toml}"],
"excludes": ["**/node_modules", "**/*-lock.json"],
"plugins": [
"https://plugins.dprint.dev/typescript-0.85.0.wasm",
"https://plugins.dprint.dev/json-0.17.4.wasm",
"https://plugins.dprint.dev/markdown-0.15.3.wasm",
"https://plugins.dprint.dev/toml-0.5.4.wasm"
]
}
13 changes: 13 additions & 0 deletions dts-bundle.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-check

/** @type import('dts-bundle-generator/config-schema').BundlerConfig */
const config = {
entries: [
{
filePath: './src/index.ts',
outFile: './dist/index.d.ts',
},
],
};

module.exports = config;
Loading

0 comments on commit 89ae883

Please sign in to comment.