mirror of
https://git.bits.team/Bits/mod-manager.git
synced 2024-11-14 10:28:21 -05:00
Added mod tracking file generation
This commit is contained in:
parent
cbd482c763
commit
da3662b241
2
.gitignore
vendored
2
.gitignore
vendored
@ -131,3 +131,5 @@ dist
|
|||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
server/
|
server/
|
||||||
|
|
||||||
|
.idea/
|
@ -2,15 +2,12 @@ import { Command } from "commander";
|
|||||||
import Initialiser from "../util/initialiser.js";
|
import Initialiser from "../util/initialiser.js";
|
||||||
import Subcommand from "./subcommand.js";
|
import Subcommand from "./subcommand.js";
|
||||||
|
|
||||||
export default class InitCommand extends Subcommand {
|
export default class InitCommand implements Subcommand {
|
||||||
registerCommand(program: Command) {
|
registerCommand(program: Command) {
|
||||||
program.command("init")
|
program.command("init")
|
||||||
.description("Initialises mod manager")
|
.description("Initialises mod manager")
|
||||||
.action(this.execute);
|
.action(() => {
|
||||||
|
Initialiser.initialise();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
execute() {
|
|
||||||
Initialiser.initialise();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,6 @@
|
|||||||
import { existsSync, mkdirSync } from "fs";
|
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
||||||
|
import path from "path";
|
||||||
|
import Mods from "../mods/mods.js";
|
||||||
import PrintUtils from "./print_utils.js";
|
import PrintUtils from "./print_utils.js";
|
||||||
|
|
||||||
export default class Initialiser {
|
export default class Initialiser {
|
||||||
@ -27,10 +29,8 @@ export default class Initialiser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static isDirFabricServer(): boolean {
|
private static isDirFabricServer(): boolean {
|
||||||
const workingDirectory = process.cwd();
|
const serverProperties = path.join("server.properties");
|
||||||
|
const fabric = path.join(".fabric");
|
||||||
const serverProperties = `${workingDirectory}/server.properties`;
|
|
||||||
const fabric = `${workingDirectory}/.fabric`;
|
|
||||||
|
|
||||||
return existsSync(serverProperties) && existsSync(fabric);
|
return existsSync(serverProperties) && existsSync(fabric);
|
||||||
}
|
}
|
||||||
@ -38,16 +38,15 @@ export default class Initialiser {
|
|||||||
private static setupFolderStructure(): boolean {
|
private static setupFolderStructure(): boolean {
|
||||||
if (!existsSync(this.getModManagerFolderPath())) {
|
if (!existsSync(this.getModManagerFolderPath())) {
|
||||||
mkdirSync(this.getModManagerFolderPath());
|
mkdirSync(this.getModManagerFolderPath());
|
||||||
|
writeFileSync(Mods.getModFilePath(), "[]");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getModManagerFolderPath(): string {
|
public static getModManagerFolderPath(): string {
|
||||||
const workingDirectory = process.cwd();
|
return path.join(this.MOD_MANAGER_FOLDER);
|
||||||
|
|
||||||
return `${workingDirectory}/${this.MOD_MANAGER_FOLDER}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user