-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Tarnadas/dev
2.2.0
- Loading branch information
Showing
13 changed files
with
757 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const standardChangelog = require('standard-changelog') | ||
const pjson = require('./package.json') | ||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const changelogPath = path.join(__dirname, 'changelog') | ||
if (!fs.existsSync(changelogPath)) { | ||
fs.mkdirSync(changelogPath) | ||
} | ||
|
||
const changelogFilePath = path.join(changelogPath, `${pjson.version}.md`) | ||
const fileStream = fs.createWriteStream(changelogFilePath, { | ||
encoding: 'utf8' | ||
}) | ||
standardChangelog() | ||
.pipe(fileStream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# [2.2.0](https://github.com/Tarnadas/net64plus-server/compare/2.1.1...2.2.0) (2019-01-27) | ||
|
||
|
||
### Features | ||
|
||
* automatic port checking and command args ([f0afc2e](https://github.com/Tarnadas/net64plus-server/commit/f0afc2e)) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { ArgumentParser } from 'argparse' | ||
|
||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
|
||
import { Settings, DEFAULT_SETTINGS } from './models/Settings.model' | ||
|
||
export class Arguments { | ||
public settings: Settings | ||
|
||
private parser = new ArgumentParser({ | ||
addHelp: true, | ||
description: 'Net64+ server' | ||
}) | ||
|
||
constructor () { | ||
let settings: Settings | undefined | ||
let settingsPath = path.join(__dirname, '../settings.json') | ||
try { | ||
settings = JSON.parse(fs.readFileSync(settingsPath, { | ||
encoding: 'utf8' | ||
})) | ||
} catch (err) { | ||
fs.writeFileSync(settingsPath, JSON.stringify(DEFAULT_SETTINGS)) | ||
console.info('Failed to find or parse settings.json file. Using default settings instead and created a settings.json just for you.') | ||
} | ||
|
||
this.parser.addArgument([ '--port', '-P' ], { | ||
type: (int: string) => parseInt(int) | ||
}) | ||
this.parser.addArgument([ '--gamemode', '-g' ]) | ||
this.parser.addArgument([ '--disableGamemodeVote', '-G' ], { | ||
action: 'storeFalse' | ||
}) | ||
this.parser.addArgument([ '--passwordRequired', '-pr' ], { | ||
action: 'storeTrue' | ||
}) | ||
this.parser.addArgument([ '--password', '-p' ]) | ||
this.parser.addArgument([ '--name', '-n' ]) | ||
this.parser.addArgument([ '--domain', '-D' ]) | ||
this.parser.addArgument([ '--description', '-d' ]) | ||
this.parser.addArgument([ '--enableWebHook', '-w' ], { | ||
action: 'storeTrue' | ||
}) | ||
this.parser.addArgument([ '--apiKey', '-k' ]) | ||
const parsed = this.parser.parseArgs() as Settings | ||
|
||
this.settings = {} as any | ||
Object.entries(DEFAULT_SETTINGS).forEach(([ key, defaultValue ]: [ string, any ]) => { | ||
// @ts-ignore | ||
this.settings[key] = parsed[key] || (settings ? settings[key] : null) || defaultValue | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.