Skip to content

Commit

Permalink
Update Depencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuyk committed Apr 22, 2020
1 parent 5ed8a76 commit 17de96a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 65 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ data
altv-server.exe
libnode.dll
package-lock.json
update.json
update.json
server.log
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/#/)
Expand All @@ -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
Expand Down Expand Up @@ -112,7 +116,3 @@ import * as alt from 'alt-server'
/// <reference types="@altv/types" />
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**.
89 changes: 39 additions & 50 deletions install.js
Original file line number Diff line number Diff line change
@@ -1,73 +1,69 @@
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'
};

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'
},
{
Expand Down Expand Up @@ -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') {
Expand Down
7 changes: 0 additions & 7 deletions server.log

This file was deleted.

0 comments on commit 17de96a

Please sign in to comment.