From 17de96ae537fd66748bd0ef18cc5affa3bbcc0ef Mon Sep 17 00:00:00 2001 From: Trevor Wessel Date: Wed, 22 Apr 2020 17:13:50 -0600 Subject: [PATCH] Update Depencies --- .gitignore | 3 +- README.md | 14 ++++----- install.js | 89 ++++++++++++++++++++++++------------------------------ server.log | 7 ----- 4 files changed, 48 insertions(+), 65 deletions(-) delete mode 100644 server.log diff --git a/.gitignore b/.gitignore index b7969a4..505d79e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ data altv-server.exe libnode.dll package-lock.json -update.json \ No newline at end of file +update.json +server.log \ No newline at end of file diff --git a/README.md b/README.md index 6c6f5d1..babc5ce 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ This repo will do everything for you; including download the latest server files. +## Requirements + +- NodeJS V13+ + ## Official Links - [alt:V Website](https://altv.mp/#/) @@ -23,11 +27,11 @@ cd altv-quickstart 2. Run the code block below this. - 5.1. This can be used whenever you need to update your server files. + 2.1. This can be used whenever you need to update your server files. - 5.2. Run the code block below; wait for packages to install. + 2.2. Run the code block below; wait for packages to install. - 5.2. Then follow the instructions on screen. + 2.3. Then follow the instructions on screen. ``` npm run update @@ -112,7 +116,3 @@ import * as alt from 'alt-server' /// import * as alt from 'alt-client' ``` - -### Known Issues - -If you get an issue saying that it can't use `require` for the install. What you can do instead is remove the `type: "module"` from the `package.json` file. **REMEMBER TO PUT IT BACK AFTER YOU INSTAll/UPDATE**. diff --git a/install.js b/install.js index 1772f38..aa4ac13 100644 --- a/install.js +++ b/install.js @@ -1,18 +1,14 @@ -const fs = require('fs'); -const download = require('download'); -const path = require('path'); -const exec = require('child_process').exec; +import fs from 'fs'; +import download from 'download'; +import { exec } from 'child_process'; +import rl from 'readline'; + const platform = process.platform === 'win32' ? 'windows' : 'linux'; -const readline = require('readline').createInterface({ +const readline = rl.createInterface({ input: process.stdin, output: process.stdout }); -let discordAppInfo = { - discord: '', - token: '' -}; - let options = { 1: 'Update Server Files', 2: 'Exit' @@ -20,54 +16,54 @@ let options = { let windowsURLS = [ { - url: `https://cdn.altv.mp/node-module/beta/x64_win32/update.json`, + url: `https://cdn.altv.mp/node-module/CHANGE_ME/x64_win32/update.json`, destination: '.' }, { - url: `https://cdn.altv.mp/node-module/beta/x64_win32/modules/node-module.dll`, + url: `https://cdn.altv.mp/node-module/CHANGE_ME/x64_win32/modules/node-module.dll`, destination: './modules' }, { - url: `https://cdn.altv.mp/node-module/beta/x64_win32/libnode.dll`, + url: `https://cdn.altv.mp/node-module/CHANGE_ME/x64_win32/libnode.dll`, destination: '.' }, { - url: `https://cdn.altv.mp/server/beta/x64_win32/altv-server.exe`, + url: `https://cdn.altv.mp/server/CHANGE_ME/x64_win32/altv-server.exe`, destination: '.' }, { - url: `https://cdn.altv.mp/server/beta/x64_win32/data/vehmodels.bin`, + url: `https://cdn.altv.mp/server/CHANGE_ME/x64_win32/data/vehmodels.bin`, destination: './data' }, { - url: `https://cdn.altv.mp/server/beta/x64_win32/data/vehmods.bin`, + url: `https://cdn.altv.mp/server/CHANGE_ME/x64_win32/data/vehmods.bin`, destination: './data' } ]; let linuxURLS = [ { - url: `https://cdn.altv.mp/node-module/beta/x64_linux/update.json`, + url: `https://cdn.altv.mp/node-module/CHANGE_ME/x64_linux/update.json`, destination: '.' }, { - url: `https://cdn.altv.mp/node-module/beta/x64_linux/modules/libnode-module.so`, + url: `https://cdn.altv.mp/node-module/CHANGE_ME/x64_linux/modules/libnode-module.so`, destination: './modules' }, { - url: `https://cdn.altv.mp/node-module/beta/x64_linux/libnode.so.72`, + url: `https://cdn.altv.mp/node-module/CHANGE_ME/x64_linux/libnode.so.72`, destination: '.' }, { - url: `https://cdn.altv.mp/server/beta/x64_linux/altv-server`, + url: `https://cdn.altv.mp/server/CHANGE_ME/x64_linux/altv-server`, destination: '.' }, { - url: `https://cdn.altv.mp/server/beta/x64_linux/data/vehmodels.bin`, + url: `https://cdn.altv.mp/server/CHANGE_ME/x64_linux/data/vehmodels.bin`, destination: './data' }, { - url: `https://cdn.altv.mp/server/beta/x64_linux/data/vehmods.bin`, + url: `https://cdn.altv.mp/server/CHANGE_ME/x64_linux/data/vehmods.bin`, destination: './data' }, { @@ -131,47 +127,40 @@ async function startup() { res = undefined; console.log('Updating Server Files'); console.log('Select Branch'); - console.log('0: Stable [Default]'); - console.log('1: Beta'); - console.log('2: Alpha'); + console.log('0: Release [Default]'); + console.log('1: Release Candidate'); + console.log('2: Dev'); res = await question('Select Branch: '); if (!res) { res = 0; } + let branchSelection; if (parseInt(res) === 0) { - if (platform === 'windows') { - console.log('Windows'); - windowsURLS.forEach(res => { - res.url = res.url.replace('beta', 'stable'); - }); - console.log('You have selected the STABLE branch.'); - } else { - console.log('Linux'); - linuxURLS.forEach(res => { - res.url = res.url.replace('beta', 'stable'); - }); - console.log('You have selected the STABLE branch.'); - } + branchSelection = 'release'; } if (parseInt(res) === 1) { - console.log('You have selected the BETA branch.'); + branchSelection = 'rc'; } if (parseInt(res) === 2) { - if (platform === 'windows') { - windowsURLS.forEach(res => { - res.url = res.url.replace('beta', 'alpha'); - }); - console.log('You have selected the STABLE branch.'); - } else { - linuxURLS.forEach(res => { - res.url = res.url.replace('beta', 'alpha'); - }); - console.log('You have selected the STABLE branch.'); - } + branchSelection === 'dev'; + } + + if (platform === 'windows') { + console.log('Windows'); + windowsURLS.forEach(res => { + res.url = res.url.replace('CHANGE_ME', branchSelection); + }); + console.log('You have selected the release branch.'); + } else { + console.log('Linux'); + linuxURLS.forEach(res => { + res.url = res.url.replace('CHANGE_ME', branchSelection); + }); + console.log('You have selected the release branch.'); } if (platform === 'windows') { diff --git a/server.log b/server.log deleted file mode 100644 index 9a5ce99..0000000 --- a/server.log +++ /dev/null @@ -1,7 +0,0 @@ -[06:54:41] alt:V Server, build #946, branch beta -[06:54:41] Starting alt:V Quick Start on 0.0.0.0:7788 -[06:54:41] Loading resource example -[06:54:41] The resource has now started! PogChamp -[06:54:41] Loaded resource example -[06:54:41] Starting HTTP server on 0.0.0.0:7788 -[06:54:41] Server started