Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
116 additions
and
37 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 |
---|---|---|
@@ -1,35 +1,52 @@ | ||
|
||
## Instructions | ||
```bash | ||
# Install | ||
$ git clone https://github.com/tabarra/txAdmin && cd txAdmin | ||
$ npm i | ||
|
||
//FIXME: change config.json name, cant be both named the same | ||
|
||
data/ | ||
config.json (web port, admins) | ||
example/ | ||
config.json | ||
messages.json | ||
commands.json | ||
data/ | ||
players.json | ||
admin.log | ||
FXServer.log | ||
txAdmin_errors.log | ||
extensions/ ? | ||
setup.js | ||
start.js | ||
start.bat | ||
|
||
|
||
setup.js: | ||
checkup node version | ||
check packages | ||
# Add admin | ||
$ node src/scripts/admin-add.js | ||
|
||
# Setup default server | ||
$ node src/scripts/setup.js default | ||
|
||
# Start default server | ||
$ node src/index.js default | ||
``` | ||
|
||
## TODO: | ||
- [x] adapt admin-add | ||
- [ ] adapt config-tester | ||
- [ ] adapt main | ||
- [ ] xxx | ||
- [ ] xxx | ||
|
||
|
||
## Folder Structure | ||
data/ | ||
admins.json | ||
example/ | ||
config.json | ||
messages.json | ||
commands.json | ||
data/ | ||
players.json | ||
admin.log | ||
FXServer.log | ||
txAdmin_errors.log | ||
extensions/ (?) | ||
start_default.bat | ||
|
||
|
||
|
||
## setup.js | ||
check node version & packages | ||
check for existing settings and --overwrite | ||
start setup webpage asking for: | ||
login/password | ||
first server config (paths & etc) | ||
basic server config (paths & etc) | ||
check if the configs are correct | ||
save data/config.json with password | ||
save the server config as data/default | ||
|
||
start.js: | ||
checkup node version | ||
check packages | ||
start txadmin with the 'default' server config (or argv) | ||
|
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,56 @@ | ||
//Requires | ||
const fs = require('fs'); | ||
const { dir, log, logOk, logWarn, logError, cleanTerminal } = require('./console'); | ||
const context = 'TestUtils'; | ||
|
||
|
||
//================================================================ | ||
/** | ||
* Check if running on NodeJS v10 LTS | ||
*/ | ||
function nodeVersionChecker(){ | ||
if(!process.version.startsWith('v10.')){ | ||
cleanTerminal(); | ||
logError(`FATAL ERROR: txAdmin doesn't support NodeJS ${process.version}, please install NodeJS v10 LTS!`, 'NodeVersionChecker'); | ||
process.exit(); | ||
} | ||
} | ||
|
||
|
||
//================================================================ | ||
/** | ||
* Check if the packages in package.json were installed | ||
*/ | ||
function moduleInstallChecker() { | ||
let errorOut; | ||
try { | ||
let rawFile = fs.readFileSync('package.json'); | ||
let parsedFile = JSON.parse(rawFile); | ||
let packages = Object.keys(parsedFile.dependencies) | ||
let missing = []; | ||
packages.forEach(package => { | ||
try { | ||
require.resolve(package); | ||
} catch (error) { | ||
missing.push(package); | ||
} | ||
}); | ||
if(missing.length){ | ||
errorOut = `Make sure you executed 'npm i'. The following packages are missing:\n` + missing.join(', '); | ||
} | ||
} catch (error) { | ||
errorOut = `Error reading or parsing package.json: ${error.message}`; | ||
} | ||
|
||
if(errorOut){ | ||
logError(errorOut, 'PackageChecker'); | ||
process.exit(); | ||
} | ||
} | ||
|
||
|
||
|
||
module.exports = { | ||
nodeVersionChecker, | ||
moduleInstallChecker, | ||
} |
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