Skip to content

Commit

Permalink
chore: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaku-BB committed Sep 4, 2023
0 parents commit 1266965
Show file tree
Hide file tree
Showing 31 changed files with 3,030 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules
dist

.idea

.env
.env.example

.git
.gitignore

.github
.husky

.eslintrc.cjs
.eslintignore
prettier.config.js

.dockerignore
Dockerfile
compose.yaml
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DISCORD_BOT_TOKEN=
DISCORD_CLIENT_ID=
TEST_GUILD_ID=
DATABASE_URL=

# Use only for Docker deployment.
POSTGRES_USER=
POSTGRES_PASSWORD=
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
};
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2

updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist

.idea

.env
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm prettier --write .
pnpm eslint --fix .
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM node:20.5.0-bookworm-slim as builder

WORKDIR /usr/src/app

COPY . .

# It's necessary for '@prisma/client' to work properly.
RUN apt-get update --yes && apt-get install --yes openssl

RUN npm install --global pnpm

RUN pnpm install --frozen-lockfile
RUN pnpm run build
RUN pnpm prune --config.production --config.ignore-scripts=true

RUN rm -R ./src ./tsconfig.json

FROM node:20.5.0-bookworm-slim

WORKDIR /usr/src/app

# It's necessary for '@prisma/client' to work properly.
RUN apt-get update --yes && apt-get install --yes openssl

RUN npm install --global pnpm

COPY --from=builder /usr/src/app .

ENTRYPOINT ["pnpm", "run", "start:migrate"]
27 changes: 27 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: template

services:
database:
image: postgres:15.4-alpine
container_name: database
restart: unless-stopped
volumes:
- postgresql-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}

bot:
build: .
container_name: bot
restart: unless-stopped
depends_on:
- database
environment:
DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN}
DISCORD_CLIENT_ID: ${DISCORD_CLIENT_ID}
TEST_GUILD_ID: ${TEST_GUILD_ID}
DATABASE_URL: ${DATABASE_URL}

volumes:
postgresql-data:
47 changes: 47 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "d.js-template",
"description": "A simple and easy to use template for Discord bots using the discord.js library.",
"version": "0.1.0",
"main": "dist/index.js",
"scripts": {
"start": "node dist/index.js",
"start:migrate": "pnpm dlx prisma migrate deploy && pnpm run start",
"watch": "concurrently \"tsc --watch\" \"node --require dotenv/config --watch dist/index.js | pnpm run prettify-logs\"",
"build": "tsc",
"prettify-logs": "pino-pretty --translateTime \"SYS:dd-mm-yyyy|HH:MM:ss\" --customLevels debug:10,information:20,error:30 --customColors debug:gray,information:blue,error:red",
"register-application-commands": "node --require dotenv/config dist/register-application-commands.js",
"prepare": "husky install"
},
"author": "Jakub Bukała",
"license": "MIT",
"dependencies": {
"@prisma/client": "5.2.0",
"croner": "^7.0.1",
"discord-api-types": "^0.37.56",
"discord.js": "^14.12.1",
"inquirer": "^9.2.10",
"pino": "^8.15.0",
"zod": "^3.22.1"
},
"devDependencies": {
"@types/inquirer": "^9.0.3",
"@types/node": "20.5.9",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"concurrently": "^8.2.1",
"dotenv": "^16.3.1",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"husky": "^8.0.3",
"pino-pretty": "^10.2.0",
"prettier": "^3.0.3",
"prisma": "^5.2.0",
"typescript": "^5.2.2"
},
"type": "module",
"packageManager": "[email protected]",
"engines": {
"node": ">=20.5.0"
}
}
Loading

0 comments on commit 1266965

Please sign in to comment.