mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[scripts/ferium-mrpack] Add script
This commit is contained in:
parent
d4bef9a0bf
commit
86ad883d1f
6 changed files with 1084 additions and 0 deletions
10
script-resources/ferium-mrpack/.eslintrc.yml
Normal file
10
script-resources/ferium-mrpack/.eslintrc.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
extends: eslint-config-dmitmel/presets/node
|
||||
parserOptions:
|
||||
sourceType: module
|
||||
rules:
|
||||
no-unused-expressions: off
|
||||
node/shebang: off
|
||||
node/no-unsupported-features/es-syntax:
|
||||
- error
|
||||
- ignores:
|
||||
- modules
|
1
script-resources/ferium-mrpack/.prettierrc.js
Normal file
1
script-resources/ferium-mrpack/.prettierrc.js
Normal file
|
@ -0,0 +1 @@
|
|||
module.exports = require('eslint-config-dmitmel/prettier.config.js');
|
28
script-resources/ferium-mrpack/main.js
Executable file
28
script-resources/ferium-mrpack/main.js
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { $ } from 'zx';
|
||||
import argparse from 'argparse';
|
||||
|
||||
let parser = new argparse.ArgumentParser();
|
||||
|
||||
parser.add_argument('INPUT_FILE', {
|
||||
help: 'Path to .mrpack file',
|
||||
});
|
||||
|
||||
let args = parser.parse_args();
|
||||
|
||||
$.sync`unzip -o ${args.INPUT_FILE} -d output`;
|
||||
$.sync`chmod 755 output/modrinth.index.json`;
|
||||
|
||||
let index = JSON.parse(fs.readFileSync("output/modrinth.index.json").toString());
|
||||
for (const mod of index.files) {
|
||||
/** @type {string} */
|
||||
let download = mod.downloads[0];
|
||||
let modId = download.match(/data\/(.+?)\//)[1];
|
||||
|
||||
$({sync: true, verbose: true})`ferium add ${modId}`
|
||||
|
||||
}
|
||||
|
||||
fs.rmSync("output", {recursive: true, force: true})
|
21
script-resources/ferium-mrpack/package.json
Normal file
21
script-resources/ferium-mrpack/package.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=20.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/argparse": "^2.0.16",
|
||||
"@types/yauzl": "^2.10.3",
|
||||
"eslint": "^8.36.0",
|
||||
"eslint-config-dmitmel": "dmitmel/eslint-config-dmitmel",
|
||||
"eslint-config-prettier": "^8.10.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-prettier": "^4.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1",
|
||||
"yauzl": "^3.1.3",
|
||||
"zx": "^8.1.4"
|
||||
}
|
||||
}
|
1023
script-resources/ferium-mrpack/pnpm-lock.yaml
generated
Normal file
1023
script-resources/ferium-mrpack/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
1
scripts/ferium-mrpack
Symbolic link
1
scripts/ferium-mrpack
Symbolic link
|
@ -0,0 +1 @@
|
|||
../script-resources/ferium-mrpack/main.js
|
Loading…
Add table
Add a link
Reference in a new issue