plutonium-installer
Advanced tools
Comparing version 1.3.2 to 1.4.0
@@ -5,3 +5,3 @@ #!/usr/bin/env node | ||
import { program } from "commander"; | ||
import { InstallGame, InstallPlutoniumLauncher, InstallServerConfig, TGameKeys } from "./modules/Installer.js"; | ||
import { InstallGame, InstallIW4MAdmin, InstallPlutoniumLauncher, InstallServerConfig, TGameKeys } from "./modules/Installer.js"; | ||
import { CleanupInstall } from "./modules/Cleanup.js"; | ||
@@ -17,12 +17,12 @@ // Vars | ||
{ | ||
const InstallGameCommand = program.command("install-game").description("Install a plutonium game"); | ||
const Command = program.command("install-game").description("Install a plutonium game"); | ||
// Arguments | ||
InstallGameCommand.argument("<game>", "the game you want to install. e.g. t6"); | ||
Command.argument("<game>", "the game you want to install. e.g. t6"); | ||
// Options | ||
InstallGameCommand.option("-p, --path <string>", "Installation path", "./"); | ||
InstallGameCommand.option("-v, --verbose", "Enables verbose mode", false); | ||
InstallGameCommand.option("-s, --server", "Removes files for server use", false); | ||
InstallGameCommand.option("-f, --force", "Forces the install, if install detected", false); | ||
Command.option("-p, --path <string>", "Installation path", "./"); | ||
Command.option("-v, --verbose", "Enables verbose mode", false); | ||
Command.option("-s, --server", "Removes files for server use", false); | ||
Command.option("-f, --force", "Forces the install, if install detected", false); | ||
// Main functionality | ||
InstallGameCommand.action(async (Game, Options) => { | ||
Command.action(async (Game, Options) => { | ||
// Make sure a valid game is entered | ||
@@ -41,7 +41,7 @@ if (TGameKeys.includes(Game) == false) { | ||
{ | ||
const InstallLauncher = program.command("install-launcher").description("Install the plutonium launcher"); | ||
const Command = program.command("install-launcher").description("Install the plutonium launcher"); | ||
// Options | ||
InstallLauncher.option("-p, --path <string>", "Installation path", "./"); | ||
Command.option("-p, --path <string>", "Installation path", "./"); | ||
// Main functionaity | ||
InstallLauncher.action(async (Options) => { | ||
Command.action(async (Options) => { | ||
console.log("Installing..."); | ||
@@ -54,9 +54,9 @@ await InstallPlutoniumLauncher(Options.path); | ||
{ | ||
const InstallConfig = program.command("install-server-config").description("Install the server config for a plutonium game"); | ||
const Command = program.command("install-server-config").description("Install the server config for a plutonium game"); | ||
// Arguments | ||
InstallConfig.argument("<game>", "the game you want to install. e.g. t6"); | ||
Command.argument("<game>", "the game you want to install. e.g. t6"); | ||
// Options | ||
InstallConfig.option("-p, --path <string>", "Installation path", "./"); | ||
Command.option("-p, --path <string>", "Installation path", "./"); | ||
// Main functionaity | ||
InstallConfig.action(async (Game, Options) => { | ||
Command.action(async (Game, Options) => { | ||
// Make sure a valid game is entered | ||
@@ -72,10 +72,23 @@ if (TGameKeys.includes(Game) == false) { | ||
} | ||
// Install IW4M Admin | ||
{ | ||
const Command = program.command("install-iw4m-admin").description("Install IW4M Admin"); | ||
// Options | ||
Command.option("-p, --path <string>", "Installation path", "./"); | ||
// Main functionaity | ||
Command.action(async (Options) => { | ||
// Install | ||
console.log("Installing..."); | ||
await InstallIW4MAdmin(Options.path); | ||
console.log("Installed!"); | ||
}); | ||
} | ||
// Cleanup | ||
{ | ||
const Cleanup = program.command("cleanup").description("Cleanup a plutonium install for serveruse"); | ||
const Command = program.command("cleanup").description("Cleanup a plutonium install for serveruse"); | ||
// Options | ||
Cleanup.option("-p, --path <string>", "Installation path", "./"); | ||
Cleanup.option("-v, --verbose", "Enable verbose mode", false); | ||
Command.option("-p, --path <string>", "Installation path", "./"); | ||
Command.option("-v, --verbose", "Enable verbose mode", false); | ||
// Main functionality | ||
Cleanup.action((Options) => { | ||
Command.action((Options) => { | ||
console.log("Cleaning..."); | ||
@@ -82,0 +95,0 @@ CleanupInstall(Options.path, Options.verbose); |
@@ -6,2 +6,3 @@ export declare function InstallServerConfig(Game: TGame, Path: string): Promise<void>; | ||
export declare function InstallGame(Game: TGame, Path: string, Verbose?: boolean, Server?: boolean, Force?: boolean): Promise<void>; | ||
export declare function InstallIW4MAdmin(Path: string): Promise<void>; | ||
//# sourceMappingURL=Installer.d.ts.map |
@@ -131,2 +131,18 @@ // Dependencies | ||
} | ||
// | ||
export async function InstallIW4MAdmin(Path) { | ||
// Getting latest release | ||
const Response = await got("https://api.github.com/repos/RaidMax/IW4M-Admin/releases/latest").json(); | ||
const LatestURL = Response.assets[0].browser_download_url; | ||
// Downloading the file | ||
const File = (await got(LatestURL)).rawBody; | ||
const FileName = "IW4MAdmin.zip"; | ||
fs.writeFileSync(FileName, File); | ||
// Unzipping it from the main folder | ||
const zip = new StreamZip.async({ file: FileName }); | ||
await zip.extract(null, Path); | ||
await zip.close(); | ||
// Removing zip file | ||
fs.unlinkSync(FileName); | ||
} | ||
//# sourceMappingURL=Installer.js.map |
{ | ||
"name": "plutonium-installer", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "Lets you install plutonium games for both personal use and server use", | ||
@@ -5,0 +5,0 @@ "exports": "./lib/index.js", |
@@ -6,3 +6,3 @@ #!/usr/bin/env node | ||
import { program } from "commander" | ||
import { InstallGame, InstallPlutoniumLauncher, InstallServerConfig, TGameKeys } from "./modules/Installer.js"; | ||
import { InstallGame, InstallIW4MAdmin, InstallPlutoniumLauncher, InstallServerConfig, TGameKeys } from "./modules/Installer.js"; | ||
import { CleanupInstall } from "./modules/Cleanup.js"; | ||
@@ -21,15 +21,15 @@ | ||
{ | ||
const InstallGameCommand = program.command("install-game").description("Install a plutonium game") | ||
const Command = program.command("install-game").description("Install a plutonium game") | ||
// Arguments | ||
InstallGameCommand.argument("<game>", "the game you want to install. e.g. t6") | ||
Command.argument("<game>", "the game you want to install. e.g. t6") | ||
// Options | ||
InstallGameCommand.option("-p, --path <string>", "Installation path", "./") | ||
InstallGameCommand.option("-v, --verbose", "Enables verbose mode", false) | ||
InstallGameCommand.option("-s, --server", "Removes files for server use", false) | ||
InstallGameCommand.option("-f, --force", "Forces the install, if install detected", false) | ||
Command.option("-p, --path <string>", "Installation path", "./") | ||
Command.option("-v, --verbose", "Enables verbose mode", false) | ||
Command.option("-s, --server", "Removes files for server use", false) | ||
Command.option("-f, --force", "Forces the install, if install detected", false) | ||
// Main functionality | ||
InstallGameCommand.action(async (Game, Options) => { | ||
Command.action(async (Game, Options) => { | ||
// Make sure a valid game is entered | ||
@@ -50,9 +50,9 @@ if (TGameKeys.includes(Game) == false){ | ||
{ | ||
const InstallLauncher = program.command("install-launcher").description("Install the plutonium launcher") | ||
const Command = program.command("install-launcher").description("Install the plutonium launcher") | ||
// Options | ||
InstallLauncher.option("-p, --path <string>", "Installation path", "./") | ||
Command.option("-p, --path <string>", "Installation path", "./") | ||
// Main functionaity | ||
InstallLauncher.action(async (Options) => { | ||
Command.action(async (Options) => { | ||
console.log("Installing...") | ||
@@ -66,12 +66,12 @@ await InstallPlutoniumLauncher(Options.path) | ||
{ | ||
const InstallConfig = program.command("install-server-config").description("Install the server config for a plutonium game") | ||
const Command = program.command("install-server-config").description("Install the server config for a plutonium game") | ||
// Arguments | ||
InstallConfig.argument("<game>", "the game you want to install. e.g. t6") | ||
Command.argument("<game>", "the game you want to install. e.g. t6") | ||
// Options | ||
InstallConfig.option("-p, --path <string>", "Installation path", "./") | ||
Command.option("-p, --path <string>", "Installation path", "./") | ||
// Main functionaity | ||
InstallConfig.action(async (Game, Options) => { | ||
Command.action(async (Game, Options) => { | ||
// Make sure a valid game is entered | ||
@@ -89,12 +89,28 @@ if (TGameKeys.includes(Game) == false){ | ||
// Install IW4M Admin | ||
{ | ||
const Command = program.command("install-iw4m-admin").description("Install IW4M Admin") | ||
// Options | ||
Command.option("-p, --path <string>", "Installation path", "./") | ||
// Main functionaity | ||
Command.action(async (Options) => { | ||
// Install | ||
console.log("Installing...") | ||
await InstallIW4MAdmin(Options.path) | ||
console.log("Installed!") | ||
}) | ||
} | ||
// Cleanup | ||
{ | ||
const Cleanup = program.command("cleanup").description("Cleanup a plutonium install for serveruse") | ||
const Command = program.command("cleanup").description("Cleanup a plutonium install for serveruse") | ||
// Options | ||
Cleanup.option("-p, --path <string>", "Installation path", "./") | ||
Cleanup.option("-v, --verbose", "Enable verbose mode", false) | ||
Command.option("-p, --path <string>", "Installation path", "./") | ||
Command.option("-v, --verbose", "Enable verbose mode", false) | ||
// Main functionality | ||
Cleanup.action((Options) => { | ||
Command.action((Options) => { | ||
console.log("Cleaning...") | ||
@@ -101,0 +117,0 @@ CleanupInstall(Options.path, Options.verbose) |
@@ -143,2 +143,22 @@ // Dependencies | ||
}) | ||
} | ||
// | ||
export async function InstallIW4MAdmin(Path: string){ | ||
// Getting latest release | ||
const Response: any = await got("https://api.github.com/repos/RaidMax/IW4M-Admin/releases/latest").json() | ||
const LatestURL = Response.assets[0].browser_download_url | ||
// Downloading the file | ||
const File = (await got(LatestURL)).rawBody | ||
const FileName = "IW4MAdmin.zip" | ||
fs.writeFileSync(FileName, File) | ||
// Unzipping it from the main folder | ||
const zip = new StreamZip.async({ file: FileName }) | ||
await zip.extract(null, Path) | ||
await zip.close() | ||
// Removing zip file | ||
fs.unlinkSync(FileName) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56972
1019