Skip to content

Commit

Permalink
wip drizzle plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
hayes committed Oct 16, 2023
1 parent d71685f commit f5a606a
Show file tree
Hide file tree
Showing 40 changed files with 3,797 additions and 40 deletions.
7 changes: 7 additions & 0 deletions packages/plugin-drizzle/.npmignore
@@ -0,0 +1,7 @@
test
tests
.turbo
babel.config.js
jest.config.js
*.tsbuildinfo
tsconfig.*
6 changes: 6 additions & 0 deletions packages/plugin-drizzle/LICENSE
@@ -0,0 +1,6 @@
ISC License (ISC)
Copyright 2021 Michael Hayes

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 changes: 20 additions & 0 deletions packages/plugin-drizzle/README.md
@@ -0,0 +1,20 @@
# Drizzle Plugin

## TODO

- [ ] connections
- [ ] connection helpers
- [ ] query usage checks
- [ ] normalize extras callback functions before merging
- [ ] with input integration
- [ ] errors integration
- [x] drizzle field methods on builder
- [x] drizzle refs
- [x] drizzle interface types
- [ ] tests
- [ ] docs
- [ ] variants
- [ ] fallback dataloader
- [ ] custom dataloader override
- [ ] default selections for id/data-loading
- [ ] interface check for compatibility of implementors
10 changes: 10 additions & 0 deletions packages/plugin-drizzle/drizzle.config.ts
@@ -0,0 +1,10 @@
import { Config } from 'drizzle-kit';

export default {
schema: './tests/example/db/schema.ts',
out: './tests/drizzle',
dbCredentials: {
url: './tests/example/db/dev.db',
},
driver: 'better-sqlite',
} satisfies Config;
4 changes: 4 additions & 0 deletions packages/plugin-drizzle/esm/.gitignore
@@ -0,0 +1,4 @@
*
!.gitignore
!.npmignore
!package.json
Empty file.
3 changes: 3 additions & 0 deletions packages/plugin-drizzle/esm/package.json
@@ -0,0 +1,3 @@
{
"type": "module"
}
6 changes: 6 additions & 0 deletions packages/plugin-drizzle/jest.config.js
@@ -0,0 +1,6 @@
module.exports = {
transformIgnorePatterns: [`node_modules`],
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest'],
},
};
62 changes: 62 additions & 0 deletions packages/plugin-drizzle/package.json
@@ -0,0 +1,62 @@
{
"name": "@pothos/plugin-drizzle",
"version": "0.0.0",
"description": "A Pothos plugin for drizzle",
"main": "./lib/index.js",
"types": "./dts/index.d.ts",
"module": "./esm/index.js",
"exports": {
"import": {
"default": "./esm/index.js"
},
"require": {
"types": "./dts/index.d.ts",
"default": "./lib/index.js"
}
},
"scripts": {
"type": "tsc --project tsconfig.type.json",
"build": "pnpm build:clean && pnpm build:cjs && pnpm build:dts && pnpm build:esm",
"build:clean": "git clean -dfX esm lib",
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs",
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 && pnpm esm:extensions",
"build:dts": "tsc",
"esm:extensions": "TS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../scripts/esm-transformer.ts",
"test": "pnpm vitest --run --segfault-retry=3"
},
"repository": {
"type": "git",
"url": "git+https://github.com/hayes/pothos.git",
"directory": "packages/plugin-relay"
},
"author": "Michael Hayes",
"license": "ISC",
"keywords": [
"pothos",
"graphql",
"schema",
"typescript",
"drizzle",
"plugin"
],
"publishConfig": {
"access": "public",
"provenance": true
},
"peerDependencies": {
"@pothos/core": "*",
"graphql": ">=16.4.0"
},
"devDependencies": {
"@pothos/core": "workspace:*",
"@pothos/plugin-relay": "workspace:*",
"@pothos/plugin-scope-auth": "workspace:*",
"@pothos/test-utils": "workspace:*",
"@types/better-sqlite3": "^7.6.5",
"better-sqlite3": "^8.7.0",
"drizzle-kit": "^0.19.13",
"drizzle-orm": "^0.28.6",
"graphql": "16.8.1",
"graphql-tag": "^2.12.6"
}
}

0 comments on commit f5a606a

Please sign in to comment.