From 214cb7f1c15dbdeffe704a66fca00cf03020fb13 Mon Sep 17 00:00:00 2001 From: Madeorsk Date: Fri, 4 Oct 2024 16:28:03 +0200 Subject: [PATCH] Library setup. --- .gitignore | 17 +++++++++++++++++ README.md | 11 +++++++++++ jest.config.js | 10 ++++++++++ package.json | 40 ++++++++++++++++++++++++++++++++++++++++ vite.config.ts | 27 +++++++++++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 jest.config.js create mode 100644 package.json create mode 100644 vite.config.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7514d0a --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# IDEA + +.idea/ +*.iml + +# JS library + +coverage/ +lib/ +.parcel-cache/ +.yarn/ +.yarnrc* +yarn-error.log +.pnp* +node_modules/ + +yarn.lock diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a6a228 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +

+ Sharkitek Drizzle +

+ +

+ Documentation +

+ +

+ Drizzle connector for Sharkitek models +

diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..77a9c90 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,10 @@ +/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ + +export default { + preset: "ts-jest", + testEnvironment: "node", + + roots: [ + "./tests", + ], +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..ced3d11 --- /dev/null +++ b/package.json @@ -0,0 +1,40 @@ +{ + "name": "@sharkitek/drizzle", + "version": "1.0.0", + "description": "Drizzle connector for Sharkitek models.", + "repository": "https://code.zeptotech.net/Sharkitek/Drizzle", + "author": { + "name": "Madeorsk", + "email": "madeorsk@protonmail.com" + }, + "license": "MIT", + "scripts": { + "build": "tsc && vite build", + "test": "jest" + }, + "type": "module", + "source": "src/index.ts", + "types": "lib/index.d.ts", + "main": "lib/index.js", + "files": [ + "lib/**/*" + ], + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@types/jest": "^29.5.13", + "@types/node": "^22.7.4", + "drizzle-orm": "^0.33.0", + "jest": "^29.7.0", + "ts-jest": "^29.2.5", + "ts-node": "^10.9.2", + "typescript": "^5.6.2", + "vite": "^5.4.8", + "vite-plugin-dts": "^4.2.3" + }, + "peerDependencies": { + "drizzle-orm": "^0.33.0" + }, + "packageManager": "yarn@4.5.0" +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..7d8271f --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,27 @@ +import {ConfigEnv, defineConfig, UserConfig} from "vite"; +import dts from "vite-plugin-dts"; + +// https://vitejs.dev/config/ + +export default defineConfig(({ mode }: ConfigEnv): UserConfig => { + return ({ + build: { + outDir: "lib", + sourcemap: true, + minify: "esbuild", + lib: { + entry: "src/index.ts", + formats: ["es"], + fileName: "index", + }, + }, + + plugins: [ + dts({ + insertTypesEntry: true, + rollupTypes: true, + exclude: ["node_modules"], + }), + ] + }); +});