Skip to content

Commit

Permalink
Added more scripts to make editing easier
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperLorelai committed Dec 27, 2021
1 parent 919aaff commit bee04b9
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
tags: ["NotSilenceable"],
delay: 1,
"stay-open-non-option": true,
title: "&9" + prefixTitle + " Sounds",
title: "&9" + prefixTitle + " &3Sounds",
options: {}
};
},
Expand Down
23 changes: 23 additions & 0 deletions checkSoundboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const deepObjectDiff = require("deep-object-diff").detailedDiff;

const Util = require("./Util");
const Config = require("./Config");
const {version, soundboardVersionCompared} = Config;

function getFile(version) {
const fileName = "./soundboards/" + version + ".yml";

if (!Util.fileExists(fileName)) {
console.log("Final soundboard for version '" + version + "' does not exit.");
return null;
}

return Util.loadYAMLasJSON(fileName);
}

const configFirst = getFile(version);
if (!configFirst) return;
const configSecond = getFile("spellSystem-Soundboard-" + soundboardVersionCompared + "-by-JasperLorelai");
if (!configSecond) return;

Util.saveJSONasYAML("./soundboards/difference-" + version + "-" + soundboardVersionCompared + ".yml", deepObjectDiff(configSecond, configFirst));
9 changes: 8 additions & 1 deletion clearTemFiles.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
const fs = require("fs");

const path = "./soundConfig/";
let path = "./soundConfig/";

for (const file of fs.readdirSync(path)) {
if (file.startsWith("final")) continue;
fs.rmSync(path + file);
}

path = "./soundboards/";

for (const file of fs.readdirSync(path)) {
if (file.startsWith("spellSystem") || file.startsWith("base")) continue;
fs.rmSync(path + file);
}
17 changes: 17 additions & 0 deletions copySoundConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const fs = require("fs");
const Util = require("./Util");
const Config = require("./Config");
const {version} = Config;

function makeName(prefix = "") {
return "./soundConfig/" + prefix + version + ".yml";
}

const soundConfigFileName = makeName();

if (!Util.fileExists(soundConfigFileName)) {
console.log("Sound config for version '" + version + "' does not exit.");
return;
}

fs.copyFileSync(makeName(), makeName("copy-"));
2 changes: 1 addition & 1 deletion createSoundboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function createCategorySpells(config, title, soundName) {
const soundSpellName = "sound-" + fullSound.replace(/\./g, "-");
createOption(options, "Sound_" + sound.toTitleCase(), soundSpellName, {
type: icon,
name: "<yellow>" + sound.toTitleCase() + " Sound",
name: "<yellow>" + sound.toTitleCase() + " <gold>Sound",
lore: ["<grey><italic>" + fullSound]
});
soundSpells[soundSpellName] = Util.createSoundSpell(fullSound, title.substring(3, title.length - 1).replace(/-/g, "_"));
Expand Down
30 changes: 29 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 17 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@
"name": "soundboard",
"version": "1.0.0",
"description": "Minecraft soundboard.",
"main": "createSoundboard.js",
"main": "clearTemFiles.js",
"scripts": {
"#0": "Steps:",
"reinstall": "npm i",
"create_sooundboard": "node createSoundboard.js",
"#1": "Create a new file under /sounds for your version. Edit Config to include current version info.",
"create_sound_config": "node createSoundConfig.js",
"finalise_sound_config": "node finaliseSoundConfig.js",
"#2": "Add icons to sounds. If a previous config exists, edit the config to include previous config version info,",
"/": "then run these for easier editing until #3, otherwise, skip to #3.",
"copy_sound_config": "node copySoundConfig.js",
"check_sound_config": "node checkSoundConfig.js",
"clear_temp_files": "node clearTemFiles.js",
"finalise_soundboard": "node finaliseSoundboard.js"
"#3": "",
"finalise_sound_config": "node finaliseSoundConfig.js",
"create_sooundboard": "node createSoundboard.js",
"#4": "Run this if a previous version of the soundboard exists and you wish to compare them.",
"check_soundboard": "node checkSoundboard.js",
"#5": "",
"finalise_soundboard": "node finaliseSoundboard.js",
"#6": "Run this to clear all files. The finalised Soundboard should be published.",
"clear_temp_files": "node clearTemFiles.js"
},
"repository": {
"url": "https://github.com/JasperLorelai/minecraft-soundboard"
},
"engines": {
"node": "14.17.0",
"npm": "6.14.13"
"node": "16.6.2",
"npm": "7.20.3"
},
"author": "JasperLorelai",
"license": "ISC",
Expand Down

0 comments on commit bee04b9

Please sign in to comment.