vexcord/0007-Build-Don-t-use-import-assertions.patch
2024-04-26 14:21:38 +01:00

31 lines
1.1 KiB
Diff

From 88417678f3b38b3f2af056f2a34f9c6eb99d591f Mon Sep 17 00:00:00 2001
From: 1024x2 <2pow11@gmail.com>
Date: Fri, 26 Apr 2024 13:56:19 +0100
Subject: [PATCH 7/7] Build: Don't use import assertions
Node.js 22 removed the "assert" syntax because we obviously can't keep
things working for more than 5 minutes.
We can just call readFileSync instead, which works on all currently
supported Node.js versions.
---
scripts/build/common.mjs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/build/common.mjs b/scripts/build/common.mjs
index 5c34ad0..ff9b854 100644
--- a/scripts/build/common.mjs
+++ b/scripts/build/common.mjs
@@ -25,8 +25,7 @@ import { access, readdir, readFile } from "fs/promises";
import { join, relative } from "path";
import { promisify } from "util";
-// wtf is this assert syntax
-import PackageJSON from "../../package.json" assert { type: "json" };
+const PackageJSON = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf-8"));
import { getPluginTarget } from "../utils.mjs";
export const VERSION = PackageJSON.version;
--
2.44.0