This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
generated from promise/discord-bot-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
53 changed files
with
7,313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build | ||
/database | ||
/logs | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": [ | ||
"github>promise/renovate-config", | ||
"github>promise/renovate-config:force-node-version(18)", | ||
"github>promise/renovate-config:force-mongo-version(4)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Docker Compose | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Test Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | ||
|
||
- name: Touch .env file | ||
run: touch ".env" | ||
|
||
- name: Test docker compose build | ||
run: docker compose build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Docker Image | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ghcr: | ||
name: ${{ github.ref == 'refs/heads/main' && 'Build and Push' || 'Test Build' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | ||
|
||
- name: Login to ghcr.io | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: ${{ github.ref == 'refs/heads/main' && 'Build and Push' || 'Test Build' }} | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5 | ||
with: | ||
push: ${{ github.ref == 'refs/heads/main' }} | ||
tags: ghcr.io/project-blurple/april-fools-2024:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Linting | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
eslint: | ||
name: ESLint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | ||
|
||
- name: Set up pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Run ESLint | ||
run: pnpm lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
jest: | ||
name: Jest | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | ||
|
||
- name: Set up pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | ||
with: | ||
node-version-file: ".nvmrc" | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Run Jest | ||
run: pnpm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/build | ||
/database | ||
/logs | ||
/node_modules | ||
/.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
auto-install-peers=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"recommendations": [ | ||
"aaron-bond.better-comments", | ||
"mikestead.dotenv", | ||
"dbaeumer.vscode-eslint", | ||
"christian-kohler.npm-intellisense", | ||
"meganrogge.template-string-converter", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"editor.defaultFormatter": "dbaeumer.vscode-eslint", | ||
"editor.formatOnPaste": true, | ||
"editor.formatOnSave": true, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"eslint.format.enable": true, | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
FROM node:20-alpine@sha256:ef3f47741e161900ddd07addcaca7e76534a9205e4cd73b2ed091ba339004a75 AS base | ||
RUN apk --no-cache add g++ gcc make python3 | ||
|
||
WORKDIR /app | ||
ENV IS_DOCKER=true | ||
|
||
|
||
# install prod dependencies | ||
|
||
FROM base AS deps | ||
RUN npm install -g pnpm@8 | ||
|
||
COPY package.json ./ | ||
COPY pnpm-lock.yaml ./ | ||
|
||
RUN pnpm install --frozen-lockfile --prod | ||
|
||
|
||
# install all dependencies and build typescript | ||
|
||
FROM deps AS ts-builder | ||
RUN pnpm install --frozen-lockfile | ||
|
||
COPY tsconfig.json ./ | ||
COPY ./src ./src | ||
RUN pnpm run build | ||
|
||
|
||
# production image | ||
|
||
FROM base | ||
|
||
COPY .env* ./ | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY --from=ts-builder /app/build ./build | ||
COPY package.json ./ | ||
|
||
ENV NODE_ENV=production | ||
ENTRYPOINT [ "npm", "run" ] | ||
CMD [ "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '3' | ||
|
||
services: | ||
bot: | ||
build: . | ||
restart: always | ||
environment: | ||
- DATABASE_URI=mongodb://db | ||
ports: | ||
- ${PORT}:${PORT} | ||
volumes: | ||
- ./logs:/app/logs | ||
depends_on: | ||
- db | ||
db: | ||
image: mongo:4@sha256:ce3d0eade688a2299e9e20454efc561a6fc8de1cbde5abb0f50feadfe758037b | ||
restart: always | ||
volumes: | ||
- ./database:/data/db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CLIENT_ID= | ||
CLIENT_SECRET= | ||
CLIENT_TOKEN= | ||
|
||
OWNER_ID= | ||
GUILD_ID= | ||
|
||
THEME_COLOR=5865F2 | ||
|
||
PORT= | ||
URL= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "april-fools-2024", | ||
"main": "build", | ||
"scripts": { | ||
"build": "tsc", | ||
"build:watch": "tsc -w", | ||
"docker": "npm run docker:build && npm run docker:up", | ||
"docker:build": "docker-compose --project-directory . build", | ||
"docker:down": "docker-compose --project-directory . down", | ||
"docker:logs": "docker-compose --project-directory . logs --tail=500 -f", | ||
"docker:start": "npm run docker:up", | ||
"docker:stop": "npm run docker:down", | ||
"docker:up": "docker-compose --project-directory . up -d", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"start": "node .", | ||
"test": "jest" | ||
}, | ||
"dependencies": { | ||
"@sapphire/type": "2.4.4", | ||
"@typegoose/typegoose": "12.2.0", | ||
"bufferutil": "4.0.8", | ||
"dedent": "1.5.1", | ||
"discord-oauth2": "2.12.1", | ||
"discord.js": "14.14.1", | ||
"dotenv": "16.4.5", | ||
"erlpack": "github:discord/erlpack", | ||
"express": "4.19.2", | ||
"mongoose": "8.2.4", | ||
"sentiment": "5.0.2", | ||
"superagent": "8.1.2", | ||
"utf-8-validate": "6.0.3", | ||
"winston": "3.13.0", | ||
"winston-daily-rotate-file": "5.0.0", | ||
"zlib-sync": "0.1.9" | ||
}, | ||
"devDependencies": { | ||
"@tsconfig/node20": "20.1.4", | ||
"@tsconfig/strictest": "2.0.5", | ||
"@types/express": "4.17.21", | ||
"@types/jest": "29.5.12", | ||
"@types/node": "20.12.2", | ||
"@types/sentiment": "5.0.4", | ||
"@types/superagent": "8.1.6", | ||
"eslint": "8.57.0", | ||
"eslint-config-promise": "github:promise/eslint-config", | ||
"jest": "29.7.0", | ||
"ts-jest": "29.1.2", | ||
"typescript": "5.4.3" | ||
}, | ||
"eslintConfig": { | ||
"extends": "promise" | ||
}, | ||
"jest": { | ||
"preset": "ts-jest", | ||
"testEnvironment": "node", | ||
"testPathIgnorePatterns": [ | ||
"<rootDir>/build/", | ||
"<rootDir>/node_modules/" | ||
] | ||
} | ||
} |
Oops, something went wrong.