Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: arrpc #1115

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions anda/misc/arrpc/0001-fix-support-esbuild.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From db29e1ce9f1a2b6b2ac3ef9df8b8b8524ab895f9 Mon Sep 17 00:00:00 2001
From: madomado <[email protected]>
Date: Mon, 29 Apr 2024 21:29:01 +0800
Subject: [PATCH] fix: support esbuild

---
src/process/index.js | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/process/index.js b/src/process/index.js
index 97ea651..f5486ca 100644
--- a/src/process/index.js
+++ b/src/process/index.js
@@ -1,13 +1,7 @@
const rgb = (r, g, b, msg) => `\x1b[38;2;${r};${g};${b}m${msg}\x1b[0m`;
const log = (...args) => console.log(`[${rgb(88, 101, 242, 'arRPC')} > ${rgb(237, 66, 69, 'process')}]`, ...args);

-import fs from 'node:fs';
-import { dirname, join } from 'path';
-import { fileURLToPath } from 'url';
-
-const __dirname = dirname(fileURLToPath(import.meta.url));
-const DetectableDB = JSON.parse(fs.readFileSync(join(__dirname, 'detectable.json'), 'utf8'));
-
+import DetectableDB from './detectable.json' with { type: "json" };
import * as Natives from './native/index.js';
const Native = Natives[process.platform];

--
2.44.0

11 changes: 6 additions & 5 deletions anda/misc/arrpc/arrpc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

Name: arrpc
Version: 3.4.0
Release: 1%?dist
Release: 2%?dist
Summary: Open Discord RPC server for atypical setups
License: MIT
URL: https://arrpc.openasar.dev
Source0: https://github.com/OpenAsar/arrpc/archive/%commit.tar.gz
Source1: arrpc.service
Patch0: 0001-fix-support-esbuild.patch
Requires: glibc
BuildRequires: nodejs-npm systemd-rpm-macros

Expand All @@ -21,15 +22,15 @@ server which messages the JSON of exactly what to dispatch with in the client wi
allowing small and simple mods or plugins. arRPC is experimental and a work in progress, so expect bugs, etc.

%prep
%autosetup -n arrpc-%commit
%autosetup -n arrpc-%commit -p1
# patch for using esbuild
sed -i -E 's@const server[^\n]+;@async function main() {\0@' src/index.js
sed -i -E 's@server\.on[^\n]+;@\0}\nmain();@' src/index.js

%build
npm i esbuild pkg
npx esbuild --bundle --platform=node --target=node18 --outdir=dist ./src/index.js
npx pkg -t node18-linux-x64 -o arrpc ./dist/index.js
npm i esbuild @yao-pkg/pkg
npx esbuild --bundle --platform=node --target=node20 --outdir=dist ./src/index.js
npx pkg -t node20-linux-x64 -o arrpc ./dist/index.js

%install
install -D -m755 arrpc %buildroot%_bindir/arrpc
Expand Down
Loading