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

Commit

Permalink
Increase Build Performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuyk committed Oct 12, 2023
1 parent b58c952 commit 41b8c37
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 8,212 deletions.
23 changes: 23 additions & 0 deletions .dependencygraph/setting.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"alias": {
"@AthenaServer/*": "src\\core\\server\\*",
"@AthenaClient/*": "src\\core\\client\\*",
"@AthenaShared/*": "src\\core\\shared\\*",
"@AthenaPlugins/*": "src\\core\\plugins\\*",
"@plugins/*": "src\\core\\plugins\\*",
"@utility/*": "src-webviews\\src\\utility\\*",
"@components/*": "src-webviews\\src\\components\\*",
"@ViewComponents/*": "src-webviews\\src\\components\\*",
"@ViewUtility/*": "src-webviews\\src\\utility\\*"
},
"resolveExtensions": [
".js",
".jsx",
".ts",
".tsx",
".vue",
".scss",
".less"
],
"entryFilePath": "\\src\\core\\index.ts"
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"stylus": "^0.58.1",
"typescript": "^5.2.2",
"vite": "^4.4.11",
"vite-plugin-monaco-editor": "^1.1.0",
"vue": "^3.3.4"
},
"dependencies": {
Expand Down
32 changes: 10 additions & 22 deletions scripts/runtime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ async function handleConfiguration() {
configName = 'devtest';
}

const start = Date.now();
let promises = [];

if (!passedArguments.includes('dev')) {
Expand Down Expand Up @@ -215,10 +214,17 @@ async function refreshFileWatching() {

async function coreBuildProcess() {
const start = Date.now();

await runFile(node, './scripts/compiler/core');
await runFile(node, './scripts/plugins/core');
await runFile(node, './scripts/plugins/webview');
await runFile(node, './scripts/plugins/files');

const promises = [
runFile(node, './scripts/plugins/webview'),
runFile(node, './scripts/transform/index'),
runFile(node, './scripts/plugins/files'),
];

await Promise.all(promises);
await runFile(node, './scripts/transform/index');
console.log(`Build Time - ${Date.now() - start}ms`);
}
Expand Down Expand Up @@ -252,7 +258,7 @@ async function runServer() {
await runFile(node, './scripts/plugins/update-dependencies');

if (isDev) {
await handleViteDevServer();
handleViteDevServer();
}

// Has to build first before building the rest.
Expand Down Expand Up @@ -282,22 +288,4 @@ if (passedArguments.includes('start')) {
}

runServer();

// process.stdin.on('data', (data) => {
// const result = data.toString().trim();
// if (result.charAt(0) !== '+' && result.charAt(0) !== '/') {
// console.log(`Use +help to see server maintenance commands. (This Console)`);
// console.log(`Use /commands to see server magagement commands. (The Game Console)`);
// if (!lastServerProcess.killed) {
// return;
// }

// lastServerProcess.send(data);
// return;
// }

// const inputs = result.split(' ');
// const cmdName = inputs.shift();
// console.log(cmdName, ...inputs);
// });
}
3 changes: 1 addition & 2 deletions src-webviews/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { defineConfig } from 'vite';
import * as path from 'path';
import vue from '@vitejs/plugin-vue';
import monacoEditorPlugin from 'vite-plugin-monaco-editor';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), monacoEditorPlugin['default']({ languageWorkers: ['typescript'] })],
plugins: [vue()],
base: './',
build: {
outDir: '../resources/webviews',
Expand Down
43 changes: 0 additions & 43 deletions src/core/plugins/athena-debug/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,22 @@
import * as alt from 'alt-client';
import * as native from 'natives';
import * as AthenaClient from '@AthenaClient/api';

import { ATHENA_DEBUG_EVENTS } from '../shared/events';
import { onTicksStart } from '@AthenaClient/events/onTicksStart';

const F1_KEY = 112;
let page: AthenaClient.webview.Page;

function init() {
if (!alt.debug) {
return;
}

page = new AthenaClient.webview.Page({
name: 'Editor',
callbacks: { onReady() {}, onClose() {} },
options: {
disableEscapeKey: true,
onOpen: {
blurBackground: true,
disableControls: 'all',
disablePauseMenu: true,
focus: true,
hideHud: true,
hideOverlays: true,
setIsMenuOpenToTrue: true,
showCursor: true,
},
onClose: {
enableControls: true,
enablePauseMenu: true,
hideCursor: true,
setIsMenuOpenToFalse: true,
showHud: true,
showOverlays: true,
unblurBackground: true,
unfocus: true,
},
},
});

alt.on('keyup', (key: number) => {
if (key !== F1_KEY) {
return;
}

alt.emitServer(ATHENA_DEBUG_EVENTS.ClientToServer.FORWARD);
});

alt.onServer(ATHENA_DEBUG_EVENTS.toClient.exec, (code: string) => {
eval(code);
});

AthenaClient.webview.on(ATHENA_DEBUG_EVENTS.toClient.closePage, () => {
page.close(true);
});

alt.onServer(ATHENA_DEBUG_EVENTS.toClient.openExec, () => {
page.open();
});
}

onTicksStart.add(init);
21 changes: 0 additions & 21 deletions src/core/plugins/athena-debug/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,11 @@ import { ATHENA_DEBUG_EVENTS } from '../shared/events';

const PLUGIN_NAME = 'athena-debug';

function handleExec(player: alt.Player, type: string, code: string) {
if (type === 'server') {
eval(code);
return;
}

player.emit(ATHENA_DEBUG_EVENTS.toClient.exec, code);
}

Athena.systems.plugins.registerPlugin(PLUGIN_NAME, () => {
if (!alt.debug) {
return;
}

RestService.init();
DebugKeys.init();

const restrictedFunction = Athena.utility.restrict.create(handleExec, {
permissions: { account: ['admin'], character: [] },
strategy: 'hasOne',
notify: 'No permission to perform code execution.',
});

alt.onClient(ATHENA_DEBUG_EVENTS.toServer.exec, restrictedFunction);

Athena.commands.register('editor', '/editor', ['admin'], (player: alt.Player) => {
player.emit(ATHENA_DEBUG_EVENTS.toClient.openExec);
});
});
8 changes: 0 additions & 8 deletions src/core/plugins/athena-debug/shared/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@ export const ATHENA_DEBUG_EVENTS = {
ClientToServer: {
FORWARD: 'athena-debug-event-send-data',
},
toClient: {
closePage: 'athena-debug-close-page',
exec: 'athena-debug-exec-code',
openExec: 'athena-debug-exec-page',
},
toServer: {
exec: 'athena-debug-exec-code-server',
},
};
Loading

0 comments on commit 41b8c37

Please sign in to comment.