mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 17:11:56 +00:00
Add suppport for esbuild / node20
Close #1114
(cherry picked from commit e6d6774339)
Co-authored-by: madomado <madonuko@outlook.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
From db29e1ce9f1a2b6b2ac3ef9df8b8b8524ab895f9 Mon Sep 17 00:00:00 2001
|
||||
From: madomado <madonuko@outlook.com>
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user