Skip to content

Commit

Permalink
Merge pull request #117 from CreepPork/develop
Browse files Browse the repository at this point in the history
Magma v2.0.0
  • Loading branch information
CreepPork authored Feb 9, 2020
2 parents 93cdc2c + 8cecd03 commit f2a61b7
Show file tree
Hide file tree
Showing 77 changed files with 7,336 additions and 2,380 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ tests/coverage
*.tsbuildinfo
magma.json
*.tgz
oclif.manifest.json
test/coverage
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ before_script:
- npm i -g codecov

script:
- npm run test
- npm test
- npm pack

notifications:
email: false
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
{
"type": "node",
"request": "launch",
"name": "Debug cmd",
"name": "Debug test command",
"program": "${workspaceFolder}/bin/run",
"args": [
"cmd"
"test"
]
}
]
Expand Down
214 changes: 168 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
Magma
=====

A CLI app that is a mod updater for Arma 3 servers.
Magma is a CLI tool for Arma 3 server mod managment that works both on Windows and Linux.

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/@creeppork/magma.svg)](https://npmjs.org/package/@creeppork/magma)
[![Build Status](https://travis-ci.com/CreepPork/Magma.svg?token=TsdTZZVMQRx2yic71M4F&branch=master)](https://travis-ci.com/CreepPork/Magma)
[![Codecov](https://codecov.io/gh/CreepPork/Magma/branch/rewrite/graph/badge.svg)](https://codecov.io/gh/CreepPork/Magma)
[![Downloads/week](https://img.shields.io/npm/dw/@creeppork/magma.svg)](https://npmjs.org/package/@creeppork/magma)
[![License](https://img.shields.io/npm/l/@creeppork/magma.svg)](https://github.com/CreepPork/Magma/blob/master/LICENSE)
[![License](https://img.shields.io/npm/l/@creeppork/magma.svg)](https://github.com/CreepPork/Magma/blob/master/package.json)

<!-- toc -->
* [Features](#features)
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->

# Features

- Downloads mods from Steam Workshop, moves to directories, installs keys, updates config files
- Windows and Linux server support
- Server mod support (`-serverMod=...`)
- Client-side mod support (only installs keys)
- Fully supports non-interactive shells
- Support for a cron job (or task scheduler on Windows) that checks for mod updates and if found notifies Discord
- Ability to update and remove mods
- Supports mod activation and deactivation (doesn't remove them from disk)
- Supports Steam Guard

# Usage
<!-- usage -->
```sh-session
$ npm install -g @creeppork/magma
$ magma COMMAND
running command...
$ magma (-v|--version|version)
@creeppork/magma/1.1.2 linux-x64 node-v10.16.0
@creeppork/magma/2.0.0 linux-x64 node-v10.16.0
$ magma --help [COMMAND]
USAGE
$ magma COMMAND
Expand All @@ -29,59 +43,139 @@ USAGE
<!-- usagestop -->
# Commands
<!-- commands -->
* [`magma add ITEMID`](#magma-add-itemid)
* [`magma download ITEMID`](#magma-download-itemid)
* [`magma activate [ID]`](#magma-activate-id)
* [`magma add ID`](#magma-add-id)
* [`magma configure`](#magma-configure)
* [`magma cron`](#magma-cron)
* [`magma deactivate [ID]`](#magma-deactivate-id)
* [`magma help [COMMAND]`](#magma-help-command)
* [`magma initialize`](#magma-initialize)
* [`magma install`](#magma-install)
* [`magma login`](#magma-login)
* [`magma remove`](#magma-remove)
* [`magma list`](#magma-list)
* [`magma remove [ID]`](#magma-remove-id)
* [`magma update`](#magma-update)

## `magma add ITEMID`
## `magma activate [ID]`

Activates mods by adding their symlinks and keys back.

```
USAGE
$ magma activate [ID]
ARGUMENTS
ID Steam Workshop item IDs.
OPTIONS
-n, --nonInteractive Do not prompt for any input.
EXAMPLES
magma activate
magma activate 723217262
magma activate 450814997 723217262 713709341
```

_See code: [src/commands/activate.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/activate.ts)_

## `magma add ID`

Adds Steam Workshop item data to the config file.
Adds Steam Workshop items to the configuration files (does not download them).

```
USAGE
$ magma add ITEMID
$ magma add ID
ARGUMENTS
ITEMID Steam Workshop item IDs. Chaining them will add all of them at once.
ID Steam Workshop item IDs.
OPTIONS
-g, --gameAppId=gameAppId Steam game app ID. Can be found at SteamDB or in the URL.
-n, --nonInteractive Do not prompt for any input.
-t, --type=all|client|server [default: all]
EXAMPLES
magma add 723217262 --type client
magma add 450814997 723217262 713709341 --type all client server
```

_See code: [src/commands/add.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/add.ts)_

## `magma configure`

Allows to modify the existing configuration file. In interactive mode all flags will be ignored (except Steam Guard).

```
USAGE
$ magma configure
OPTIONS
-c, --steamCmd=steamCmd Absolute path to the SteamCMD executable (including the file
itself).
-g, --steamGuard=steamGuard Steam Guard code to use when authenticating.
-l, --linuxGsmInstanceConfig=linuxGsmInstanceConfig Absolute path to the LinuxGSM instance configuration file (where
it handles mods/servermods) (only supported on Linux)
-n, --nonInteractive Do not prompt for any input.
-p, --password=password Steam user password.
-s, --server=server Absolute path to the directory where the server is (where the
server executable is).
-u, --username=username Steam username.
-w, --webhookUrl=webhookUrl Webhook URL to which the magma cron command will respond to.
ALIASES
$ magma config
EXAMPLES
magma add 723217262
magma add 450814997 723217262 713709341
magma add 430091721 -g 4000
magma configure
magma configure --steamCmd "/var/steamcmd"
magma configure -n -u UserName
```

_See code: [src/commands/configure.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/configure.ts)_

## `magma cron`

A command designed to be run in a time-based job scheduler to notify on social platforms for mod updates. Each time it is run, it will query the Steam Web API. Do not run this command frequently (6hrs, 12hrs should suffice) so not to get rate-limited.

```
USAGE
$ magma cron
OPTIONS
-t, --test Enabling will send a simple test message to your specified webhook.
EXAMPLE
magma cron
```

_See code: [src/commands/add.ts](https://github.com/CreepPork/Magma/blob/v1.1.2/src/commands/add.ts)_
_See code: [src/commands/cron.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/cron.ts)_

## `magma download ITEMID`
## `magma deactivate [ID]`

Downloads Steam Workshop items, moves keys and updates mods.
Deactivates mods by removing their symlinks and keys.

```
USAGE
$ magma download ITEMID
$ magma deactivate [ID]
ARGUMENTS
ITEMID Steam Workshop item IDs. Chaining them will download all of them at once.
ID Steam Workshop item IDs.
OPTIONS
-f, --force Ignores time updated timestamp from Steam Workshop.
-g, --gameAppId=gameAppId Steam game app ID. Can be found at SteamDB or in the URL.
-n, --nonInteractive Do not prompt for any input.
EXAMPLES
magma download 723217262
magma download 450814997 723217262 713709341 -f
magma download 430091721 -g 4000
magma deactivate
magma deactivate 723217262
magma deactivate 450814997 723217262 713709341
```

_See code: [src/commands/download.ts](https://github.com/CreepPork/Magma/blob/v1.1.2/src/commands/download.ts)_
_See code: [src/commands/deactivate.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/deactivate.ts)_

## `magma help [COMMAND]`

Expand All @@ -98,69 +192,97 @@ OPTIONS
--all see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.0/src/commands/help.ts)_
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.3/src/commands/help.ts)_

## `magma initialize`

Initializes servers configuration data.
Initializes the configuration data required for Magma to operate.

```
USAGE
$ magma initialize
OPTIONS
-f, --force Skip the check for a settings file. If exists, it will be overwritten.
-c, --steamCmd=steamCmd Absolute path to the SteamCMD executable (including the file
itself).
-f, --force Skip the check for the magma.json file. If it exists, it will be
overwritten.
-g, --steamGuard=steamGuard Steam Guard code to use when authenticating.
-l, --linuxGsmInstanceConfig=linuxGsmInstanceConfig Absolute path to the LinuxGSM instance configuration file (where
it handles mods/servermods) (only supported on Linux)
-n, --nonInteractive Do not prompt for any input.
-p, --password=password Steam user password.
-s, --server=server Absolute path to the directory where the server is (where the
server executable is).
-u, --username=username Steam username.
-w, --webhookUrl=webhookUrl Webhook URL to which the magma cron command will respond to.
ALIASES
$ magma init
```

_See code: [src/commands/initialize.ts](https://github.com/CreepPork/Magma/blob/v1.1.2/src/commands/initialize.ts)_
_See code: [src/commands/initialize.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/initialize.ts)_

## `magma install`

Installs and updates all mods that are present in your configuration file.
Downloads and installs mods that have not been previously installed.

```
USAGE
$ magma install
OPTIONS
-f, --force Ignores time updated timestamps from Steam Workshop.
```

_See code: [src/commands/install.ts](https://github.com/CreepPork/Magma/blob/v1.1.2/src/commands/install.ts)_
_See code: [src/commands/install.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/install.ts)_

## `magma login`
## `magma list`

Logs into SteamCMD.
Lists all mods that have been added or installed by Magma.

```
USAGE
$ magma login
$ magma list
```

_See code: [src/commands/login.ts](https://github.com/CreepPork/Magma/blob/v1.1.2/src/commands/login.ts)_
_See code: [src/commands/list.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/list.ts)_

## `magma remove`
## `magma remove [ID]`

Removes selected mods from disk completely and their keys.
Removes mod files from disk.

```
USAGE
$ magma remove
$ magma remove [ID]
ARGUMENTS
ID Steam Workshop item IDs.
OPTIONS
-n, --nonInteractive Do not prompt for any input.
EXAMPLES
magma remove
magma remove 723217262
magma remove 450814997 723217262 713709341
```

_See code: [src/commands/remove.ts](https://github.com/CreepPork/Magma/blob/v1.1.2/src/commands/remove.ts)_
_See code: [src/commands/remove.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/remove.ts)_

## `magma update`

Updates installed mods and keys to their latest versions.
Updates currently downloaded mods from Steam Workshop.

```
USAGE
$ magma update
```

_See code: [src/commands/update.ts](https://github.com/CreepPork/Magma/blob/v1.1.2/src/commands/update.ts)_
_See code: [src/commands/update.ts](https://github.com/CreepPork/Magma/blob/v2.0.0/src/commands/update.ts)_
<!-- commandsstop -->
2 changes: 1 addition & 1 deletion bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'))
.catch(require('@oclif/errors/handle'));
37 changes: 37 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: [
'src/**/*.ts',
],

// The directory where Jest should output its coverage files
coverageDirectory: 'test/coverage',

coveragePathIgnorePatterns: [
'/node_modules/',
'src/@types'
],

// An array of file extensions your modules use
moduleFileExtensions: [
'ts',
'js'
],

// The test environment that will be used for testing
testEnvironment: 'node',

testMatch: [
'**/test/**/*.test.ts',
],

transform: {
"^.+\\.tsx?$": "ts-jest"
},
};
Loading

0 comments on commit f2a61b7

Please sign in to comment.