Skip to content

Commit

Permalink
convert donald to a monorepo (#31)
Browse files Browse the repository at this point in the history
* convert donald to a monorepo

* convert donald to a monorepo #27

* rename to hercules, revert import style, test hercules with imports to stark

* check prettier precommit hook

* check again

* cnfigure bun

* check husky functionality

* remove husky script

* add eslint

* Update pre-commit

---------

Co-authored-by: Leo Ngari <[email protected]>
  • Loading branch information
titus-mumo and ngareleo authored Jun 26, 2024
1 parent e581caa commit bcbdbe4
Show file tree
Hide file tree
Showing 73 changed files with 611 additions and 93 deletions.
194 changes: 161 additions & 33 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,175 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore

# dependencies
/node_modules
/.pnp
.pnp.js
# Logs

# testing
/coverage
logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# next.js
/.next/
/out/
# Caches

# production
/build
.cache

# misc
.DS_Store
*.pem
# Diagnostic reports (https://nodejs.org/api/report.html)

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# local env files
.env*
.env.local
# Runtime data

pids
_.pid
_.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

# Coverage directory used by tools like istanbul

coverage
*.lcov

# nyc test coverage

.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

.grunt

# Bower dependency directory (https://bower.io/)

bower_components

# node-waf configuration

.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)

build/Release

# Dependency directories

node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)

web_modules/

# TypeScript cache

*.tsbuildinfo

# Optional npm cache directory

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

.stylelintcache

# Microbundle cache

.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history

.node_repl_history

# Output of 'npm pack'

*.tgz

# Yarn Integrity file

.yarn-integrity

# dotenv environment variable files

.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)

.parcel-cache

# Next.js build output

.next
out

# Nuxt.js build / generate output

.nuxt
dist

# Gatsby files

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vercel
.vercel
# vuepress build output

**/*.trace
**/*.zip
**/*.tar.gz
**/*.tgz
**/*.log
package-lock.json
**/*.bun
.vuepress/dist

neon-cache.json
# vuepress v2.x temp and cache directory

docker-compose.yaml
.temp

# Docusaurus cache and generated files

.docusaurus

# Serverless directories

.serverless/

# FuseBox cache

.fusebox/

# DynamoDB Local files

.dynamodb/

# TernJS port file

.tern-port

# Stores VSCode versions used for testing VSCode extensions

.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

bunx lint-staged
9 changes: 5 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.devcontainer
,github
.github
.vscode
nodemodules
supabase
temp
supabase/
temp/
.dockerfile
.env
.gitignore
Expand All @@ -13,6 +13,7 @@ bunfig.toml
Dockerfile
entrypoint.sh
package--lock.json
donald-backenackage.json
package--lock.json
package.json
README.md
tsconfig,json
Binary file modified bun.lockb
Binary file not shown.
35 changes: 35 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import tsParser from "@typescript-eslint/parser";

export default [
{ languageOptions: { globals: globals.node } },

pluginJs.configs.recommended,

...tseslint.configs.recommended,

{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
},
},
rules: {
// "no-console": "warn",
quotes: [
"warn",
"double",
{ avoidEscape: true, allowTemplateLiterals: true },
],
semi: ["error", "always"],
"no-unused-vars": [
"warn",
{ vars: "all", args: "after-used", ignoreRestSiblings: true },
],
},
},
];
65 changes: 17 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,30 @@
{
"name": "donald",
"version": "1.0.50",
"module": "index.ts",
"type": "module",
"workspaces": [
"packages/*"
],
"scripts": {
"build": "bun build --entrypoints ./src/index.ts --outdir build --target bun --splitting --minify",
"db:dev": "bunx supabase start",
"db:generate": "drizzle-kit generate:pg --config drizzle.config.ts",
"db:login": "bunx supabase login --no-browser",
"db:migrate": "bunx supabase migration up --debug && echo \"Incase, you have new seed data. Run reset\" ",
"db:pull": "bunx supabase db pull",
"db:push": "bunx supabase db push",
"db:reset": "bunx supabase db reset",
"db:status": "bunx supabase status",
"debug": "bun run --inspect=localhost:4000 src/index.ts",
"dev": "ENV=dev bun run --watch src/index.ts",
"generate:ssh": "rm -rf ./temp && mkdir ./temp && openssl genpkey -algorithm RSA -out ./temp/private_key.pem -pkeyopt rsa_keygen_bits:4096 && openssl rsa -pubout -in ./temp/private_key.pem -out ./temp/public_key.pem",
"generate:env": "echo $(bunx supabase status -o env) >> .env",
"migrate": "bun run src/bin/migrate.ts",
"neon:auth": "bunx neonctl auth",
"neon:branches-list": "bunx neonctl branches list",
"neon:setup": "bun run neon:auth && bun run neon:projects-list > neon-cache.json",
"neon:projects-list": "bunx neonctl projects list --output json",
"start": "bun run src/index.ts --env-file=.env.prod",
"test": "[ ! -f neon-cache.json ] && bun run neon:setup || echo '✅ Cache found' && bun test --env-file=.env.test"
},
"dependencies": {
"@elysiajs/bearer": "^1.0.2",
"@elysiajs/eden": "^1.0.13",
"bun": "^1.1.12",
"drizzle-orm": "^0.31.2",
"elysia": "latest",
"elysia-rate-limit": "^2.0.1",
"jose": "^5.2.0",
"module-alias": "^2.2.3",
"postgres": "^3.4.3"
"clean": "rm -rf node_modules"
},
"devDependencies": {
"@eslint/js": "9.4.0",
"@neondatabase/serverless": "^0.9.3",
"@sinclair/typebox": "^0.32.28",
"bun-types": "latest",
"drizzle-kit": "^0.22.7",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.4.0",
"@eslint/js": "^9.5.0",
"@types/bun": "latest",
"eslint": "9.x",
"globals": "^15.6.0",
"hercules": "workspace:*",
"husky": "^9.0.11",
"lint-staged": "^15.2.6",
"neonctl": "^1.30.0",
"prettier": "3.3.2",
"supabase": "^1.127.4",
"typescript-eslint": "^7.13.0"
"stark": "workspace:*",
"typescript-eslint": "^7.13.1"
},
"module": "src/index.js",
"_moduleAliases": {
"~": "src"
"peerDependencies": {
"typescript": "^5.0.0"
},
"lint-staged": {
"**/*.{js,ts,tsx,json,css,md}": [
"prettier src --write --ignore-unknown"
"prettier packages/hercules/src --write --ignore-unknown"
]
}
}
}
File renamed without changes.
47 changes: 47 additions & 0 deletions packages/hercules/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

**/*.trace
**/*.zip
**/*.tar.gz
**/*.tgz
**/*.log
package-lock.json
**/*.bun

neon-cache.json

docker-compose.yaml
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit bcbdbe4

Please sign in to comment.