mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-12 14:16:19 +00:00
Compare commits
2 Commits
@revanced/
...
@revanced/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f142c2b82e | ||
|
|
7dfbf6c92c |
@@ -1,3 +1,10 @@
|
||||
# @revanced/bot-websocket-api [1.0.0-dev.2](https://github.com/revanced/revanced-helper/compare/@revanced/bot-websocket-api@1.0.0-dev.1...@revanced/bot-websocket-api@1.0.0-dev.2) (2024-07-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **apis/websocket:** also include tesseract core files in build ([7dfbf6c](https://github.com/revanced/revanced-helper/commit/7dfbf6c92c49100954fa4aca471dce4ab9fd9565))
|
||||
|
||||
# @revanced/bot-websocket-api 1.0.0-dev.1 (2024-07-22)
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@revanced/bot-websocket-api",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"version": "1.0.0-dev.1",
|
||||
"version": "1.0.0-dev.2",
|
||||
"description": "🧦 WebSocket API server for bots assisting ReVanced",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { createLogger } from '@revanced/bot-shared'
|
||||
import { cp } from 'fs/promises'
|
||||
import { cp, rm } from 'fs/promises'
|
||||
|
||||
async function build(): Promise<void> {
|
||||
const logger = createLogger()
|
||||
|
||||
logger.info('Cleaning previous build...')
|
||||
await rm('./dist', { recursive: true })
|
||||
|
||||
logger.info('Building Tesseract.js worker...')
|
||||
await Bun.build({
|
||||
entrypoints: ['../../node_modules/tesseract.js/src/worker-script/node/index.js'],
|
||||
@@ -11,6 +14,9 @@ async function build(): Promise<void> {
|
||||
outdir: './dist/worker',
|
||||
})
|
||||
|
||||
logger.info('Copying Tesseract.js WASM...')
|
||||
await cp('../../node_modules/tesseract.js-core', './dist/worker/core', { recursive: true })
|
||||
|
||||
logger.info('Building WebSocket API...')
|
||||
await Bun.build({
|
||||
entrypoints: ['./src/index.ts'],
|
||||
|
||||
@@ -53,11 +53,14 @@ export interface WitMessageResponse {
|
||||
}>
|
||||
}
|
||||
|
||||
const TesseractWorkerPath = joinPath(import.meta.dir, 'worker', 'index.js')
|
||||
const TesseractCompiledWorkerExists = await pathExists(TesseractWorkerPath)
|
||||
const TesseractWorkerDirPath = joinPath(import.meta.dir, 'worker')
|
||||
const TesseractWorkerPath = joinPath(TesseractWorkerDirPath, 'index.js')
|
||||
const TesseractCorePath = joinPath(TesseractWorkerDirPath, 'core')
|
||||
|
||||
export const tesseract = await createTesseractWorker(
|
||||
'eng',
|
||||
OEM.DEFAULT,
|
||||
TesseractCompiledWorkerExists ? { workerPath: TesseractWorkerPath } : undefined,
|
||||
(await pathExists(TesseractWorkerDirPath))
|
||||
? { workerPath: TesseractWorkerPath, corePath: TesseractCorePath }
|
||||
: undefined,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user