Skip to content

Commit

Permalink
Merge pull request #43 from prsm/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschultheiss authored Jul 15, 2022
2 parents 86d35f6 + 5261d72 commit f669826
Show file tree
Hide file tree
Showing 11 changed files with 619 additions and 530 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main", develop ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '18 2 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
24 changes: 24 additions & 0 deletions .github/workflows/renovate-config-validator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: renovate-config-validator

on:
pull_request:
branches:
- main
paths:
- .github/workflows/renovate-config-validator.yaml
- renovate.json
push:
branches:
- main
paths:
- .github/workflows/renovate-config-validator.yaml
- renovate.json

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: rinchsan/[email protected]
with:
pattern: 'renovate.json'
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.15.1
18.5.0
11 changes: 11 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"git": {
"commitMessage": "chore: release v${version}"
},
"github": {
"release": true
},
"npm": {
"publish": false
}
}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG APP_ENV=development

# ----- BASE ------
FROM node:16 as stage-base
FROM node:18 as stage-base

RUN apt-get update
RUN apt-get install -y procps && rm -rf /var/lib/apt/lists/*
Expand All @@ -26,7 +26,7 @@ FROM stage-base AS stage-production
COPY --from=stage-build /usr/src/app/dist ./dist
COPY --from=stage-build /usr/src/app/yarn.lock ./yarn.lock

RUN npm install --location=global prisma@^3.15.0
RUN npm install --location=global prisma@4.0.0

COPY package.json ./
COPY prisma ./prisma/
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
bot-database:
container_name: bot-database
restart: unless-stopped
image: postgres:14.1
image: postgres:14.4
env_file:
- ./.env
ports:
Expand Down
84 changes: 42 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"license": "MIT",
"name": "crystal-nest",
"description": "A Nest rewrite of crystal, the SOS Discord bot",
"version": "0.4.0",
"version": "0.4.4",
"author": "Jonas Schultheiss <[email protected]> (https://jonasschultheiss.dev)",
"keywords": [
"discord",
Expand All @@ -17,8 +17,8 @@
},
"private": false,
"engines": {
"node": ">=16.15.1 <17.0.0",
"yarn": "^1.22.15"
"node": ">=18.0.0 <19.0.0",
"yarn": "^1.22.19"
},
"repository": {
"type": "git",
Expand All @@ -43,50 +43,50 @@
"prisma:generate": "prisma generate",
"prisma:migrate": "prisma migrate dev --name",
"prepare": "husky install",
"postversion": "git push --tags && git push && echo \"Successfully released version $npm_package_version!\""
"release": "release-it"
},
"dependencies": {
"@discord-nestjs/common": "^3.3.2",
"@discord-nestjs/core": "^3.3.2",
"@nestjs/common": "^8.4.6",
"@nestjs/config": "^2.1.0",
"@nestjs/core": "^8.4.6",
"@nestjs/platform-express": "^8.4.6",
"@prisma/client": "^3.15.0",
"bufferutil": "^4.0.6",
"discord.js": "^13.8.0",
"@discord-nestjs/common": "3.4.0",
"@discord-nestjs/core": "3.5.0",
"@nestjs/common": "9.0.1",
"@nestjs/config": "2.2.0",
"@nestjs/core": "9.0.1",
"@nestjs/platform-express": "9.0.1",
"@prisma/client": "4.0.0",
"bufferutil": "4.0.6",
"discord.js": "13.8.1",
"erlpack": "discord/erlpack",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.5",
"utf-8-validate": "^5.0.9",
"zlib-sync": "^0.1.7"
"reflect-metadata": "0.1.13",
"rimraf": "3.0.2",
"rxjs": "7.5.5",
"utf-8-validate": "5.0.9",
"zlib-sync": "0.1.7"
},
"devDependencies": {
"@nestjs/cli": "^8.2.6",
"@nestjs/schematics": "^8.0.11",
"@nestjs/testing": "^8.4.6",
"@types/express": "^4.17.13",
"@types/jest": "28.1.1",
"@types/node": "^17.0.41",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^8.0.0",
"jest": "^28.1.1",
"lint-staged": "^13.0.1",
"prettier": "^2.6.2",
"prisma": "^3.15.0",
"source-map-support": "^0.5.21",
"supertest": "^6.2.3",
"ts-jest": "^28.0.4",
"ts-loader": "^9.3.0",
"ts-node": "^10.8.1",
"tsconfig-paths": "^4.0.0",
"typescript": "^4.7.3"
"@nestjs/cli": "9.0.0",
"@nestjs/schematics": "9.0.1",
"@nestjs/testing": "9.0.1",
"@types/express": "4.17.13",
"@types/jest": "28.1.4",
"@types/node": "17.0.41",
"@types/supertest": "2.0.12",
"@typescript-eslint/eslint-plugin": "5.30.5",
"@typescript-eslint/parser": "5.30.5",
"eslint": "8.19.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-prettier": "4.2.1",
"husky": "8.0.1",
"jest": "28.1.2",
"lint-staged": "13.0.3",
"prettier": "2.7.1",
"prisma": "4.0.0",
"source-map-support": "0.5.21",
"supertest": "6.2.4",
"ts-jest": "28.0.5",
"ts-loader": "9.3.1",
"ts-node": "10.8.2",
"tsconfig-paths": "4.0.0",
"typescript": "4.7.4"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
Expand Down
84 changes: 84 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", ":rebaseStalePrs"],
"assignees": ["jonas.schultheiss"],
"reviewers": ["jonas.schultheiss"],
"baseBranches": ["development"],
"labels": ["dependencies"],
"bumpVersion": "prerelease",
"dependencyDashboard": true,
"dependencyDashboardAutoclose": true,
"dependencyDashboardLabels": ["dashboard", "wontfix"],
"docker": {
"versioning": "docker"
},
"nvm": {
"fileMatch": ["(^|/)\\.nvmrc$"],
"versioning": "node",
"pinDigests": false
},
"schedule": ["after 10pm and before 5:00am"],
"timezone": "Europe/Zurich",
"lockFileMaintenance": {
"enabled": false,
"recreateClosed": true,
"rebaseStalePrs": true,
"branchTopic": "lock-file-maintenance",
"commitMessageAction": "Lock file maintenance",
"schedule": ["after 10pm and before 5:00am"],
"prBodyDefinitions": {
"Change": "All locks refreshed"
}
},
"vulnerabilityAlerts": {
"schedule": ["after 10pm and before 5:00am"],
"dependencyDashboardApproval": false,
"stabilityDays": 0,
"rangeStrategy": "update-lockfile",
"commitMessageSuffix": "[SECURITY]",
"branchTopic": "{{{datasource}}}-{{{depName}}}-vulnerability",
"prCreation": "immediate"
},
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"matchDepTypes": ["devDependencies"],
"automerge": true
},
{
"matchPackagePatterns": ["eslint"],
"labels": ["linting"]
},
{
"matchPackagePatterns": ["prettier"],
"labels": ["formatting"]
},
{
"matchPackagePatterns": ["@nestjs"],
"labels": ["framework"]
},
{
"matchPackagePatterns": ["prisma"],
"labels": ["orm"]
},
{
"matchPackagePatterns": ["discord"],
"labels": ["discord"]
},
{
"matchDatasources": ["docker"],
"labels": ["docker-update"]
},
{
"matchDepTypes": ["optionalDependencies"],
"addLabels": ["optional"]
},
{
"matchDepTypes": ["devDependencies"],
"addLabels": ["development"]
}
]
}
2 changes: 1 addition & 1 deletion src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { PrismaModule } from './prisma/prisma.module';
status: 'online',
activities: [
{
name: 'with ya mum',
name: 'Pac-Man',
type: ActivityTypes.PLAYING
}
]
Expand Down
4 changes: 4 additions & 0 deletions src/bot/channels/channels.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export class ChannelsGateway {
return;
}

if (channel.parentId !== this.voiceCategoryId) {
return;
}

if (channel.position === 0 && channel.members.size === 0) {
await this.resetChannel(channel);
this.logger.log(`Reseted channel ${channel.name}`);
Expand Down
Loading

0 comments on commit f669826

Please sign in to comment.