From 0a83719c93264673aef839c8fb60e4a1d120c6cf Mon Sep 17 00:00:00 2001 From: KagChi <59391215+KagChi@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:51:03 +0700 Subject: [PATCH] feat: monorepo setup (#337) --- .github/workflows/docker.yml | 97 ++++- .github/workflows/services-release.yml | 12 + .github/workflows/services.yml | 45 +++ .turbo/cookies/0.cookie | 0 .turbo/cookies/1.cookie | 0 Dockerfile | 55 ++- README.md | 29 -- package.json | 64 +--- pnpm-lock.yaml | 337 +++++++++++------- pnpm-workspace.yaml | 2 + .../kanao-gateway/.example.env | 0 .swcrc => services/kanao-gateway/.swcrc | 22 +- services/kanao-gateway/README.md | 43 +++ .../kanao-gateway/drizzle.config.ts | 0 services/kanao-gateway/package.json | 59 +++ .../Caches/Channels/ChannelCreateListener.ts | 0 .../Caches/Channels/ChannelDeleteListener.ts | 0 .../Caches/Channels/ChannelUpdateListener.ts | 0 .../GuildMembers/GuildMemberAddListener.ts | 0 .../GuildMembers/GuildMemberRemoveListener.ts | 0 .../GuildMembers/GuildMemberUpdateListener.ts | 0 .../GuildMembers/GuildMembersChunkListener.ts | 0 .../GuildRoles/GuildRoleCreateListener.ts | 0 .../GuildRoles/GuildRoleDeleteListener.ts | 0 .../GuildRoles/GuildRoleUpdateListener.ts | 0 .../Caches/Guilds/GuildCreateListener.ts | 0 .../Caches/Guilds/GuildDeleteListener.ts | 0 .../Caches/Guilds/GuildUpdateListener.ts | 0 .../Caches/Messages/MessageCreateListener.ts | 0 .../Messages/MessageDeleteBulkListener.ts | 0 .../Caches/Messages/MessageDeleteListener.ts | 0 .../Caches/Messages/MessageUpdateListener.ts | 0 .../Caches/Users/UserUpdateListener.ts | 0 .../Caches/Voices/VoiceStateUpdateListener.ts | 0 .../src}/Listeners/ClosedListener.ts | 0 .../src}/Listeners/DispatchListener.ts | 0 .../Listeners/HeartBeatCompleteListener.ts | 0 .../src}/Listeners/ReadyListener.ts | 0 .../src}/Listeners/ResumeListener.ts | 0 .../src}/Schema/collections/channel.ts | 0 .../src}/Schema/collections/guild.ts | 0 .../src}/Schema/collections/member.ts | 0 .../src}/Schema/collections/message.ts | 0 .../src}/Schema/collections/roles.ts | 0 .../src}/Schema/collections/session.ts | 0 .../src}/Schema/collections/status.ts | 0 .../src}/Schema/collections/user.ts | 0 .../src}/Schema/collections/voice.ts | 0 .../kanao-gateway/src}/Schema/index.ts | 0 .../kanao-gateway/src}/Stores/Listener.ts | 0 .../src}/Stores/ListenerStore.ts | 0 .../src}/Structures/NezuGateway.ts | 0 .../kanao-gateway/src}/Utilities/Logger.ts | 0 .../WebSockets/ProcessBootstrapper.ts | 0 .../ProcessContextFetchingStrategy.ts | 0 .../WebSockets/ProcessShardingStrategy.ts | 0 .../src}/Utilities/WebSockets/ShardProcess.ts | 0 {src => services/kanao-gateway/src}/config.ts | 0 {src => services/kanao-gateway/src}/index.ts | 0 services/kanao-gateway/tsconfig.json | 8 + tsconfig.eslint.json | 6 + tsconfig.json | 7 +- turbo.json | 15 + 63 files changed, 536 insertions(+), 265 deletions(-) create mode 100644 .github/workflows/services-release.yml create mode 100644 .github/workflows/services.yml create mode 100644 .turbo/cookies/0.cookie create mode 100644 .turbo/cookies/1.cookie create mode 100644 pnpm-workspace.yaml rename .example.env => services/kanao-gateway/.example.env (100%) rename .swcrc => services/kanao-gateway/.swcrc (94%) create mode 100644 services/kanao-gateway/README.md rename drizzle.config.ts => services/kanao-gateway/drizzle.config.ts (100%) create mode 100644 services/kanao-gateway/package.json rename {src => services/kanao-gateway/src}/Listeners/Caches/Channels/ChannelCreateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Channels/ChannelDeleteListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Channels/ChannelUpdateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/GuildMembers/GuildMemberAddListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/GuildMembers/GuildMemberRemoveListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/GuildMembers/GuildMemberUpdateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/GuildMembers/GuildMembersChunkListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/GuildRoles/GuildRoleCreateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/GuildRoles/GuildRoleDeleteListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/GuildRoles/GuildRoleUpdateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Guilds/GuildCreateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Guilds/GuildDeleteListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Guilds/GuildUpdateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Messages/MessageCreateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Messages/MessageDeleteBulkListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Messages/MessageDeleteListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Messages/MessageUpdateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Users/UserUpdateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/Caches/Voices/VoiceStateUpdateListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/ClosedListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/DispatchListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/HeartBeatCompleteListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/ReadyListener.ts (100%) rename {src => services/kanao-gateway/src}/Listeners/ResumeListener.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/channel.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/guild.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/member.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/message.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/roles.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/session.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/status.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/user.ts (100%) rename {src => services/kanao-gateway/src}/Schema/collections/voice.ts (100%) rename {src => services/kanao-gateway/src}/Schema/index.ts (100%) rename {src => services/kanao-gateway/src}/Stores/Listener.ts (100%) rename {src => services/kanao-gateway/src}/Stores/ListenerStore.ts (100%) rename {src => services/kanao-gateway/src}/Structures/NezuGateway.ts (100%) rename {src => services/kanao-gateway/src}/Utilities/Logger.ts (100%) rename {src => services/kanao-gateway/src}/Utilities/WebSockets/ProcessBootstrapper.ts (100%) rename {src => services/kanao-gateway/src}/Utilities/WebSockets/ProcessContextFetchingStrategy.ts (100%) rename {src => services/kanao-gateway/src}/Utilities/WebSockets/ProcessShardingStrategy.ts (100%) rename {src => services/kanao-gateway/src}/Utilities/WebSockets/ShardProcess.ts (100%) rename {src => services/kanao-gateway/src}/config.ts (100%) rename {src => services/kanao-gateway/src}/index.ts (100%) create mode 100644 services/kanao-gateway/tsconfig.json create mode 100644 tsconfig.eslint.json create mode 100644 turbo.json diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d60455a9..a6b6e93f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,18 +1,87 @@ -name: Build & Push to container registry +name: Build & Push Docker Image to container image registry on: - release: - types: [created] - push: - branches: - - "**" - pull_request: - branches: - - "**" - paths: - - "Dockerfile" + workflow_call: + inputs: + ADD_FLAVOR: + description: "Whether to add flavor (only -dev atm) to the image tag" + type: boolean + required: false + default: true + NO_CACHE: + description: "Whether to use build cache" + type: boolean + required: false + default: false + SCOPE: + description: "Scope of the image (e.g. 'bot')" + type: string + required: true + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false jobs: - docker: - uses: nezuchan/workflows/.github/workflows/docker-build.yml@main - secrets: inherit \ No newline at end of file + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + scope: ${{ fromJson(inputs.SCOPE) }} + steps: + - name: Check Out Repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 2 + + #- name: Set up QEMU (We don't need QEMU, because we don't build images for platforms other than linux/amd64, which is our current native arch in our infra + # uses: docker/setup-qemu-action@v1.2.0 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + - name: Login to GitHub Container Registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + if: ${{ github.event_name != 'pull_request' }} + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract tag name + id: tags + if: ${{ github.event_name == 'release' }} + run: echo ::set-output name=name::${GITHUB_REF##*/} + + - name: Extract flavor + id: flavor + if: ${{ inputs.ADD_FLAVOR == true }} + run: if [ "${{ github.event_name }}" = "release" ]; then echo ::set-output name=name::; else echo ::set-output name=name::-dev; fi + + - name: Generate Docker image metadata + uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + id: img_meta + with: + flavor: | + latest=auto + suffix=${{ steps.flavor.outputs.name }} + images: ghcr.io/nezuchan/${{ matrix.scope }} + tags: | + ${{ steps.tags.outputs.name }} + latest + + - name: Build and push + id: docker_build + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + context: ./ + tags: ${{ steps.img_meta.outputs.tags }} + labels: ${{ steps.img_meta.outputs.labels }} + push: ${{ github.event_name != 'pull_request' }} + build-args: | + "SCOPE=@nezuchan/${{ matrix.scope }}" + cache-from: type=gha,mode=max + cache-to: type=gha,mode=max + no-cache: ${{ inputs.NO_CACHE == true }} diff --git a/.github/workflows/services-release.yml b/.github/workflows/services-release.yml new file mode 100644 index 00000000..7edffc77 --- /dev/null +++ b/.github/workflows/services-release.yml @@ -0,0 +1,12 @@ +name: Release services + +on: + release: + types: [created] + +jobs: + docker: + uses: ./.github/workflows/docker.yml + with: + scope: '["kanao-gateway"]' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/services.yml b/.github/workflows/services.yml new file mode 100644 index 00000000..01caff12 --- /dev/null +++ b/.github/workflows/services.yml @@ -0,0 +1,45 @@ +# Copyright 2023 Hazmi35 (https://github.com/Hazmi35) +name: Services Nightly Builds + +on: + push: + branches: + - main + paths: + - "Dockerfile" + - "services/**" + pull_request: + branches: + - main + paths: + - "Dockerfile" + +jobs: + build: + runs-on: ubuntu-latest + outputs: + folders: ${{ steps.json.outputs.folders }} + steps: + - name: Check Out Repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 2 + - name: List changed folders + id: changed + run: | + echo ::set-output name=folders::$(git diff --name-only HEAD~1 HEAD | grep -E 'services/.*' | cut -d'/' -f2 | sort | uniq | tr '\n' ',' | sed 's/,$//') + - name: List all folders if no changes + if: steps.changed.outputs.folders == '' + id: all + run: | + echo ::set-output name=folders::$(ls services | tr '\n' ',' | sed 's/,$//') + - name: Turn output into JSON array + id: json + run: | + echo ::set-output name=folders::[$(echo ${{ steps.changed.outputs.folders || steps.all.outputs.folders }} | sed 's/,/","/g;s/^/"/;s/$/"/')] + docker: + needs: build + uses: ./.github/workflows/docker.yml + with: + scope: ${{ needs.build.outputs.folders }} + secrets: inherit diff --git a/.turbo/cookies/0.cookie b/.turbo/cookies/0.cookie new file mode 100644 index 00000000..e69de29b diff --git a/.turbo/cookies/1.cookie b/.turbo/cookies/1.cookie new file mode 100644 index 00000000..e69de29b diff --git a/Dockerfile b/Dockerfile index e891ea21..47fd1ca6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,52 @@ -FROM ghcr.io/hazmi35/node:20-dev-alpine as build-stage +# Copyright 2023 Hazmi35 (https://github.com/Hazmi35) +FROM ghcr.io/hazmi35/node:20-dev-alpine as dev -LABEL name "NezukoChan Gateway (Docker Build)" -LABEL maintainer "KagChi" +# Prepare with corepack (experimental feature) +RUN corepack enable -RUN corepack enable && corepack prepare pnpm@latest +# Prepare +FROM dev as prepare -COPY package*.json . -COPY pnpm-lock.yaml . - -RUN pnpm install --frozen-lockfile +ARG SCOPE +WORKDIR /prepare +# Scoped install for monorepo +RUN npm install --global turbo COPY . . +RUN turbo prune --scope=${SCOPE} --docker +RUN cp -r tsconfig* /prepare/out/json + +# Build the project +FROM dev AS builder + +WORKDIR /builder + +# Set NPM_CONFIG_USERCONFIG build args +ARG SCOPE + +# First install the dependencies (as they change less often) +COPY --from=prepare /prepare/out/json/ . +COPY --from=prepare /prepare/out/pnpm-lock.yaml ./pnpm-lock.yaml + +# Install dependencies +RUN pnpm install --frozen-lockfile +# Build the project +COPY --from=prepare /prepare/out/full/ . RUN pnpm run build -RUN pnpm prune --production +# Deploy the service +RUN pnpm deploy -P --filter=${SCOPE} /out +# Get ready for production FROM ghcr.io/hazmi35/node:20-alpine -LABEL name "NezukoChan Gateway Production" -LABEL maintainer "KagChi" +LABEL name "${SCOPE}" -COPY --from=build-stage /tmp/build/package.json . -COPY --from=build-stage /tmp/build/pnpm-lock.yaml . -COPY --from=build-stage /tmp/build/node_modules ./node_modules -COPY --from=build-stage /tmp/build/dist ./dist +# Copy needed files +COPY --from=builder /out/package.json . +COPY --from=builder /out/node_modules ./node_modules +COPY --from=builder /out/dist ./dist -CMD ["node", "dist/index.js"] +# Start the app with node +CMD ["npm", "start"] \ No newline at end of file diff --git a/README.md b/README.md index b01cec51..4b78570f 100644 --- a/README.md +++ b/README.md @@ -11,33 +11,4 @@ -# Requirements -- NodeJS 16+ - -# Features -- Zero downtime deployments, You will almost never need to restart the gateway service, allowing absolute 100% uptime for your bot. Even when a restart is required, kanao will resume the sessions, so you will not lose a single event. -- Big Bot Sharding support -- Docker replica - -# Docker Replica - -To deploy replica the container must connected to docker sock in order know which replica in they are -```yaml -version: '3.8' - -services: - kanao: - deploy: - resources: - limits: - memory: "256M" - replicas: ${GATEWAY_REPLICA_COUNT:-3} - restart: always - image: 'ghcr.io/nezuchan/kanao:latest' - env_file: - - .env - volumes: - - /var/run/docker.sock:/var/run/docker.sock -``` - Being used in production by NezukoChan, Musical Tune, and more. diff --git a/package.json b/package.json index d63b8226..e989a05f 100644 --- a/package.json +++ b/package.json @@ -1,61 +1,21 @@ { - "name": "@nezuchan/kanao", - "version": "4.0.0", - "description": "A standalone service for connecting to the Discord gateway.", + "name": "kanao", + "version": "1.0.0", + "description": "A standalone service for connecting to the Discord gateway", + "type": "module", + "scripts": { + "build": "turbo run build", + "lint": "turbo run lint", + "lint:fix": "turbo run lint:fix" + }, + "keywords": [], + "author": "", "license": "GPL-3.0", - "author": "KagChi", - "type": "module", - "main": "dist", - "scripts": { - "build": "rimraf dist && swc ./src -d dist --config-file .swcrc --strip-leading-paths", - "lint": "eslint src", - "lint:fix": "eslint src --fix", - "start": "node -r dotenv/config dist/index.js", - "start:dev": "npm run build && node -r dotenv/config dist/index.js" - }, - "dependencies": { - "@discordjs/collection": "^2.0.0", - "@discordjs/rest": "^2.2.0", - "@discordjs/ws": "^1.0.2", - "@nezuchan/constants": "^0.8.0", - "@nezuchan/utilities": "^0.6.2", - "@sapphire/pieces": "^4.2.2", - "@sapphire/result": "^2.6.6", - "@sapphire/time-utilities": "^1.7.12", - "@sapphire/utilities": "^3.15.3", - "@skyra/start-banner": "^2.0.1", - "amqp-connection-manager": "^4.1.14", - "amqplib": "^0.10.3", - "bufferutil": "^4.0.8", - "discord-api-types": "^0.37.69", - "dockerode": "^4.0.2", - "dotenv": "^16.4.3", - "drizzle-orm": "^0.29.3", - "gradient-string": "^2.0.2", - "pino": "^8.18.0", - "pino-pretty": "^10.3.1", - "postgres": "^3.4.3", - "prometheus-middleware": "^1.3.3", - "tslib": "^2.6.2", - "utf-8-validate": "^6.0.3" - }, "devDependencies": { "@hazmi35/eslint-config": "^13.3.1", - "@swc/cli": "^0.3.9", - "@swc/core": "^1.4.0", - "@types/amqplib": "^0.10.4", - "@types/dockerode": "^3.3.23", - "@types/gradient-string": "^1.1.5", - "@types/node": "^20.11.17", - "@vladfrangu/async_event_emitter": "^2.2.4", - "drizzle-kit": "^0.20.14", "eslint": "^8.56.0", "rimraf": "^5.0.5", + "turbo": "^1.12.3", "typescript": "^5.3.3" - }, - "optionalDependencies": { - "ioredis": "^5.3.2", - "pino-loki": "^2.2.1", - "zlib-sync": "^0.1.9" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 71eaff71..de82f1a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,128 +4,141 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -dependencies: - '@discordjs/collection': - specifier: ^2.0.0 - version: 2.0.0 - '@discordjs/rest': - specifier: ^2.2.0 - version: 2.2.0 - '@discordjs/ws': - specifier: ^1.0.2 - version: 1.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) - '@nezuchan/constants': - specifier: ^0.8.0 - version: 0.8.0 - '@nezuchan/utilities': - specifier: ^0.6.2 - version: 0.6.2(amqplib@0.10.3) - '@sapphire/pieces': - specifier: ^4.2.2 - version: 4.2.2 - '@sapphire/result': - specifier: ^2.6.6 - version: 2.6.6 - '@sapphire/time-utilities': - specifier: ^1.7.12 - version: 1.7.12 - '@sapphire/utilities': - specifier: ^3.15.3 - version: 3.15.3 - '@skyra/start-banner': - specifier: ^2.0.1 - version: 2.0.1 - amqp-connection-manager: - specifier: ^4.1.14 - version: 4.1.14(amqplib@0.10.3) - amqplib: - specifier: ^0.10.3 - version: 0.10.3 - bufferutil: - specifier: ^4.0.8 - version: 4.0.8 - discord-api-types: - specifier: ^0.37.69 - version: 0.37.69 - dockerode: - specifier: ^4.0.2 - version: 4.0.2 - dotenv: - specifier: ^16.4.3 - version: 16.4.3 - drizzle-orm: - specifier: ^0.29.3 - version: 0.29.3(postgres@3.4.3) - gradient-string: - specifier: ^2.0.2 - version: 2.0.2 - pino: - specifier: ^8.18.0 - version: 8.18.0 - pino-pretty: - specifier: ^10.3.1 - version: 10.3.1 - postgres: - specifier: ^3.4.3 - version: 3.4.3 - prometheus-middleware: - specifier: ^1.3.3 - version: 1.3.3 - tslib: - specifier: ^2.6.2 - version: 2.6.2 - utf-8-validate: - specifier: ^6.0.3 - version: 6.0.3 - -optionalDependencies: - ioredis: - specifier: ^5.3.2 - version: 5.3.2 - pino-loki: - specifier: ^2.2.1 - version: 2.2.1 - zlib-sync: - specifier: ^0.1.9 - version: 0.1.9 - -devDependencies: - '@hazmi35/eslint-config': - specifier: ^13.3.1 - version: 13.3.1(@eslint/eslintrc@3.0.1)(@stylistic/eslint-plugin@1.6.1)(@typescript-eslint/eslint-plugin@6.21.0)(@typescript-eslint/parser@6.21.0)(eslint-config-prettier@9.1.0)(eslint-import-resolver-typescript@3.6.1)(eslint-plugin-import@2.29.1)(eslint-plugin-jsdoc@48.0.6)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint-plugin-tsdoc@0.2.17)(eslint-plugin-unicorn@51.0.1)(eslint@8.56.0)(globals@14.0.0)(typescript@5.3.3) - '@swc/cli': - specifier: ^0.3.9 - version: 0.3.9(@swc/core@1.4.0) - '@swc/core': - specifier: ^1.4.0 - version: 1.4.0 - '@types/amqplib': - specifier: ^0.10.4 - version: 0.10.4 - '@types/dockerode': - specifier: ^3.3.23 - version: 3.3.23 - '@types/gradient-string': - specifier: ^1.1.5 - version: 1.1.5 - '@types/node': - specifier: ^20.11.17 - version: 20.11.17 - '@vladfrangu/async_event_emitter': - specifier: ^2.2.4 - version: 2.2.4 - drizzle-kit: - specifier: ^0.20.14 - version: 0.20.14 - eslint: - specifier: ^8.56.0 - version: 8.56.0 - rimraf: - specifier: ^5.0.5 - version: 5.0.5 - typescript: - specifier: ^5.3.3 - version: 5.3.3 +importers: + + .: + devDependencies: + '@hazmi35/eslint-config': + specifier: ^13.3.1 + version: 13.3.1(@eslint/eslintrc@3.0.1)(@stylistic/eslint-plugin@1.6.1)(@typescript-eslint/eslint-plugin@6.21.0)(@typescript-eslint/parser@6.21.0)(eslint-config-prettier@9.1.0)(eslint-import-resolver-typescript@3.6.1)(eslint-plugin-import@2.29.1)(eslint-plugin-jsdoc@48.0.6)(eslint-plugin-n@16.6.2)(eslint-plugin-promise@6.1.1)(eslint-plugin-tsdoc@0.2.17)(eslint-plugin-unicorn@51.0.1)(eslint@8.56.0)(globals@14.0.0)(typescript@5.3.3) + eslint: + specifier: ^8.56.0 + version: 8.56.0 + rimraf: + specifier: ^5.0.5 + version: 5.0.5 + turbo: + specifier: ^1.12.3 + version: 1.12.3 + typescript: + specifier: ^5.3.3 + version: 5.3.3 + + services/kanao-gateway: + dependencies: + '@discordjs/collection': + specifier: ^2.0.0 + version: 2.0.0 + '@discordjs/rest': + specifier: ^2.2.0 + version: 2.2.0 + '@discordjs/ws': + specifier: ^1.0.2 + version: 1.0.2(bufferutil@4.0.8)(utf-8-validate@6.0.3) + '@nezuchan/constants': + specifier: ^0.8.0 + version: 0.8.0 + '@nezuchan/utilities': + specifier: ^0.6.2 + version: 0.6.2(amqplib@0.10.3) + '@sapphire/pieces': + specifier: ^4.2.2 + version: 4.2.2 + '@sapphire/result': + specifier: ^2.6.6 + version: 2.6.6 + '@sapphire/time-utilities': + specifier: ^1.7.12 + version: 1.7.12 + '@sapphire/utilities': + specifier: ^3.15.3 + version: 3.15.3 + '@skyra/start-banner': + specifier: ^2.0.1 + version: 2.0.1 + amqp-connection-manager: + specifier: ^4.1.14 + version: 4.1.14(amqplib@0.10.3) + amqplib: + specifier: ^0.10.3 + version: 0.10.3 + bufferutil: + specifier: ^4.0.8 + version: 4.0.8 + discord-api-types: + specifier: ^0.37.69 + version: 0.37.69 + dockerode: + specifier: ^4.0.2 + version: 4.0.2 + dotenv: + specifier: ^16.4.3 + version: 16.4.3 + drizzle-orm: + specifier: ^0.29.3 + version: 0.29.3(postgres@3.4.3) + gradient-string: + specifier: ^2.0.2 + version: 2.0.2 + pino: + specifier: ^8.18.0 + version: 8.18.0 + pino-pretty: + specifier: ^10.3.1 + version: 10.3.1 + postgres: + specifier: ^3.4.3 + version: 3.4.3 + prometheus-middleware: + specifier: ^1.3.3 + version: 1.3.3 + tslib: + specifier: ^2.6.2 + version: 2.6.2 + utf-8-validate: + specifier: ^6.0.3 + version: 6.0.3 + optionalDependencies: + ioredis: + specifier: ^5.3.2 + version: 5.3.2 + pino-loki: + specifier: ^2.2.1 + version: 2.2.1 + zlib-sync: + specifier: ^0.1.9 + version: 0.1.9 + devDependencies: + '@swc/cli': + specifier: ^0.3.9 + version: 0.3.9(@swc/core@1.4.0) + '@swc/core': + specifier: ^1.4.0 + version: 1.4.0 + '@types/amqplib': + specifier: ^0.10.4 + version: 0.10.4 + '@types/dockerode': + specifier: ^3.3.23 + version: 3.3.23 + '@types/gradient-string': + specifier: ^1.1.5 + version: 1.1.5 + '@types/node': + specifier: ^20.11.17 + version: 20.11.17 + '@vladfrangu/async_event_emitter': + specifier: ^2.2.4 + version: 2.2.4 + drizzle-kit: + specifier: ^0.20.14 + version: 0.20.14 + rimraf: + specifier: ^5.0.5 + version: 5.0.5 + typescript: + specifier: ^5.3.3 + version: 5.3.3 packages: @@ -1015,7 +1028,7 @@ packages: fast-glob: 3.3.2 minimatch: 9.0.3 piscina: 4.3.1 - semver: 7.5.4 + semver: 7.6.0 slash: 3.0.0 source-map: 0.7.4 dev: true @@ -1120,7 +1133,7 @@ packages: '@swc/helpers': optional: true dependencies: - '@swc/counter': 0.1.2 + '@swc/counter': 0.1.3 '@swc/types': 0.1.5 optionalDependencies: '@swc/core-darwin-arm64': 1.4.0 @@ -1135,10 +1148,6 @@ packages: '@swc/core-win32-x64-msvc': 1.4.0 dev: true - /@swc/counter@0.1.2: - resolution: {integrity: sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw==} - dev: true - /@swc/counter@0.1.3: resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} dev: true @@ -1607,7 +1616,7 @@ packages: engines: {node: '>=12'} dependencies: bin-version: 6.0.0 - semver: 7.5.4 + semver: 7.6.0 semver-truncate: 3.0.0 dev: true @@ -4299,7 +4308,7 @@ packages: resolution: {integrity: sha512-LJWA9kSvMolR51oDE6PN3kALBNaUdkxzAGcexw8gjMA8xr5zUqK0JiR3CgARSqanYF3Z1YHvsErb1KDgh+v7Rg==} engines: {node: '>=12'} dependencies: - semver: 7.5.4 + semver: 7.6.0 dev: true /semver@5.7.2: @@ -4312,14 +4321,6 @@ packages: hasBin: true dev: true - /semver@7.5.4: - resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} - engines: {node: '>=10'} - hasBin: true - dependencies: - lru-cache: 6.0.0 - dev: true - /semver@7.6.0: resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} engines: {node: '>=10'} @@ -4728,6 +4729,66 @@ packages: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} dev: false + /turbo-darwin-64@1.12.3: + resolution: {integrity: sha512-dDglIaux+A4jOnB9CDH69sujmrnuLJLrKw1t3J+if6ySlFuxSwC++gDq9TVuOZo2+S7lFkGh+x5ytn3wp+jE8Q==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /turbo-darwin-arm64@1.12.3: + resolution: {integrity: sha512-5TqqeujEyHMoVUWGzSzUl5ERSg7HDCdbU3gBs5ziWTpFRpeJ/+Y15kYyZJcMQcubRIH3Y1hL/yA5IhlGdgXOMA==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /turbo-linux-64@1.12.3: + resolution: {integrity: sha512-yUreU+/gq4vlBtcdyfjz7slwz4zM1RG8sSXvyHmAS+QXqSrGkegg4qLl2fRbv/c3EyA/XbfcZuD6tcrXkejr6g==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /turbo-linux-arm64@1.12.3: + resolution: {integrity: sha512-XRwAsp2eRSqZmaMVNrmHoKqofeJMuD87zmefZLTRAObh38hIwKgyl2QRsJIbteob5RN77yFbv3lAJ36UIY5h7w==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /turbo-windows-64@1.12.3: + resolution: {integrity: sha512-CPnRfnUCtmFeShOtUdMCthySjmyHaoTyh9JueiYFvtCNeO3WfDMj63dpOQstQWHdJFYmIrIGfhAclcds9ePQYA==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /turbo-windows-arm64@1.12.3: + resolution: {integrity: sha512-cYA/wlzvp4vlCNHYJ2AjNS3FLXWwUC/5CJompBkTeKFFB6AviE/iLkbIhFikCVSNXZk/3AGanpMUXIkt3bdlwg==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /turbo@1.12.3: + resolution: {integrity: sha512-a6q8I0TK9ohACYbkmxzG/JYPuDC4VCvfmXLTlf321qQ4BIAhoyaOj/O2g+zJ6L1vNYnZ82G4LrbMfgLLngbLsg==} + hasBin: true + optionalDependencies: + turbo-darwin-64: 1.12.3 + turbo-darwin-arm64: 1.12.3 + turbo-linux-64: 1.12.3 + turbo-linux-arm64: 1.12.3 + turbo-windows-64: 1.12.3 + turbo-windows-arm64: 1.12.3 + dev: true + /tweetnacl@0.14.5: resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==} dev: false diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 00000000..c66016f4 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - 'services/*' \ No newline at end of file diff --git a/.example.env b/services/kanao-gateway/.example.env similarity index 100% rename from .example.env rename to services/kanao-gateway/.example.env diff --git a/.swcrc b/services/kanao-gateway/.swcrc similarity index 94% rename from .swcrc rename to services/kanao-gateway/.swcrc index e2219e01..6b9a900a 100644 --- a/.swcrc +++ b/services/kanao-gateway/.swcrc @@ -1,12 +1,12 @@ -{ - "jsc": { - "parser": { - "syntax": "typescript", - "decorators": true - }, - "target": "es2022" - }, - "module": { - "type": "es6" - } +{ + "jsc": { + "parser": { + "syntax": "typescript", + "decorators": true + }, + "target": "es2022" + }, + "module": { + "type": "es6" + } } \ No newline at end of file diff --git a/services/kanao-gateway/README.md b/services/kanao-gateway/README.md new file mode 100644 index 00000000..b01cec51 --- /dev/null +++ b/services/kanao-gateway/README.md @@ -0,0 +1,43 @@ +