Skip to content

Commit

Permalink
apply biome on codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
RajaRakoto committed Nov 25, 2024
1 parent 199ce90 commit ad2c43c
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 183 deletions.
16 changes: 8 additions & 8 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { defineConfig } from "drizzle-kit";

//Configured for SQLite with Bun sqlite
export default defineConfig({
dialect: "sqlite",
schema: "./drizzle/schema.ts",
out: "./drizzle/migrations",
dbCredentials: {
url: process.env.DATABASE_URL as string,
},
strict: true,
verbose: true,
dialect: "sqlite",
schema: "./drizzle/schema.ts",
out: "./drizzle/migrations",
dbCredentials: {
url: process.env.DATABASE_URL as string,
},
strict: true,
verbose: true,
});
27 changes: 20 additions & 7 deletions drizzle/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,35 @@ import { tGemini, tGeminiUsage } from "./schema";

/* types */
import type {
I_Gemini,
I_GeminiUsage,
T_qInsertTable,
T_qInsertValues,
I_Gemini,
I_GeminiUsage,
T_qInsertTable,
T_qInsertValues,
T_tGeminiSchema,
T_tGeminiUsageSchema,
} from "./types";

// ===============================

export const rGemini: I_Gemini = (
await db.select().from(tGemini).where(eq(tGemini.geminiId, 1))
await db.select().from(tGemini).where(eq(tGemini.geminiId, 1))
)[0];

export const rGeminiUsage: I_GeminiUsage = (
await db.select().from(tGeminiUsage).where(eq(tGeminiUsage.geminiUsageId, 1))
await db.select().from(tGeminiUsage).where(eq(tGeminiUsage.geminiUsageId, 1))
)[0];

export async function qInsert(table: T_qInsertTable, values: T_qInsertValues) {
await db.insert(table).values(values);
await db.insert(table).values(values);
}

export async function qUpdateGemini(values: T_tGeminiSchema) {
await db.update(tGemini).set(values).where(eq(tGemini.geminiId, 1));
}

export async function qUpdateGeminiUsage(values: T_tGeminiUsageSchema) {
await db
.update(tGeminiUsage)
.set(values)
.where(eq(tGeminiUsage.geminiUsageId, 1));
}
38 changes: 19 additions & 19 deletions drizzle/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ import { sqliteTable, integer, numeric } from "drizzle-orm/sqlite-core";
// ==============================

export const tGemini = sqliteTable("t_gemini", {
geminiId: integer("gemini_id").primaryKey({ autoIncrement: true }),
apiKey: numeric("api_key"),
model: numeric("model").notNull(),
prompt: numeric("prompt").notNull(),
geminiId: integer("gemini_id").primaryKey({ autoIncrement: true }),
apiKey: numeric("api_key"),
model: numeric("model").notNull(),
prompt: numeric("prompt").notNull(),
});

export const tGeminiUsage = sqliteTable("t_gemini_usage", {
geminiUsageId: integer("gemini_usage_id").primaryKey({ autoIncrement: true }),
rpmLimit: integer("rpm_limit").notNull(),
rpdLimit: integer("rpd_limit").notNull(),
tpmLimit: integer("tpm_limit").notNull(),
rpmStart: numeric("rpm_start"),
rpdStart: numeric("rpd_start"),
tpmStart: numeric("tpm_start"),
rpmEnd: numeric("rpm_end"),
rpdEnd: numeric("rpd_end"),
tpmEnd: numeric("tpm_end"),
rpmCounter: integer("rpm_counter"),
rpdCounter: integer("rpd_counter"),
tpmCounter: integer("tpm_counter"),
intervalDelay: integer("interval_delay"),
breakDelay: integer("breakDelay"),
geminiUsageId: integer("gemini_usage_id").primaryKey({ autoIncrement: true }),
rpmLimit: integer("rpm_limit").notNull(),
rpdLimit: integer("rpd_limit").notNull(),
tpmLimit: integer("tpm_limit").notNull(),
rpmStart: numeric("rpm_start"),
rpdStart: numeric("rpd_start"),
tpmStart: numeric("tpm_start"),
rpmEnd: numeric("rpm_end"),
rpdEnd: numeric("rpd_end"),
tpmEnd: numeric("tpm_end"),
rpmCounter: integer("rpm_counter"),
rpdCounter: integer("rpd_counter"),
tpmCounter: integer("tpm_counter"),
intervalDelay: integer("interval_delay"),
breakDelay: integer("breakDelay"),
});
38 changes: 19 additions & 19 deletions drizzle/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ export type T_qInsertTable = T_tGemini | T_tGeminiUsage;
export type T_qInsertValues = T_tGeminiSchema | T_tGeminiUsageSchema;

export interface I_Gemini {
geminiId: number;
apiKey: string | null;
model: string;
prompt: string;
geminiId: number;
apiKey: string | null;
model: string;
prompt: string;
}

export interface I_GeminiUsage {
geminiUsageId: number;
rpmLimit: number;
rpdLimit: number;
tpmLimit: number;
rpmStart: string | null;
rpdStart: string | null;
tpmStart: string | null;
rpmEnd: string | null;
rpdEnd: string | null;
tpmEnd: string | null;
rpmCounter: number | null;
rpdCounter: number | null;
tpmCounter: number | null;
intervalDelay: number | null;
breakDelay: number | null;
geminiUsageId: number;
rpmLimit: number;
rpdLimit: number;
tpmLimit: number;
rpmStart: string | null;
rpdStart: string | null;
tpmStart: string | null;
rpmEnd: string | null;
rpdEnd: string | null;
tpmEnd: string | null;
rpmCounter: number | null;
rpdCounter: number | null;
tpmCounter: number | null;
intervalDelay: number | null;
breakDelay: number | null;
}
2 changes: 1 addition & 1 deletion gruntfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = (grunt) => {
src: includeAllFiles,
dest: "bin",
},
drizzle: {
drizzle: {
options: {
archive: `${backupsDestination}drizzle.tar.gz`,
},
Expand Down
232 changes: 115 additions & 117 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,119 +1,117 @@
{
"name": "lucy",
"version": "1.0.0",
"description": "Personal hacking assistant 💀",
"author": "Raja Rakotonirina <[email protected]>",
"license": "MIT",
"type": "module",
"module": "index.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {
"lucy": "./dist/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/RajaRakoto/lucy.git"
},
"homepage": "https://github.com/RajaRakoto/lucy#readme",
"bugs": "https://github.com/RajaRakoto/lucy/issues",
"files": [
"dist"
],
"keywords": [
"bun",
"bunjs",
"cli",
"typescript",
"tool",
"hacking",
"assistant"
],
"engines": {
"bun": ">= 1.1.34"
},
"scripts": {
"start": "bun dist/index.js",
"start:smol": "bun --smol dist/index.js",
"start:bin": "./dist/lucy",
"clean": "rimraf build dist coverage",
"dev": "bun run src/index.ts",
"dev:watch": "bun --watch run src/index.ts",
"dev:hot": "bun --hot run src/index.ts",
"dev:smol:watch": "bun --smol --watch run src/index.ts",
"dev:smol:hot": "bun --smol --hot run src/index.ts",
"build": "bun run clean && bun run build.js && grunt copy",
"build:watch": "bun build src/index.ts --outdir dist --watch",
"build:bin": "bun build --compile --minify --sourcemap src/index.ts --outfile dist/lucy",
"test": "bun test",
"test:watch": "bun test --watch",
"biome:start": "biome start",
"biome:stop": "biome stop",
"biome:fix": "biome check --fix .",
"biome:unsafe": "biome check --fix --unsafe .",
"backup": "grunt backup",
"pkg-check": "depcheck",
"pkg-upgrade": "ncu --interactive --format group --packageManager bun",
"versioning": "ungit",
"npm-version:major": "npm version major",
"npm-version:minor": "npm version minor",
"npm-version:patch": "npm version patch",
"npm-login": "npm login",
"npm-publish": "npm publish --access public",
"npm-unpublish": "npm unpublish --force lucy",
"npm-reset:registry": "npm config delete registry",
"npm-check:registry": "npm config get registry",
"npm-proxy-set:registry": "npm set registry http://localhost:4873/",
"npm-proxy:start": "bun run npm-proxy-set:registry && verdaccio",
"npm-proxy:publish": "npm publish --registry http://localhost:4873/",
"npm-proxy:unpublish": "npm unpublish --force --registry http://localhost:4873/ lucy",
"npm-proxy:republish": "bun run npm-proxy:unpublish && bun run npm-proxy:publish",
"nvm": "nvm use",
"db:pull": "drizzle-kit introspect",
"db:push": "drizzle-kit push",
"db:migrate": "drizzle-kit migrate",
"db:generate": "drizzle-kit generate",
"db:drop": "drizzle-kit drop",
"db:up": "drizzle-kit up",
"db:check": "drizzle-kit check",
"db:studio": "drizzle-kit studio"
},
"dependencies": {
"@google/generative-ai": "^0.21.0",
"better-sqlite3": "^11.5.0",
"commander": "^12.1.0",
"drizzle-orm": "^0.36.3",
"execa": "^9.5.1",
"figlet": "^1.8.0",
"inquirer": "^9.2.15",
"node-emoji": "^2.1.3",
"ora": "^8.1.1"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/better-sqlite3": "^7.6.12",
"@types/bun": "latest",
"@types/commander": "^2.12.5",
"@types/execa": "^2.0.2",
"@types/figlet": "^1.7.0",
"@types/inquirer": "^9.0.7",
"@types/jest": "^29.5.14",
"@types/node-emoji": "^2.1.0",
"@types/ora": "^3.2.0",
"bun-plugin-dts": "^0.3.0",
"depcheck": "^1.4.7",
"drizzle-kit": "^0.28.1",
"grunt": "^1.6.1",
"grunt-contrib-compress": "^2.0.0",
"grunt-shell": "^4.0.0",
"jest": "^29.7.0",
"load-grunt-tasks": "^5.1.0",
"npm-check-updates": "^17.1.11",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"ungit": "^1.5.28"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
"name": "lucy",
"version": "1.0.0",
"description": "Personal hacking assistant 💀",
"author": "Raja Rakotonirina <[email protected]>",
"license": "MIT",
"type": "module",
"module": "index.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"bin": {
"lucy": "./dist/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/RajaRakoto/lucy.git"
},
"homepage": "https://github.com/RajaRakoto/lucy#readme",
"bugs": "https://github.com/RajaRakoto/lucy/issues",
"files": ["dist"],
"keywords": [
"bun",
"bunjs",
"cli",
"typescript",
"tool",
"hacking",
"assistant"
],
"engines": {
"bun": ">= 1.1.34"
},
"scripts": {
"start": "bun dist/index.js",
"start:smol": "bun --smol dist/index.js",
"start:bin": "./dist/lucy",
"clean": "rimraf build dist coverage",
"dev": "bun run src/index.ts",
"dev:watch": "bun --watch run src/index.ts",
"dev:hot": "bun --hot run src/index.ts",
"dev:smol:watch": "bun --smol --watch run src/index.ts",
"dev:smol:hot": "bun --smol --hot run src/index.ts",
"build": "bun run clean && bun run build.js && grunt copy",
"build:watch": "bun build src/index.ts --outdir dist --watch",
"build:bin": "bun build --compile --minify --sourcemap src/index.ts --outfile dist/lucy",
"test": "bun test",
"test:watch": "bun test --watch",
"biome:start": "biome start",
"biome:stop": "biome stop",
"biome:fix": "biome check --fix .",
"biome:unsafe": "biome check --fix --unsafe .",
"backup": "grunt backup",
"pkg-check": "depcheck",
"pkg-upgrade": "ncu --interactive --format group --packageManager bun",
"versioning": "ungit",
"npm-version:major": "npm version major",
"npm-version:minor": "npm version minor",
"npm-version:patch": "npm version patch",
"npm-login": "npm login",
"npm-publish": "npm publish --access public",
"npm-unpublish": "npm unpublish --force lucy",
"npm-reset:registry": "npm config delete registry",
"npm-check:registry": "npm config get registry",
"npm-proxy-set:registry": "npm set registry http://localhost:4873/",
"npm-proxy:start": "bun run npm-proxy-set:registry && verdaccio",
"npm-proxy:publish": "npm publish --registry http://localhost:4873/",
"npm-proxy:unpublish": "npm unpublish --force --registry http://localhost:4873/ lucy",
"npm-proxy:republish": "bun run npm-proxy:unpublish && bun run npm-proxy:publish",
"nvm": "nvm use",
"db:pull": "drizzle-kit introspect",
"db:push": "drizzle-kit push",
"db:migrate": "drizzle-kit migrate",
"db:generate": "drizzle-kit generate",
"db:drop": "drizzle-kit drop",
"db:up": "drizzle-kit up",
"db:check": "drizzle-kit check",
"db:studio": "drizzle-kit studio"
},
"dependencies": {
"@google/generative-ai": "^0.21.0",
"better-sqlite3": "^11.5.0",
"commander": "^12.1.0",
"drizzle-orm": "^0.36.3",
"execa": "^9.5.1",
"figlet": "^1.8.0",
"inquirer": "^9.2.15",
"node-emoji": "^2.1.3",
"ora": "^8.1.1"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/better-sqlite3": "^7.6.12",
"@types/bun": "latest",
"@types/commander": "^2.12.5",
"@types/execa": "^2.0.2",
"@types/figlet": "^1.7.0",
"@types/inquirer": "^9.0.7",
"@types/jest": "^29.5.14",
"@types/node-emoji": "^2.1.0",
"@types/ora": "^3.2.0",
"bun-plugin-dts": "^0.3.0",
"depcheck": "^1.4.7",
"drizzle-kit": "^0.28.1",
"grunt": "^1.6.1",
"grunt-contrib-compress": "^2.0.0",
"grunt-shell": "^4.0.0",
"jest": "^29.7.0",
"load-grunt-tasks": "^5.1.0",
"npm-check-updates": "^17.1.11",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"ungit": "^1.5.28"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}
Loading

0 comments on commit ad2c43c

Please sign in to comment.