Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
5.3.0 - Update to alt:V v15
Browse files Browse the repository at this point in the history
* Tracking Branch for v15

* Remove Dead Enums

* Remove V2 Module Snippet

* Update Config / Resource Builder to TOML Only

* change exported barrel files

* Change Exports to Imports

* upgrade item drops to v15, faster boot times

* ignore some files

* Patch CTRL+C Issue

* Fix CTRL + C Issue 100%

* Local Object, Global Object Changes

* Remove Dead Code

* Update to Global Blip API

* Virtual Entities for Text Labels

* Markers Updated to Virtual Entities

* Update World Notifications to Virtual Entities

* Fix Type Issue

* Static Peds Update

* Persistent Ammo

* Add Missing Dimension Setters for Controllers

* Remove File Transformer, Require .js Extension on Imports

* Update Changelog

* Update-Dependencies.js Refactored + Github Dependencies added (#445)

* Initial (Dependencies) Fix

* Add github dependencies for plugins.

* Update Dependencie Script.

* Update / Refactor Update-Dependencies Script

* Remove disable log

* Check if URL is valid (GitHub)

* Update Dependencie Script

* Remove logs

* fix windows startup

* Shave 300ms off startup time

* Update Transpilation Scripts. (#449)

* Remove Streaming Service

* remove altv-config

---------

Co-authored-by: Der Lord! <[email protected]>
  • Loading branch information
Stuyk and Booster1212 committed Oct 20, 2023
1 parent 50e755f commit e8da1d2
Show file tree
Hide file tree
Showing 364 changed files with 2,688 additions and 2,808 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ yarn.lock
resources/core/**
resources/webviews/**

typedefs.d.ts
typedefs.d.ts

.server-crashes-cache/
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## 5.3.0
```
- Update configs, and resource builder to toml only
- Upgrade item drops to use alt.Object
- Increase boot times
- Patch CTRL+C Issue
- Update global objects to use alt.Object
- Update client-side objects to use alt.LocalObject
- Update Blips to Global Blip API
- Update TextLabels to Virtual Entities
- Update Markers to Virtual Entities
- Update World Notifications to Virtual Entities
- Update StaticPeds with additional functionality
--- Peds Follow Player
--- Peds Unfollow Player
--- Peds Get Into Vehicle
--- Peds Exit Vehicle
--- Peds Animate
--- Peds Goto Position
- Update Ammo System to New APIs with Persistent Ammo Solution
- Remove automatic import transformer, require .js extensions in all imports now
- Shaved over 300ms off startup time
- Update Doors to Virtual Entities
- Removed Streaming Service (Bye Bye)
- Removed Streaming Service Scripts
- Removed Streaming Service Process
```

## 5.2.0

```
Expand Down
30 changes: 0 additions & 30 deletions configs/dev.json

This file was deleted.

18 changes: 18 additions & 0 deletions configs/dev.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name = "Development Mode - Vue Debug - 1 Player"
host = "0.0.0.0"
env = "dev"
port = 7788
players = 2
announce = false
gamemode = "Roleplay"
website = "athenaframework.com"
language = "en"
description = "With Reconnect On - Vue Debug - 1 Player Only"
debug = true
streamingDistance = 400
migrationDistance = 150
modules = ["js-module"]
resources = ["core"]
tags = ["athena","framework","version",""]
vue-athena = true
log-streams = ["console", "file", "console", "stdconsole"]
30 changes: 0 additions & 30 deletions configs/devtest.json

This file was deleted.

17 changes: 17 additions & 0 deletions configs/devtest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name = "Development Mode - No Vue - 32 Players"
host = "0.0.0.0"
env = "devtest"
port = 7788
players = 2
announce = false
gamemode = "Roleplay"
website = "athenaframework.com"
language = "en"
description = "With Reconnect On - 32 Players"
debug = true
streamingDistance = 400
migrationDistance = 150
modules = ["js-module"]
resources = ["webviews", "core"]
tags = ["athena","framework","version","5"]
log-streams = ["console", "file", "stdconsole"]
45 changes: 0 additions & 45 deletions configs/prod.json

This file was deleted.

22 changes: 22 additions & 0 deletions configs/prod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name = "Athena"
host = "0.0.0.0"
env = "prod"
port = 7788
players = 512
announce = false
gamemode = "Roleplay"
website = "athenaframework.com"
language = "en"
description = "With Reconnect On - Vue Debug - 1 Player Only"
debug = false
useCdn = false
useEarlyAuth = false
streamingDistance = 400
migrationDistance = 150
modules = ["js-module"]
resources = ["webviews", "core"]
tags = ["athena","framework","version","5"]
log-streams = ["console", "file", "stdconsole"]

[voice]
bitrate = 64000
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "altv-athena",
"version": "5.2.0",
"version": "5.3.0",
"description": "a roleplay framework for alt:V",
"author": "stuyk",
"type": "module",
Expand Down Expand Up @@ -30,7 +30,6 @@
"@altv/types-webview": "^1.0.7",
"@altv/types-worker": "1.0.7",
"@babel/types": "^7.17.0",
"@stuyk/altv-config": "4.0.1",
"@swc/cli": "0.1.62",
"@swc/core": "1.3.92",
"@types/minimatch": "^3.0.5",
Expand Down
37 changes: 20 additions & 17 deletions scripts/buildresource/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@ import path from 'path';
import { sanitizePath } from '../shared/path.js';
import { globSync, writeFile } from '../shared/fileHelpers.js';

const scriptPath = sanitizePath(path.join(process.cwd(), '/scripts/buildresource/resource.json'));
const defaults = {
type: 'js',
main: 'server/startup.js',
'client-main': 'client/startup.js',
'client-files': ['client/*', 'shared/*'],
deps: [],
'required-permissions': ['Screen Capture'],
};

async function getClientPluginFolders() {
const scriptPath = sanitizePath(path.join(process.cwd(), './resources/core/resource.toml'));

function getClientPluginFolders() {
const removalPath = sanitizePath(path.join(process.cwd(), 'src/core/'));
const results = globSync(sanitizePath(path.join(process.cwd(), `src/core/plugins/**/@(client|shared)`))).map(
(fileName) => {
Expand All @@ -23,10 +15,21 @@ async function getClientPluginFolders() {
return results;
}

async function start() {
const folders = await getClientPluginFolders();
defaults['client-files'] = [...defaults['client-files'], ...folders];
writeFile(scriptPath, JSON.stringify(defaults, null, '\t'));
}
export function buildResources() {
let defaultToml =
"type = 'js' \r\n" +
"main = 'server/startup.js' \r\n" +
"client-main = 'client/startup.js' \r\n" +
"required-permissions = ['Screen Capture'] \r\n" +
"client-files = ['client/*', 'shared/*', \r\n";

const folders = getClientPluginFolders();

start();
for (let folder of folders) {
defaultToml += `"${folder}", \r\n`;
}

defaultToml += ']';

writeFile(scriptPath, defaultToml);
}
65 changes: 46 additions & 19 deletions scripts/compiler/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { sanitizePath } from '../shared/path.js';

const viablePluginDisablers = ['disable.plugin', 'disabled.plugin', 'disable'];

let filesFailedToCompile = [];

function getEnabledPlugins() {
const pluginFolder = getPluginFolder();
const pluginFolders = getAllPluginFolders();
Expand Down Expand Up @@ -89,26 +91,37 @@ function resolvePaths(file, rawCode) {
*/
async function transpileFile(file) {
const targetPath = file.replace('src/', 'resources/').replace('.ts', '.js');
const result = await swc.transformFile(file, {
jsc: {
parser: {
syntax: 'typescript',
dynamicImport: true,
decorators: true,
},
transform: {
legacyDecorator: true,
decoratorMetadata: true,
let result;

try {
result = await swc.transformFile(file, {
jsc: {
parser: {
syntax: 'typescript',
dynamicImport: true,
decorators: true,
},
transform: {
legacyDecorator: true,
decoratorMetadata: true,
},
target: 'es2020',
},
target: 'es2020',
},
sourceMaps: false,
});
sourceMaps: false,
});
} catch (err) {
console.log(err);
filesFailedToCompile.push(file);
}

if (!result) {
console.warn(`Failed to compile: ${targetPath}`);
}

if (!result || !result.code) {
return;
}

// The path resolvers are really awful, so writing a custom one here.
if (result.code.includes('@Athena')) {
result.code = resolvePaths(file, result.code);
Expand All @@ -118,14 +131,22 @@ async function transpileFile(file) {
writeFile(targetPath, finalFile);
}

async function run() {
/**
* Transpiles all files and plugins
*
* @returns {Promise<void>}
* @export
*/
export async function runCoreCompiler() {
filesFailedToCompile = [];

const enabledPlugins = getEnabledPlugins();

const filesToTranspile = getFilesForTranspilation(enabledPlugins);
const filesToCopy = getFilesToCopy(enabledPlugins);

const resourcesFolder = sanitizePath(path.join(process.cwd(), 'resources')).replace(/\\/g, '/');
const filesAndDirectories = await fs.readdirSync(resourcesFolder);
const filesAndDirectories = fs.readdirSync(resourcesFolder);

for (const fileOrDirectory of filesAndDirectories) {
const fullPath = sanitizePath(path.join(resourcesFolder, fileOrDirectory)).replace(/\\/g, '/');
Expand All @@ -134,7 +155,7 @@ async function run() {
}

if (fs.statSync(fullPath).isDirectory()) {
await fs.rmSync(fullPath, { recursive: true, force: true });
fs.rmSync(fullPath, { recursive: true, force: true });
}
}

Expand All @@ -149,6 +170,12 @@ async function run() {

const promises = filesToTranspile.map((file) => transpileFile(file));
await Promise.all(promises);
}

run();
if (filesFailedToCompile.length >= 1) {
for (let uncompiledFilePath of filesFailedToCompile) {
console.log(uncompiledFilePath);
}

throw new Error(`Failed to transpile ${filesFailedToCompile.length} files`);
}
}
Loading

0 comments on commit e8da1d2

Please sign in to comment.