mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-25 09:51:01 -05:00
Replaced deprecated Buffer constructor with Buffer.from
This commit is contained in:
parent
bbe6c59888
commit
8c7eeb8fd9
3 changed files with 14 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
|||
"description": "GitHub Action that helps you publish your Minecraft mods",
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
"build": "ncc build --source-map --license license.txt",
|
||||
"build": "ncc build --source-map --license license.txt && ncc run scripts/index.ts",
|
||||
"test:lint": "eslint src/**/*.ts && eslint test/**/*.ts",
|
||||
"test:unit": "jest",
|
||||
"test": "npm run test:lint && npm run test:unit"
|
||||
|
|
10
scripts/buffer-fix.ts
Normal file
10
scripts/buffer-fix.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import fs from "fs";
|
||||
|
||||
export default function fixDeprecatedBuffer() {
|
||||
const files = fs.readdirSync("./dist", { withFileTypes: true });
|
||||
for (const file of files.filter(x => x.isFile())) {
|
||||
const content = fs.readFileSync(`./dist/${file.name}`, "utf8");
|
||||
const fixedContent = content.replace(/new Buffer\(/g, "Buffer.from(");
|
||||
fs.writeFileSync(`./dist/${file.name}`, fixedContent, "utf8");
|
||||
}
|
||||
}
|
3
scripts/index.ts
Normal file
3
scripts/index.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import fixDeprecatedBuffer from "./buffer-fix";
|
||||
|
||||
fixDeprecatedBuffer();
|
Loading…
Reference in a new issue