Skip to content

Commit

Permalink
refactor: remove gRPC (#2254)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet authored Apr 15, 2022
1 parent 3a7ac71 commit 7f592b1
Show file tree
Hide file tree
Showing 21 changed files with 4 additions and 463 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules/
dist/
src/lib/grpc/generated/
2 changes: 0 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ jobs:
cache: yarn
- name: Install Dependencies
run: yarn --immutable
- name: Run gRPC generator script
run: yarn build:grpc
- name: Run unit tests
run: yarn test --coverage
- name: Store code coverage report
Expand Down
2 changes: 0 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export default async (): Promise<Config.InitialOptions> => ({
'<rootDir>/src/lib/games/Slotmachine.ts',
'<rootDir>/src/lib/games/tic-tac-toe',
'<rootDir>/src/lib/games/WheelOfFortune.ts',
'<rootDir>/src/lib/grpc',
'<rootDir>/src/lib/grpc/generated',
'<rootDir>/src/lib/i18n/structures/Augments.d.ts',
'<rootDir>/src/lib/moderation',
'<rootDir>/src/lib/setup/PaginatedMessage.ts',
Expand Down
9 changes: 1 addition & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"#lib/database/settings": "./dist/lib/database/settings/index.js",
"#lib/discord": "./dist/lib/discord/index.js",
"#lib/env": "./dist/lib/env/index.js",
"#lib/grpc": "./dist/lib/grpc/index.js",
"#lib/moderation": "./dist/lib/moderation/index.js",
"#lib/moderation/managers": "./dist/lib/moderation/managers/index.js",
"#lib/moderation/workers": "./dist/lib/moderation/workers/index.js",
Expand All @@ -32,9 +31,7 @@
"#utils/functions": "./dist/lib/util/functions/index.js"
},
"scripts": {
"build": "yarn build:grpc && yarn build:tsc",
"build:grpc": "node scripts/build/grpc.mjs",
"build:tsc": "tsc -b src",
"build": "tsc -b src",
"dev": "yarn build && yarn start",
"watch": "tsc -b src -w",
"watch:start": "tsc-watch -b src --onSuccess \"yarn start\"",
Expand All @@ -55,7 +52,6 @@
"@discordjs/builders": "^0.12.0",
"@discordjs/collection": "^0.5.0",
"@favware/zalgo": "^3.1.3",
"@grpc/grpc-js": "^1.6.2",
"@influxdata/influxdb-client": "^1.24.0",
"@influxdata/influxdb-client-apis": "^1.24.0",
"@sapphire/async-queue": "^1.3.1",
Expand Down Expand Up @@ -91,7 +87,6 @@
"discord-api-types": "0.26.1",
"discord.js": "^13.6.0",
"dotenv-cra": "^3.0.2",
"grpc_tools_node_protoc_ts": "^5.3.2",
"he": "^1.2.0",
"ioredis": "^5.0.4",
"pg": "^8.7.3",
Expand All @@ -118,7 +113,6 @@
"@skyra/star-wars-api": "^2.0.9",
"@types/backoff": "^2.5.2",
"@types/diff": "^5.0.2",
"@types/google-protobuf": "^3.15.5",
"@types/he": "^1.1.2",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.23",
Expand All @@ -131,7 +125,6 @@
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"grpc-tools": "^1.11.2",
"husky": "^7.0.4",
"jest": "^27.5.1",
"jest-circus": "^27.5.1",
Expand Down
3 changes: 1 addition & 2 deletions scripts/build/clean.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { rm } from 'node:fs/promises';

const rootFolder = new URL('../../', import.meta.url);
const distFolder = new URL('dist/', rootFolder);
const generatedFolder = new URL('src/lib/grpc/generated/', rootFolder);

const options = { recursive: true, force: true };

await Promise.all([rm(distFolder, options), rm(generatedFolder, options)]);
await rm(distFolder, options);
106 changes: 0 additions & 106 deletions scripts/build/grpc.mjs

This file was deleted.

3 changes: 0 additions & 3 deletions src/.env
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ API_ORIGIN='http://127.0.0.1:3000'
API_PREFIX='/'
API_PORT=8282

GRPC_ENABLED=false
GRPC_ADDRESS='localhost:8291'

OAUTH_COOKIE='SKYRA_AUTH'
OAUTH_DOMAIN_OVERWRITE='127.0.0.1'
OAUTH_REDIRECT_URI='http://127.0.0.1:3000/oauth/callback'
Expand Down
3 changes: 0 additions & 3 deletions src/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ API_ORIGIN='http://127.0.0.1:3000'
API_PREFIX='/'
API_PORT=8282

GRPC_ENABLED=false
GRPC_ADDRESS='localhost:8291'

OAUTH_COOKIE='SKYRA_AUTH'
OAUTH_DOMAIN_OVERWRITE='127.0.0.1'
OAUTH_REDIRECT_URI='http://127.0.0.1:3000/oauth/callback'
Expand Down
1 change: 0 additions & 1 deletion src/.env.test
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
GRPC_ENABLED=true
OVERRIDE_ROOT_PATH='src'
3 changes: 0 additions & 3 deletions src/Skyra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ async function main() {
}

try {
// Wait for gRPC to connect
await container.grpc.start();

// Connect to the Database
container.db = await DbSet.connect();

Expand Down
3 changes: 0 additions & 3 deletions src/lib/env/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export interface SkyraEnv {
API_PORT: IntegerString;
API_PREFIX: string;

GRPC_ADDRESS: string;

OAUTH_COOKIE: string;
OAUTH_DOMAIN_OVERWRITE: string;
OAUTH_REDIRECT_URI: string;
Expand All @@ -44,7 +42,6 @@ export interface SkyraEnv {
PGSQL_DATABASE_PORT: IntegerString;
PGSQL_DATABASE_HOST: string;
TYPEORM_DEBUG_LOGS: BooleanString;
GRPC_ENABLED: BooleanString;
REDIS_HOST: string;

REDIS_ENABLED: BooleanString;
Expand Down
11 changes: 0 additions & 11 deletions src/lib/grpc/ModelStore.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/lib/grpc/index.ts

This file was deleted.

59 changes: 0 additions & 59 deletions src/lib/grpc/structures/base/ClientHandler.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/lib/grpc/structures/errors/ResponseError.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/lib/grpc/structures/errors/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/lib/grpc/structures/index.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/lib/setup/Grpc.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/lib/setup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import '@sapphire/plugin-i18next/register';
import '@sapphire/plugin-logger/register';
import '@sapphire/plugin-editable-commands/register';
import './Canvas';
import './Grpc';
import './PaginatedMessage';

import * as colorette from 'colorette';
Expand Down
2 changes: 0 additions & 2 deletions src/lib/types/Augments.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/unified-signatures */
import type { DbSet, GuildEntity, SettingsManager } from '#lib/database';
import type { GuildMemberFetchQueue } from '#lib/discord/GuildMemberFetchQueue';
import type { ModelStore } from '#lib/grpc';
import type { WorkerManager } from '#lib/moderation/workers/WorkerManager';
import type { AnalyticsData, ColorHandler, InviteCodeValidEntry, InviteStore, ScheduleManager, SkyraCommand } from '#lib/structures';
import type { TwitchStreamStatus } from '#lib/types/AnalyticsSchema';
Expand Down Expand Up @@ -51,7 +50,6 @@ declare module 'discord.js' {
declare module '@sapphire/pieces' {
interface Container {
db: DbSet;
grpc: ModelStore;
schedule: ScheduleManager;
settings: SettingsManager;
workers: WorkerManager;
Expand Down
Loading

0 comments on commit 7f592b1

Please sign in to comment.