Skip to content

Commit

Permalink
major: refactor project
Browse files Browse the repository at this point in the history
* Add Docker file
* Add launch.json
* Remove old JS files
* Update dependencies while we're here
  • Loading branch information
totallytavi committed May 15, 2024
1 parent 407a282 commit ff3f258
Show file tree
Hide file tree
Showing 48 changed files with 2,554 additions and 3,155 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.vscode
/node_modules
**/*.js
75 changes: 48 additions & 27 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,50 @@
{
"env": {
"commonjs": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
"env": {
"commonjs": true,
"es2021": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"array-callback-return": "error",
"no-await-in-loop": "error",
"no-duplicate-imports": "error",
"no-self-compare": "error",
"no-unmodified-loop-condition": "error",
"no-unreachable-loop": "error",
"no-use-before-define": "error",
"require-atomic-updates": "error",
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"complexity": [
"error",
100
],
"prefer-destructuring": [
"error",
{
"AssignmentExpression": {
"array": false
}
}
],
"eqeqeq": "error"
}
}
8 changes: 4 additions & 4 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
runs-on: linux

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "16.x"
node-version: "20.x"

- name: Install dependencies
run: npm install

- name: Run ESLint
run: npx eslint ./
8 changes: 2 additions & 6 deletions .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ jobs:
audit:
runs-on: linux

strategy:
matrix:
node-version: [15.x, 16.x, 17.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: '20.x'
cache: 'npm'
- run: npm ci
# Run an audit check, and fail if any dependencies aren't met.
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Docker CI

on:
push:
branches: [ master ]

jobs:
deploy:
runs-on: mainserver-pez
env:
configfile: ${{ secrets.CONFIGFILE }}
responsesfile: ${{ secrets.RESPONSESFILE }}

steps:
- uses: actions/checkout@v4

- name: Update containers
run: docker compose pull

- name: Build application
run: docker compose build

- name: Spin up containers
run: docker compose up -d
16 changes: 10 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# VSCode
/.vscode
jsonconfig.json

# Project Files
/src/configs/*.json
!/src/configs/dist.*.json
latest-error.log

# NPM
/node_modules
/configs/*.json
latest-error.log
package-lock.json

# TSC
/dist
/src/**/*.js
33 changes: 33 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"version": "0.2.0",
"configurations": [
// Recommended setup for running the bot in the debugger
{
"type": "node",
"request": "launch",
"name": "Build & Start Bot",
"skipFiles": [
"<node_internals>/**"
],
"env": {
"environment": "development"
},
"preLaunchTask": "npm: build",
"program": "index.js",
"cwd": "${workspaceFolder}/dist"
},
{
"type": "node",
"request": "launch",
"name": "Start Bot",
"skipFiles": [
"<node_internals>/**"
],
"env": {
"environment": "development"
},
"program": "index.js",
"cwd": "${workspaceFolder}/dist"
},
]
}
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:19.7.0
WORKDIR /usr/src/voraphiliac
COPY package*.json ./
COPY tsconfig.json ./
COPY src ./src
RUN npm install
RUN npm run build
FROM node:19.7.0
WORKDIR /usr/src/voraphiliac
COPY package*.json ./
RUN npm install --only=production
COPY --from=0 /usr/src/voraphiliac/dist .
CMD [ "npm", "start" ]
60 changes: 0 additions & 60 deletions classes/FlagBits.js

This file was deleted.

20 changes: 0 additions & 20 deletions classes/Flags.js

This file was deleted.

35 changes: 0 additions & 35 deletions commands/digest.js

This file was deleted.

34 changes: 0 additions & 34 deletions configs/modals.js

This file was deleted.

9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.3'
services:
app:
build:
context: ./
restart: on-failure
volumes:
- ${configfile}:/usr/src/voraphiliac/src/configs/config.json
- ${responsesfile}:/usr/src/voraphiliac/src/configs/responses.json
Loading

0 comments on commit ff3f258

Please sign in to comment.