diff --git a/.eslintrc b/.eslintrc index 9146069..475489e 100755 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,7 @@ { "root": true, - "extends": ["prettier"], + "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], + "parser": "@typescript-eslint/parser", "parserOptions": { "sourceType": "module", "ecmaVersion": "latest" diff --git a/apis/websocket/README.md b/apis/websocket/README.md index b13d97a..e38c83c 100755 --- a/apis/websocket/README.md +++ b/apis/websocket/README.md @@ -1,57 +1,57 @@ -

- - - - -
- - -     - - - - - -     - - -     - - -     - - -     - - - - - -     - - - -
-
- Continuing the legacy of Vanced -

- -# 🚙 ReVanced Bot WebSocket API - -![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg) - -The WebSocket API for ReVanced bots utilizing BSON for packet transmission with a heartbeating system to monitor the statuses of clients. - -## 📚 Documentation - -Documentation are provided [here](./docs/README.md). - -## 📄 License - -**ReVanced Bot WebSocket API** adopts the [GNU General Public License 3.0](./LICENSE), tl;dr: You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL-licensed code must also be made available under the GPL along with build & install instructions. \ No newline at end of file +

+ + + + +
+ + +     + + + + + +     + + +     + + +     + + +     + + + + + +     + + + +
+
+ Continuing the legacy of Vanced +

+ +# 🚙 ReVanced Bot WebSocket API + +![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg) + +The WebSocket API for ReVanced bots utilizing BSON for packet transmission with a heartbeating system to monitor the statuses of clients. + +## 📚 Documentation + +Documentation are provided [here](./docs/README.md). + +## 📄 License + +**ReVanced Bot WebSocket API** adopts the [GNU General Public License 3.0](./LICENSE), tl;dr: You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL-licensed code must also be made available under the GPL along with build & install instructions. diff --git a/apis/websocket/docs/0_development_environment.md b/apis/websocket/docs/0_development_environment.md index 9e523f1..85960a4 100644 --- a/apis/websocket/docs/0_development_environment.md +++ b/apis/websocket/docs/0_development_environment.md @@ -1,39 +1,39 @@ -# 🏗️ Setting up the development environment - -> [!IMPORTANT] -> **This project uses [Bun](https://bun.sh) to run and bundle the code.** -> Compatibility with other runtimes (Node.js, Deno, ...) are not guaranteed and most package scripts won't work. - -To start developing, you'll need to set up the development environment first. - -1. Install [Bun](https://bun.sh) - -2. Clone the mono-repository - - ```sh - git clone https://github.com/ReVanced/revanced-helper.git && - cd revanced-helper - ``` - -3. Install dependencies - - ```sh - bun install - ``` - -4. Build packages/libraries - - ```sh - bun build:deps - ``` - -5. Change your directory to this project's root - ```sh - cd apis/websocket - ``` - -## ⏭️ What's next - -The next page will tell you about server configurations. - -Continue: [⚙️ Configuration](./1_configuration.md) +# 🏗️ Setting up the development environment + +> [!IMPORTANT] +> **This project uses [Bun](https://bun.sh) to run and bundle the code.** +> Compatibility with other runtimes (Node.js, Deno, ...) are not guaranteed and most package scripts won't work. + +To start developing, you'll need to set up the development environment first. + +1. Install [Bun](https://bun.sh) + +2. Clone the mono-repository + + ```sh + git clone https://github.com/ReVanced/revanced-helper.git && + cd revanced-helper + ``` + +3. Install dependencies + + ```sh + bun install + ``` + +4. Build packages/libraries + + ```sh + bun build:deps + ``` + +5. Change your directory to this project's root + ```sh + cd apis/websocket + ``` + +## ⏭️ What's next + +The next page will tell you about server configurations. + +Continue: [⚙️ Configuration](./1_configuration.md) diff --git a/apis/websocket/docs/1_configuration.md b/apis/websocket/docs/1_configuration.md index dd134be..5f2454b 100644 --- a/apis/websocket/docs/1_configuration.md +++ b/apis/websocket/docs/1_configuration.md @@ -1,39 +1,39 @@ -# ⚙️ Configuration - -This is the default configuration: - -```json -{ - "address": "127.0.0.1", - "port": 3000, - "ocrConcurrentQueues": 1, - "clientHeartbeatInterval": 60000, - "debugLogsInProduction": false -} -``` - ---- - -### `config.address` & `config.port` - -The address and port for the server to listen on. - -### `config.ocrConcurrentQueues` - -Amount of concurrent queues that can be run at a time. - -> Setting this too high may cause performance issues. - -### `config.clientHeartbeatInterval` - -Heartbeat interval for clients. See [**💓 Heartbeating**](./packets.md#💓-heartbeating). - -### `config.debugLogsInProduction` - -Whether to print debug logs at all in production mode (when `NODE_ENV` is `production`). - -## ⏭️ What's next - -The next page will tell you how to run and bundle the server. - -Continue: [🏃🏻‍♂️ Running the server](./2_running.md) +# ⚙️ Configuration + +This is the default configuration: + +```json +{ + "address": "127.0.0.1", + "port": 3000, + "ocrConcurrentQueues": 1, + "clientHeartbeatInterval": 60000, + "debugLogsInProduction": false +} +``` + +--- + +### `config.address` & `config.port` + +The address and port for the server to listen on. + +### `config.ocrConcurrentQueues` + +Amount of concurrent queues that can be run at a time. + +> Setting this too high may cause performance issues. + +### `config.clientHeartbeatInterval` + +Heartbeat interval for clients. See [**💓 Heartbeating**](./packets.md#💓-heartbeating). + +### `config.debugLogsInProduction` + +Whether to print debug logs at all in production mode (when `NODE_ENV` is `production`). + +## ⏭️ What's next + +The next page will tell you how to run and bundle the server. + +Continue: [🏃🏻‍♂️ Running the server](./2_running.md) diff --git a/apis/websocket/docs/2_running.md b/apis/websocket/docs/2_running.md index 6734a27..3ffd782 100644 --- a/apis/websocket/docs/2_running.md +++ b/apis/websocket/docs/2_running.md @@ -1,42 +1,41 @@ -# 🏃🏻‍♂️ Running the server - -There are many methods to run the server. Choose one that suits best for the situation. - -> [!IMPORTANT] -> Make sure you've followed the [**🏗️ Setting up the environment**](./0_development_environment.md) steps. - -## 👷🏻 Development mode (recommended) - -There will be no compilation step, and Bun will automatically watch changes and restart the server for you. - -You can quickly start the server by running: - -```sh -bun dev -``` - -## 🌐 Production mode - -Production mode runs no different from the development server, it simply has less debugging information printed to console by default. However, more production-specific features may come. - -To start the server in production mode, you'll have to: - -1. Set the `NODE_ENV` environment variable to `production` - - > It is very possible to set the value in the `.env` file and let Bun load it, **but it is recommended to set the variable before Bun even starts**. - -2. Start the server - ```sh - bun dev - ``` - -## 📦 Building - -If you're looking to build and host the server somewhere else, you can run: - -```sh -bun bundle -``` - -The files will be placed in the `dist` directory. **Configurations and `.env` files will NOT be copied automatically.** - +# 🏃🏻‍♂️ Running the server + +There are many methods to run the server. Choose one that suits best for the situation. + +> [!IMPORTANT] +> Make sure you've followed the [**🏗️ Setting up the environment**](./0_development_environment.md) steps. + +## 👷🏻 Development mode (recommended) + +There will be no compilation step, and Bun will automatically watch changes and restart the server for you. + +You can quickly start the server by running: + +```sh +bun dev +``` + +## 🌐 Production mode + +Production mode runs no different from the development server, it simply has less debugging information printed to console by default. However, more production-specific features may come. + +To start the server in production mode, you'll have to: + +1. Set the `NODE_ENV` environment variable to `production` + + > It is very possible to set the value in the `.env` file and let Bun load it, **but it is recommended to set the variable before Bun even starts**. + +2. Start the server + ```sh + bun dev + ``` + +## 📦 Building + +If you're looking to build and host the server somewhere else, you can run: + +```sh +bun bundle +``` + +The files will be placed in the `dist` directory. **Configurations and `.env` files will NOT be copied automatically.** diff --git a/apis/websocket/docs/3_packets.md b/apis/websocket/docs/3_packets.md index fe2ea75..96d5c7f 100644 --- a/apis/websocket/docs/3_packets.md +++ b/apis/websocket/docs/3_packets.md @@ -1,33 +1,33 @@ -# 📨 Packets - -Packets are BSON messages sent to the server. They're structured like the following when decoded: - -```json -{ - "op": 12345, - "d": { - "some_field": "some data" - } -} -``` - -### `packet.op` - -Operation codes are numbers that communicate an action. - -### `packet.d` - -Data fields include additional information for the server to process. They are **either an object with specific fields or just `null`**. - -#### 📦 Schemas and constants - -Schemas for packets and their respective data[^1], and the list of possible operation codes[^2] can be found in the `@revanced/bot-shared` package, with typings as well. - -[^1]: [`@revanced/bot-shared/src/schemas/Packet.ts`](../../packages/shared/src/schemas/Packet.ts) -[^2]: [`@revanced/bot-shared/src/constants/Operation`](../../packages/shared/src/constants/Operation.ts) - -## 💓 Heartbeating - -Heartbeating is a process where the client regularly send each other signals to confirm that they are still connected and functioning. If the server doesn't receive a heartbeat from the client within a specified timeframe, it assume the client has disconnected and closes the socket. - -You can configure the interval in the configuration file. See [**📝 Configuration > `config.clientHeartbeatInterval`**](./1_configuration.md#configclientheartbeatinterval). +# 📨 Packets + +Packets are BSON messages sent to the server. They're structured like the following when decoded: + +```json +{ + "op": 12345, + "d": { + "some_field": "some data" + } +} +``` + +### `packet.op` + +Operation codes are numbers that communicate an action. + +### `packet.d` + +Data fields include additional information for the server to process. They are **either an object with specific fields or just `null`**. + +#### 📦 Schemas and constants + +Schemas for packets and their respective data[^1], and the list of possible operation codes[^2] can be found in the `@revanced/bot-shared` package, with typings as well. + +[^1]: [`@revanced/bot-shared/src/schemas/Packet.ts`](../../packages/shared/src/schemas/Packet.ts) +[^2]: [`@revanced/bot-shared/src/constants/Operation`](../../packages/shared/src/constants/Operation.ts) + +## 💓 Heartbeating + +Heartbeating is a process where the client regularly send each other signals to confirm that they are still connected and functioning. If the server doesn't receive a heartbeat from the client within a specified timeframe, it assume the client has disconnected and closes the socket. + +You can configure the interval in the configuration file. See [**📝 Configuration > `config.clientHeartbeatInterval`**](./1_configuration.md#configclientheartbeatinterval). diff --git a/apis/websocket/docs/README.md b/apis/websocket/docs/README.md index 1ce65ca..5dc3ad7 100755 --- a/apis/websocket/docs/README.md +++ b/apis/websocket/docs/README.md @@ -1,16 +1,16 @@ -# 🚙 ReVanced Bot WebSocket API - -This documentation explains how the server works, how to start developing, and how to configure the server. - -# 📖 Table of contents - -0. [🏗️ Setting up the development environment](./0_development_environment.md) -1. [⚙️ Configuration](./1_configuration.md) -2. [🏃🏻‍♂️ Running the server](./2_running.md) -3. [📨 Packets](./3_packets.md) - -## ⏭️ Start here - -The next page will tell you how to set up the development environment. - -Continue: [🏗️ Setting up the development environment](./0_development_environment.md) +# 🚙 ReVanced Bot WebSocket API + +This documentation explains how the server works, how to start developing, and how to configure the server. + +# 📖 Table of contents + +0. [🏗️ Setting up the development environment](./0_development_environment.md) +1. [⚙️ Configuration](./1_configuration.md) +2. [🏃🏻‍♂️ Running the server](./2_running.md) +3. [📨 Packets](./3_packets.md) + +## ⏭️ Start here + +The next page will tell you how to set up the development environment. + +Continue: [🏗️ Setting up the development environment](./0_development_environment.md) diff --git a/apis/websocket/package.json b/apis/websocket/package.json index 99fd315..e95c042 100755 --- a/apis/websocket/package.json +++ b/apis/websocket/package.json @@ -1,43 +1,43 @@ -{ - "name": "@revanced/bot-websocket-api", - "type": "module", - "private": true, - "version": "0.1.0", - "description": "🧦 WebSocket API server for bots assisting ReVanced", - "main": "dist/index.js", - "scripts": { - "bundle": "bun build src/index.ts --outdir=dist --target=node --minify --sourcemap=external", - "dev": "bun run src/index.ts --watch", - "build": "bun bundle", - "watch": "bun dev" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/revanced/revanced-helper.git", - "directory": "apis/websocket" - }, - "author": "Palm (https://github.com/PalmDevs)", - "contributors": [ - "Palm (https://github.com/PalmDevs)", - "ReVanced (https://github.com/revanced)" - ], - "license": "GPL-3.0-or-later", - "bugs": { - "url": "https://github.com/revanced/revanced-helper/issues" - }, - "homepage": "https://github.com/revanced/revanced-helper#readme", - "dependencies": { - "@fastify/websocket": "^8.2.0", - "@revanced/bot-shared": "workspace:*", - "@sapphire/async-queue": "^1.5.0", - "chalk": "^5.3.0", - "fastify": "^4.24.3", - "node-wit": "^6.6.0", - "tesseract.js": "^5.0.3" - }, - "devDependencies": { - "@types/node-wit": "^6.0.3", - "@types/ws": "^8.5.10", - "typed-emitter": "^2.1.0" - } -} +{ + "name": "@revanced/bot-websocket-api", + "type": "module", + "private": true, + "version": "0.1.0", + "description": "🧦 WebSocket API server for bots assisting ReVanced", + "main": "dist/index.js", + "scripts": { + "bundle": "bun build src/index.ts --outdir=dist --target=node --minify --sourcemap=external", + "dev": "bun run src/index.ts --watch", + "build": "bun bundle", + "watch": "bun dev" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/revanced/revanced-helper.git", + "directory": "apis/websocket" + }, + "author": "Palm (https://github.com/PalmDevs)", + "contributors": [ + "Palm (https://github.com/PalmDevs)", + "ReVanced (https://github.com/revanced)" + ], + "license": "GPL-3.0-or-later", + "bugs": { + "url": "https://github.com/revanced/revanced-helper/issues" + }, + "homepage": "https://github.com/revanced/revanced-helper#readme", + "dependencies": { + "@fastify/websocket": "^8.2.0", + "@revanced/bot-shared": "workspace:*", + "@sapphire/async-queue": "^1.5.0", + "chalk": "^5.3.0", + "fastify": "^4.24.3", + "node-wit": "^6.6.0", + "tesseract.js": "^5.0.3" + }, + "devDependencies": { + "@types/node-wit": "^6.0.3", + "@types/ws": "^8.5.10", + "typed-emitter": "^2.1.0" + } +} diff --git a/apis/websocket/src/classes/Client.ts b/apis/websocket/src/classes/Client.ts index 5c96086..09bf3d3 100755 --- a/apis/websocket/src/classes/Client.ts +++ b/apis/websocket/src/classes/Client.ts @@ -141,7 +141,7 @@ export default class Client { this.#emitter.emit('packet', packet) this.#emitter.emit( uncapitalize(ClientOperation[packet.op] as ClientEventName), - // @ts-expect-error + // @ts-expect-error TypeScript doesn't know that the above line will negate the type enough packet ) } catch (e) { @@ -181,7 +181,7 @@ export default class Client { this.once('heartbeat', () => clearTimeout(interval)) // This should never happen but it did in my testing so I'm adding this just in case this.once('disconnect', () => clearTimeout(interval)) - // Technically we don't have to do this, but JUST IN CASE! + // Technically we don't have to do this, but JUST IN CASE! } else this.#hbTimeout.refresh() }, this.heartbeatInterval) } diff --git a/apis/websocket/src/events/index.ts b/apis/websocket/src/events/index.ts index 9724ec5..53d9d03 100755 --- a/apis/websocket/src/events/index.ts +++ b/apis/websocket/src/events/index.ts @@ -8,10 +8,13 @@ import type { Worker as TesseractWorker } from 'tesseract.js' export { default as parseTextEventHandler } from './parseText.js' export { default as parseImageEventHandler } from './parseImage.js' -export type EventHandler = (packet: ClientPacketObject, context: EventContext) => void | Promise +export type EventHandler = ( + packet: ClientPacketObject, + context: EventContext +) => void | Promise export type EventContext = { witClient: Wit tesseractWorker: TesseractWorker logger: Logger config: Config -} \ No newline at end of file +} diff --git a/apis/websocket/src/index.ts b/apis/websocket/src/index.ts index fab0d4e..6281ab1 100755 --- a/apis/websocket/src/index.ts +++ b/apis/websocket/src/index.ts @@ -1,150 +1,157 @@ -import { fastify } from 'fastify' -import fastifyWebsocket from '@fastify/websocket' - -import { createWorker as createTesseractWorker } from 'tesseract.js' -import witPkg from 'node-wit' -const { Wit } = witPkg - -import { inspect as inspectObject } from 'node:util' - -import Client from './classes/Client.js' - -import { - EventContext, - parseImageEventHandler, - parseTextEventHandler, -} from './events/index.js' - -import { getConfig, checkEnv, logger } from './utils/index.js' -import { WebSocket } from 'ws' -import { DisconnectReason, HumanizedDisconnectReason } from '@revanced/bot-shared' - -// Load environment variables and config - -(async () => { - -const environment = checkEnv(logger) -const config = getConfig() - -if (!config.debugLogsInProduction && environment === 'production') logger.debug = () => {} - -// Workers and API clients - -const tesseractWorker = await createTesseractWorker('eng') -const witClient = new Wit({ - accessToken: process.env['WIT_AI_TOKEN']!, -}) - -process.on('beforeExit', () => tesseractWorker.terminate()) - -// Server logic - -const clients = new Set() -const clientSocketMap = new WeakMap() -const eventContext: EventContext = { - tesseractWorker, - logger, - witClient, - config, -} - -const server = fastify() - .register(fastifyWebsocket, { - options: { - // 16 KiB max payload - // A Discord message can not be longer than 4000 characters - // OCR should not be longer than 16000 characters - maxPayload: 16 * 1024, - }, - }) - .register(async instance => { - instance.get('/', { websocket: true }, async (connection, request) => { - try { - const client = new Client({ - socket: connection.socket, - id: request.hostname, - heartbeatInterval: config.clientHeartbeatInterval, - }) - - clientSocketMap.set(connection.socket, client) - clients.add(client) - - logger.debug(`Client ${client.id}'s instance has been added`) - logger.info( - `New client connected (now ${clients.size} clients) with ID:`, - client.id - ) - - client.on('disconnect', reason => { - clients.delete(client) - logger.info( - `Client ${client.id} disconnected because client ${HumanizedDisconnectReason[reason]}` - ) - }) - - client.on('parseText', async packet => - parseTextEventHandler(packet, eventContext) - ) - - client.on('parseImage', async packet => - parseImageEventHandler(packet, eventContext) - ) - - if (environment === 'development' && !config.debugLogsInProduction) { - logger.debug('Running development mode or debug logs in production is enabled, attaching debug events...') - client.on('packet', ({ client: _, ...rawPacket }) => - logger.debug( - `Packet received from client ${client.id}:`, - inspectObject(rawPacket) - ) - ) - - client.on('heartbeat', () => - logger.debug('Heartbeat received from client', client.id) - ) - } - } catch (e) { - if (e instanceof Error) logger.error(e.stack ?? e.message) - else logger.error(inspectObject(e)) - - const client = clientSocketMap.get(connection.socket) - - if (!client) { - logger.error( - 'Missing client instance when encountering an error. If the instance still exists in memory, it will NOT be removed!' - ) - return connection.socket.terminate() - } - - if (client.disconnected === false) - client.disconnect(DisconnectReason.ServerError) - else client.forceDisconnect() - - clients.delete(client) - - logger.debug( - `Client ${client.id} disconnected because of an internal error` - ) - } - }) - }) - -// Start the server - -logger.debug('Starting with these configurations:', inspectObject(config)) - -await server.listen({ - host: config.address ?? '0.0.0.0', - port: config.port ?? 80, -}) - -const addressInfo = server.server.address() -if (!addressInfo || typeof addressInfo !== 'object') - logger.debug('Server started, but cannot determine address information') -else - logger.info( - 'Server started at:', - `${addressInfo.address}:${addressInfo.port}` - ) - -})() +import { fastify } from 'fastify' +import fastifyWebsocket from '@fastify/websocket' + +import { createWorker as createTesseractWorker } from 'tesseract.js' +import witPkg from 'node-wit' +const { Wit } = witPkg + +import { inspect as inspectObject } from 'node:util' + +import Client from './classes/Client.js' + +import { + EventContext, + parseImageEventHandler, + parseTextEventHandler, +} from './events/index.js' + +import { getConfig, checkEnv, logger } from './utils/index.js' +import { WebSocket } from 'ws' +import { + DisconnectReason, + HumanizedDisconnectReason, +} from '@revanced/bot-shared' + +// Check environment variables and load config +const environment = checkEnv(logger) +const config = getConfig() + +if (!config.debugLogsInProduction && environment === 'production') + logger.debug = () => {} + +// Workers and API clients + +const tesseractWorker = await createTesseractWorker('eng') +const witClient = new Wit({ + accessToken: process.env['WIT_AI_TOKEN']!, +}) + +process.on('beforeExit', () => tesseractWorker.terminate()) + +// Server logic + +const clients = new Set() +const clientSocketMap = new WeakMap() +const eventContext: EventContext = { + tesseractWorker, + logger, + witClient, + config, +} + +const server = fastify() + .register(fastifyWebsocket, { + options: { + // 16 KiB max payload + // A Discord message can not be longer than 4000 characters + // OCR should not be longer than 16000 characters + maxPayload: 16 * 1024, + }, + }) + .register(async instance => { + instance.get('/', { websocket: true }, async (connection, request) => { + try { + const client = new Client({ + socket: connection.socket, + id: request.hostname, + heartbeatInterval: config.clientHeartbeatInterval, + }) + + clientSocketMap.set(connection.socket, client) + clients.add(client) + + logger.debug(`Client ${client.id}'s instance has been added`) + logger.info( + `New client connected (now ${clients.size} clients) with ID:`, + client.id + ) + + client.on('disconnect', reason => { + clients.delete(client) + logger.info( + `Client ${client.id} disconnected because client ${HumanizedDisconnectReason[reason]}` + ) + }) + + client.on('parseText', async packet => + parseTextEventHandler(packet, eventContext) + ) + + client.on('parseImage', async packet => + parseImageEventHandler(packet, eventContext) + ) + + if ( + environment === 'development' && + !config.debugLogsInProduction + ) { + logger.debug( + 'Running development mode or debug logs in production is enabled, attaching debug events...' + ) + client.on('packet', ({ client, ...rawPacket }) => + logger.debug( + `Packet received from client ${client.id}:`, + inspectObject(rawPacket) + ) + ) + + client.on('heartbeat', () => + logger.debug( + 'Heartbeat received from client', + client.id + ) + ) + } + } catch (e) { + if (e instanceof Error) logger.error(e.stack ?? e.message) + else logger.error(inspectObject(e)) + + const client = clientSocketMap.get(connection.socket) + + if (!client) { + logger.error( + 'Missing client instance when encountering an error. If the instance still exists in memory, it will NOT be removed!' + ) + return connection.socket.terminate() + } + + if (client.disconnected === false) + client.disconnect(DisconnectReason.ServerError) + else client.forceDisconnect() + + clients.delete(client) + + logger.debug( + `Client ${client.id} disconnected because of an internal error` + ) + } + }) + }) + +// Start the server + +logger.debug('Starting with these configurations:', inspectObject(config)) + +await server.listen({ + host: config.address ?? '0.0.0.0', + port: config.port ?? 80, +}) + +const addressInfo = server.server.address() +if (!addressInfo || typeof addressInfo !== 'object') + logger.debug('Server started, but cannot determine address information') +else + logger.info( + 'Server started at:', + `${addressInfo.address}:${addressInfo.port}` + ) diff --git a/apis/websocket/src/utils/checkEnv.ts b/apis/websocket/src/utils/checkEnv.ts index 6bbe68b..00cee6d 100755 --- a/apis/websocket/src/utils/checkEnv.ts +++ b/apis/websocket/src/utils/checkEnv.ts @@ -1,9 +1,10 @@ import type { Logger } from './logger.js' export default function checkEnv(logger: Logger) { - if (!process.env['NODE_ENV']) logger.warn('NODE_ENV not set, defaulting to `development`') + if (!process.env['NODE_ENV']) + logger.warn('NODE_ENV not set, defaulting to `development`') const environment = (process.env['NODE_ENV'] ?? - 'development') as NodeEnvironment + 'development') as NodeEnvironment if (!['development', 'production'].includes(environment)) { logger.error( @@ -16,7 +17,9 @@ export default function checkEnv(logger: Logger) { logger.info(`Running in ${environment} mode...`) if (environment === 'production' && process.env['IS_USING_DOT_ENV']) { - logger.warn('You seem to be using .env files, this is generally not a good idea in production...') + logger.warn( + 'You seem to be using .env files, this is generally not a good idea in production...' + ) } if (!process.env['WIT_AI_TOKEN']) { diff --git a/apis/websocket/src/utils/getConfig.ts b/apis/websocket/src/utils/getConfig.ts index 2b39b31..384b695 100755 --- a/apis/websocket/src/utils/getConfig.ts +++ b/apis/websocket/src/utils/getConfig.ts @@ -2,28 +2,31 @@ import { existsSync } from 'node:fs' import { resolve as resolvePath } from 'node:path' import { pathToFileURL } from 'node:url' -const configPath = resolvePath( - process.cwd(), - 'config.json' -) +const configPath = resolvePath(process.cwd(), 'config.json') const userConfig: Partial = existsSync(configPath) - ? (await import(pathToFileURL(configPath).href, { - assert: { - type: 'json', - }, - })).default + ? ( + await import(pathToFileURL(configPath).href, { + assert: { + type: 'json', + }, + }) + ).default : {} type BaseTypeOf = T extends (infer U)[] ? U[] - : T extends (...args: any[]) => infer U - ? (...args: any[]) => U - : T extends object - ? { [K in keyof T]: T[K] } - : T + : T extends (...args: unknown[]) => infer U + ? (...args: unknown[]) => U + : T extends object + ? { [K in keyof T]: T[K] } + : T + +export type Config = Omit< + BaseTypeOf, + '$schema' +> -export type Config = Omit, '$schema'> & {} export const defaultConfig: Config = { address: '127.0.0.1', port: 80, diff --git a/apis/websocket/src/utils/index.ts b/apis/websocket/src/utils/index.ts index 9fe7e87..913395a 100755 --- a/apis/websocket/src/utils/index.ts +++ b/apis/websocket/src/utils/index.ts @@ -1,3 +1,3 @@ export { default as getConfig } from './getConfig.js' export { default as checkEnv } from './checkEnv.js' -export { default as logger } from './logger.js' \ No newline at end of file +export { default as logger } from './logger.js' diff --git a/apis/websocket/src/utils/logger.ts b/apis/websocket/src/utils/logger.ts index 2a71a75..96ef157 100755 --- a/apis/websocket/src/utils/logger.ts +++ b/apis/websocket/src/utils/logger.ts @@ -3,14 +3,23 @@ import { Chalk } from 'chalk' const chalk = new Chalk() const logger = { debug: (...args) => console.debug(chalk.gray('DEBUG:', ...args)), - info: (...args) => console.info(chalk.bgBlue.whiteBright(' INFO '), ...args), - warn: (...args) => console.warn(chalk.bgYellow.blackBright.bold(' WARN '), chalk.yellowBright(...args)), - error: (...args) => console.error(chalk.bgRed.whiteBright.bold(' ERROR '), chalk.redBright(...args)), + info: (...args) => + console.info(chalk.bgBlue.whiteBright(' INFO '), ...args), + warn: (...args) => + console.warn( + chalk.bgYellow.blackBright.bold(' WARN '), + chalk.yellowBright(...args) + ), + error: (...args) => + console.error( + chalk.bgRed.whiteBright.bold(' ERROR '), + chalk.redBright(...args) + ), log: console.log, } satisfies Logger export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'log' -export type LogFunction = (...x: any[]) => void +export type LogFunction = (...x: unknown[]) => void export type Logger = Record -export default logger \ No newline at end of file +export default logger diff --git a/apis/websocket/tsconfig.json b/apis/websocket/tsconfig.json index f69c640..fd79f29 100755 --- a/apis/websocket/tsconfig.json +++ b/apis/websocket/tsconfig.json @@ -4,8 +4,8 @@ "baseUrl": ".", "outDir": "dist", "module": "ESNext", - "composite": false, + "composite": false }, "exclude": ["node_modules", "dist"], "include": ["./*.json", "src/**/*.ts"] -} \ No newline at end of file +} diff --git a/bun.lockb b/bun.lockb index 3657320..78b21eb 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 6ae41cf..102c106 100755 --- a/package.json +++ b/package.json @@ -1,57 +1,57 @@ -{ - "name": "revanced-helper", - "version": "0.0.0", - "description": "🤖 Bots assisting ReVanced on multiple platforms", - "private": true, - "workspaces": [ - "apis/*", - "bots/*", - "packages/*" - ], - "scripts": { - "build": "bun task build", - "commitlint": "commitlint --edit", - "format": "turbo run format", - "format:check": "turbo run format:check", - "lint": "turbo run lint", - "lint:apply": "turbo run lint:apply", - "watch": "bun task watch", - "task": "turbo run", - "t": "bun task", - "prepare": "lefthook install" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/revanced/revanced-helper.git" - }, - "author": "Palm (https://github.com/PalmDevs)", - "contributors": [ - "Palm (https://github.com/PalmDevs)", - "ReVanced (https://github.com/revanced)" - ], - "license": "GPL-3.0-or-later", - "bugs": { - "url": "https://github.com/revanced/revanced-helper/issues" - }, - "homepage": "https://github.com/revanced/revanced-helper#readme", - "devDependencies": { - "@commitlint/cli": "^18.4.3", - "@commitlint/config-conventional": "^18.4.3", - "@tsconfig/strictest": "^2.0.2", - "conventional-changelog-conventionalcommits": "^7.0.2", - "eslint": "^8.54.0", - "eslint-config-prettier": "^9.0.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.29.0", - "eslint-plugin-prettier": "^5.0.1", - "lefthook": "^1.5.3", - "prettier": "^3.1.0", - "semantic-release": "^22.0.8", - "turbo": "^1.10.16", - "typescript": "^5.3.2" - }, - "overrides": { - "uuid": ">=9.0.0", - "isomorphic-fetch": ">=3.0.0" - } -} +{ + "name": "revanced-helper", + "version": "0.0.0", + "description": "🤖 Bots assisting ReVanced on multiple platforms", + "private": true, + "workspaces": [ + "apis/*", + "bots/*", + "packages/*" + ], + "scripts": { + "build": "bun task build", + "commitlint": "commitlint --edit", + "format": "turbo run format", + "format:check": "turbo run format:check", + "lint": "turbo run lint", + "lint:apply": "turbo run lint:apply", + "watch": "bun task watch", + "task": "turbo run", + "t": "bun task", + "prepare": "lefthook install" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/revanced/revanced-helper.git" + }, + "author": "Palm (https://github.com/PalmDevs)", + "contributors": [ + "Palm (https://github.com/PalmDevs)", + "ReVanced (https://github.com/revanced)" + ], + "license": "GPL-3.0-or-later", + "bugs": { + "url": "https://github.com/revanced/revanced-helper/issues" + }, + "homepage": "https://github.com/revanced/revanced-helper#readme", + "devDependencies": { + "@commitlint/cli": "^18.4.3", + "@commitlint/config-conventional": "^18.4.3", + "@tsconfig/strictest": "^2.0.2", + "conventional-changelog-conventionalcommits": "^7.0.2", + "eslint": "^8.54.0", + "eslint-config-prettier": "^9.0.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-prettier": "^5.0.1", + "lefthook": "^1.5.3", + "prettier": "^3.1.0", + "semantic-release": "^22.0.8", + "turbo": "^1.10.16", + "typescript": "^5.3.2" + }, + "overrides": { + "uuid": ">=9.0.0", + "isomorphic-fetch": ">=3.0.0" + } +} diff --git a/packages/api/package.json b/packages/api/package.json index 84bcd7f..9604004 100755 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,40 +1,40 @@ -{ - "name": "@revanced/bot-api", - "type": "module", - "version": "0.1.0", - "description": "🙌🏻 Programmatic API for bots assisting ReVanced to communicate to its API server", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "bun bundle && bun types", - "watch": "conc --raw \"bun bundle:watch\" \"bun types:watch\"", - "bundle": "bun build src/index.ts --outdir=dist --sourcemap=external --target=node --minify", - "bundle:watch": "bun run bundle --watch", - "types": "tsc --declaration --emitDeclarationOnly", - "types:watch": "bun types --watch --preserveWatchOutput", - "types:clean": "bun types --build --clean" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/revanced/revanced-helper.git", - "directory": "packages/api" - }, - "author": "Palm (https://github.com/PalmDevs)", - "contributors": [ - "Palm (https://github.com/PalmDevs)", - "ReVanced (https://github.com/revanced)" - ], - "license": "GPL-3.0-or-later", - "bugs": { - "url": "https://github.com/revanced/revanced-helper/issues" - }, - "homepage": "https://github.com/revanced/revanced-helper#readme", - "dependencies": { - "@revanced/bot-shared": "workspace:*", - "ws": "^8.14.2" - }, - "devDependencies": { - "@types/ws": "^8.5.10", - "typed-emitter": "^2.1.0" - } -} +{ + "name": "@revanced/bot-api", + "type": "module", + "version": "0.1.0", + "description": "🙌🏻 Programmatic API for bots assisting ReVanced to communicate to its API server", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "bun bundle && bun types", + "watch": "conc --raw \"bun bundle:watch\" \"bun types:watch\"", + "bundle": "bun build src/index.ts --outdir=dist --sourcemap=external --target=node --minify", + "bundle:watch": "bun run bundle --watch", + "types": "tsc --declaration --emitDeclarationOnly", + "types:watch": "bun types --watch --preserveWatchOutput", + "types:clean": "bun types --build --clean" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/revanced/revanced-helper.git", + "directory": "packages/api" + }, + "author": "Palm (https://github.com/PalmDevs)", + "contributors": [ + "Palm (https://github.com/PalmDevs)", + "ReVanced (https://github.com/revanced)" + ], + "license": "GPL-3.0-or-later", + "bugs": { + "url": "https://github.com/revanced/revanced-helper/issues" + }, + "homepage": "https://github.com/revanced/revanced-helper#readme", + "dependencies": { + "@revanced/bot-shared": "workspace:*", + "ws": "^8.14.2" + }, + "devDependencies": { + "@types/ws": "^8.5.10", + "typed-emitter": "^2.1.0" + } +} diff --git a/packages/api/src/classes/Client.ts b/packages/api/src/classes/Client.ts index 9daab24..725a811 100755 --- a/packages/api/src/classes/Client.ts +++ b/packages/api/src/classes/Client.ts @@ -49,7 +49,9 @@ export default class Client { rs(packet) } - const parseTextFailedListener = (packet: Packet) => { + const parseTextFailedListener = ( + packet: Packet + ) => { if (packet.d.id !== currentId) return this.gateway.off('parseTextFailed', parseTextFailedListener) rj(packet) @@ -84,7 +86,9 @@ export default class Client { rs(packet) } - const parseImageFailedListener = (packet: Packet) => { + const parseImageFailedListener = ( + packet: Packet + ) => { if (packet.d.id !== currentId) return this.gateway.off('parseImageFailed', parseImageFailedListener) rj(packet) diff --git a/packages/api/src/classes/ClientGateway.ts b/packages/api/src/classes/ClientGateway.ts index 8ff72e1..eb119b4 100755 --- a/packages/api/src/classes/ClientGateway.ts +++ b/packages/api/src/classes/ClientGateway.ts @@ -24,8 +24,7 @@ export default class ClientGateway { #hbTimeout: NodeJS.Timeout = null! #socket: WebSocket = null! - #emitter = - new EventEmitter() as TypedEmitter + #emitter = new EventEmitter() as TypedEmitter constructor(options: ClientGatewayOptions) { this.url = options.url @@ -110,6 +109,7 @@ export default class ClientGateway { switch (packet.op) { case ServerOperation.Hello: + // eslint-disable-next-line no-case-declarations const data = Object.freeze( (packet as Packet).d ) @@ -124,9 +124,11 @@ export default class ClientGateway { default: return this.#emitter.emit( uncapitalize( - ServerOperation[packet.op] as ClientGatewayServerEventName + ServerOperation[ + packet.op + ] as ClientGatewayServerEventName ), - // @ts-expect-error + // @ts-expect-error TypeScript doesn't know that the lines above negate the type enough packet ) } diff --git a/packages/api/src/classes/index.ts b/packages/api/src/classes/index.ts index 2ad36c8..e02f863 100755 --- a/packages/api/src/classes/index.ts +++ b/packages/api/src/classes/index.ts @@ -1,4 +1,4 @@ export { default as Client } from './Client.js' export * from './Client.js' export { default as ClientGateway } from './ClientGateway.js' -export * from './ClientGateway.js' \ No newline at end of file +export * from './ClientGateway.js' diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 9342b09..f4b850d 100755 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -5,7 +5,7 @@ "rootDir": "./src", "outDir": "dist", "module": "ESNext", - "composite": true, + "composite": true }, "exclude": ["node_modules", "dist"] -} \ No newline at end of file +} diff --git a/packages/api/utility-types.d.ts b/packages/api/utility-types.d.ts index 7fc44c5..1710e17 100755 --- a/packages/api/utility-types.d.ts +++ b/packages/api/utility-types.d.ts @@ -1 +1 @@ -type RequiredProperty = { [P in keyof T]: Required>; }; \ No newline at end of file +type RequiredProperty = { [P in keyof T]: Required> } diff --git a/packages/shared/package.json b/packages/shared/package.json index ac2f589..f877e75 100755 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,37 +1,37 @@ -{ - "name": "@revanced/bot-shared", - "type": "module", - "version": "0.1.0", - "description": "🙌🏻 Shared components for bots assisting ReVanced", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "bun bundle && bun types", - "watch": "conc --raw \"bun bundle:watch\" \"bun types:watch\"", - "bundle": "bun build src/index.ts --outdir=dist --sourcemap=external --target=node --minify", - "bundle:watch": "bun run bundle --watch", - "types": "tsc --declaration --emitDeclarationOnly", - "types:watch": "bun types --watch --preserveWatchOutput", - "types:clean": "bun types --build --clean" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/revanced/revanced-helper.git", - "directory": "packages/shared" - }, - "author": "Palm (https://github.com/PalmDevs)", - "contributors": [ - "Palm (https://github.com/PalmDevs)", - "ReVanced (https://github.com/revanced)" - ], - "license": "GPL-3.0-or-later", - "bugs": { - "url": "https://github.com/revanced/revanced-helper/issues" - }, - "homepage": "https://github.com/revanced/revanced-helper#readme", - "dependencies": { - "bson": "^6.2.0", - "valibot": "^0.21.0", - "zod": "^3.22.4" - } -} +{ + "name": "@revanced/bot-shared", + "type": "module", + "version": "0.1.0", + "description": "🙌🏻 Shared components for bots assisting ReVanced", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "bun bundle && bun types", + "watch": "conc --raw \"bun bundle:watch\" \"bun types:watch\"", + "bundle": "bun build src/index.ts --outdir=dist --sourcemap=external --target=node --minify", + "bundle:watch": "bun run bundle --watch", + "types": "tsc --declaration --emitDeclarationOnly", + "types:watch": "bun types --watch --preserveWatchOutput", + "types:clean": "bun types --build --clean" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/revanced/revanced-helper.git", + "directory": "packages/shared" + }, + "author": "Palm (https://github.com/PalmDevs)", + "contributors": [ + "Palm (https://github.com/PalmDevs)", + "ReVanced (https://github.com/revanced)" + ], + "license": "GPL-3.0-or-later", + "bugs": { + "url": "https://github.com/revanced/revanced-helper/issues" + }, + "homepage": "https://github.com/revanced/revanced-helper#readme", + "dependencies": { + "bson": "^6.2.0", + "valibot": "^0.21.0", + "zod": "^3.22.4" + } +} diff --git a/packages/shared/src/constants/DisconnectReason.ts b/packages/shared/src/constants/DisconnectReason.ts index cd017f8..051d5e3 100755 --- a/packages/shared/src/constants/DisconnectReason.ts +++ b/packages/shared/src/constants/DisconnectReason.ts @@ -19,9 +19,9 @@ enum DisconnectReason { */ ServerError, /** - * The client had never connected to the server (**CLIENT-ONLY**) + * The client had never connected to the server (**CLIENT-ONLY**) */ - NeverConnected + NeverConnected, } -export default DisconnectReason \ No newline at end of file +export default DisconnectReason diff --git a/packages/shared/src/constants/HumanizedDisconnectReason.ts b/packages/shared/src/constants/HumanizedDisconnectReason.ts index 95f510a..d9b4022 100755 --- a/packages/shared/src/constants/HumanizedDisconnectReason.ts +++ b/packages/shared/src/constants/HumanizedDisconnectReason.ts @@ -4,8 +4,9 @@ const HumanizedDisconnectReason = { [DisconnectReason.InvalidPacket]: 'has sent invalid packet', [DisconnectReason.Generic]: 'has been disconnected for unknown reasons', [DisconnectReason.TimedOut]: 'has timed out', - [DisconnectReason.ServerError]: 'has been disconnected due to an internal server error', - [DisconnectReason.NeverConnected]: 'had never connected to the server' + [DisconnectReason.ServerError]: + 'has been disconnected due to an internal server error', + [DisconnectReason.NeverConnected]: 'had never connected to the server', } as const satisfies Record -export default HumanizedDisconnectReason \ No newline at end of file +export default HumanizedDisconnectReason diff --git a/packages/shared/src/constants/Operation.ts b/packages/shared/src/constants/Operation.ts index 5a0a7cf..dcd0b96 100755 --- a/packages/shared/src/constants/Operation.ts +++ b/packages/shared/src/constants/Operation.ts @@ -50,8 +50,8 @@ export enum ServerOperation { /** * Server's disconnect message */ - Disconnect = 20 + Disconnect = 20, } export const Operation = { ...ClientOperation, ...ServerOperation } as const -export type Operation = (ClientOperation | ServerOperation) \ No newline at end of file +export type Operation = ClientOperation | ServerOperation diff --git a/packages/shared/src/constants/index.ts b/packages/shared/src/constants/index.ts index aa16eda..097859d 100755 --- a/packages/shared/src/constants/index.ts +++ b/packages/shared/src/constants/index.ts @@ -1,3 +1,3 @@ export { default as DisconnectReason } from './DisconnectReason.js' export { default as HumanizedDisconnectReason } from './HumanizedDisconnectReason.js' -export * from './Operation.js' \ No newline at end of file +export * from './Operation.js' diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 4cc2cfc..e5ef662 100755 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -1,3 +1,3 @@ export * from './constants/index.js' export * from './schemas/index.js' -export * from './utils/index.js' \ No newline at end of file +export * from './utils/index.js' diff --git a/packages/shared/src/schemas/index.ts b/packages/shared/src/schemas/index.ts index bbcb9e0..b593970 100755 --- a/packages/shared/src/schemas/index.ts +++ b/packages/shared/src/schemas/index.ts @@ -1 +1 @@ -export * from './Packet.js' \ No newline at end of file +export * from './Packet.js' diff --git a/packages/shared/src/utils/guard.ts b/packages/shared/src/utils/guard.ts index b8fd1ad..24a98e2 100755 --- a/packages/shared/src/utils/guard.ts +++ b/packages/shared/src/utils/guard.ts @@ -1,5 +1,9 @@ import { Packet } from '../schemas/Packet.js' -import { ClientOperation, Operation, ServerOperation } from '../constants/Operation.js' +import { + ClientOperation, + Operation, + ServerOperation, +} from '../constants/Operation.js' /** * Checks whether a packet is trying to do the given operation @@ -7,7 +11,10 @@ import { ClientOperation, Operation, ServerOperation } from '../constants/Operat * @param packet A packet * @returns Whether this packet is trying to do the operation given */ -export function packetMatchesOperation(op: TOp, packet: Packet): packet is Packet { +export function packetMatchesOperation( + op: TOp, + packet: Packet +): packet is Packet { return packet.op === op } @@ -16,7 +23,9 @@ export function packetMatchesOperation(op: TOp, packet: P * @param packet A packet * @returns Whether this packet is a client packet */ -export function isClientPacket(packet: Packet): packet is Packet { +export function isClientPacket( + packet: Packet +): packet is Packet { return packet.op in ClientOperation } @@ -25,6 +34,8 @@ export function isClientPacket(packet: Packet): packet is Packet { +export function isServerPacket( + packet: Packet +): packet is Packet { return packet.op in ServerOperation -} \ No newline at end of file +} diff --git a/packages/shared/src/utils/serialization.ts b/packages/shared/src/utils/serialization.ts index 807ddc5..764af14 100755 --- a/packages/shared/src/utils/serialization.ts +++ b/packages/shared/src/utils/serialization.ts @@ -20,4 +20,4 @@ export function serializePacket(packet: Packet) { export function deserializePacket(buffer: Buffer) { const data = BSON.deserialize(buffer) return parse(PacketSchema, data) as Packet -} \ No newline at end of file +} diff --git a/packages/shared/src/utils/string.ts b/packages/shared/src/utils/string.ts index 1c63acf..589bfa5 100755 --- a/packages/shared/src/utils/string.ts +++ b/packages/shared/src/utils/string.ts @@ -1,3 +1,3 @@ export function uncapitalize(str: T): Uncapitalize { - return str.charAt(0).toLowerCase() + str.slice(1) as Uncapitalize -} \ No newline at end of file + return (str.charAt(0).toLowerCase() + str.slice(1)) as Uncapitalize +} diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index 9342b09..f4b850d 100755 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -5,7 +5,7 @@ "rootDir": "./src", "outDir": "dist", "module": "ESNext", - "composite": true, + "composite": true }, "exclude": ["node_modules", "dist"] -} \ No newline at end of file +} diff --git a/tsconfig.apis.json b/tsconfig.apis.json index 80c29da..89b3d2b 100755 --- a/tsconfig.apis.json +++ b/tsconfig.apis.json @@ -1,3 +1,3 @@ { - "extends": "./tsconfig.base.json", + "extends": "./tsconfig.base.json" } diff --git a/tsconfig.base.json b/tsconfig.base.json index f11e436..a176582 100755 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,6 +1,6 @@ { // `bun-types` will not be added until https://github.com/oven-sh/bun/issues/7247 is fixed - "extends": ["@tsconfig/strictest", /* "bun-types" */], + "extends": ["@tsconfig/strictest" /* "bun-types" */], "compilerOptions": { "lib": ["ESNext"], "module": "NodeNext", @@ -12,6 +12,6 @@ "esModuleInterop": true, "declaration": false, "allowSyntheticDefaultImports": true, - "isolatedModules": true, - }, + "isolatedModules": true + } } diff --git a/tsconfig.packages.json b/tsconfig.packages.json index 831dee6..5b6cb51 100755 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.base.json", "compilerOptions": { "declaration": true, - "declarationMap": true, + "declarationMap": true }, "references": [ { @@ -10,6 +10,6 @@ }, { "path": "./packages/api" - }, + } ] } diff --git a/turbo.json b/turbo.json index 00f8c5a..263271e 100755 --- a/turbo.json +++ b/turbo.json @@ -1,26 +1,26 @@ -{ - "$schema": "https://turbo.build/schema.json", - "pipeline": { - "build": { - "dependsOn": ["^build"], - "outputs": ["dist/**"], - "outputMode": "errors-only" - }, - "watch": { - "dependsOn": ["^watch"], - "outputMode": "errors-only" - }, - "format": { - "dependsOn": ["^format"], - "outputMode": "errors-only" - }, - "lint": { - "dependsOn": ["^lint"], - "outputMode": "errors-only" - }, - "lint:apply": { - "dependsOn": ["^lint:apply"], - "outputMode": "errors-only" - } - } -} \ No newline at end of file +{ + "$schema": "https://turbo.build/schema.json", + "pipeline": { + "build": { + "dependsOn": ["^build"], + "outputs": ["dist/**"], + "outputMode": "errors-only" + }, + "watch": { + "dependsOn": ["^watch"], + "outputMode": "errors-only" + }, + "format": { + "dependsOn": ["^format"], + "outputMode": "errors-only" + }, + "lint": { + "dependsOn": ["^lint"], + "outputMode": "errors-only" + }, + "lint:apply": { + "dependsOn": ["^lint:apply"], + "outputMode": "errors-only" + } + } +}