working client & server

This commit is contained in:
erik-sn committed 2020-10-07 16:11:00 -04:00
1 parent cff746aa38
commit 845d4acd3a
13 files changed
+4008 -4

No files matched your search

+4 -2
View File
@@ -6,7 +6,8 @@ author { "chip", "BTNGaming", "ROCKY_southpaw" }
client_script {
'@es_extended/locale.lua',
'resources/locales/*.lua',
'resources/client/*lua'
'resources/client/*lua',
'resources/dist/client/*.client.js'
}
shared_script {
@@ -17,7 +18,8 @@ server_script {
"@mysql-async/lib/MySQL.lua",
'@es_extended/locale.lua',
'resources/locales/*.lua',
'resources/server/*.lua'
'resources/server/*.lua',
'resources/dist/server/*.server.js'
}
ui_page 'resources/html/index.html'
+1 -1
View File
@@ -15,7 +15,7 @@
"emoji-mart": "^3.0.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"husky": "^4.2.5",
"husky": "4.2.5",
"i18next": "^19.7.0",
"prettier": "^2.0.5",
"react": "^16.13.1",
+1 -1
View File
@@ -6058,7 +6058,7 @@ https-browserify@^1.0.0:
resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73"
integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=
husky@^4.2.5:
[email protected]:
version "4.2.5"
resolved "https://registry.yarnpkg.com/husky/-/husky-4.2.5.tgz#2b4f7622673a71579f901d9885ed448394b5fa36"
integrity sha512-SYZ95AjKcX7goYVZtVZF2i6XiZcHknw50iXvY7b0MiGoj5RwdgRQNEHdb+gPDPCXKlzwrybjFjkL6FOj8uRhZQ==
+4
View File
@@ -0,0 +1,4 @@
.vscode
dist/
node_modules/
yarn-error.log
+6
View File
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": false
}
+7
View File
@@ -0,0 +1,7 @@
setImmediate(() => {
emitNet("helloserver");
});
onNet("helloclient", (message) => {
console.log(`The server replied: ${message}`);
});
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": ["types/*"]
},
"outDir": "./",
"noImplicitAny": false,
"module": "commonjs",
"target": "es6",
"allowJs": true,
"lib": ["es2017"],
"types": ["@citizenfx/client", "@types/node"],
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": ["./**/*"],
"exclude": ["**/node_modules", "**/__tests__/*"]
}
+1
View File
@@ -0,0 +1 @@
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(e){e(()=>{emitNet("helloserver")}),onNet("helloclient",e=>{console.log("The server replied: "+e)})}).call(this,n(2).setImmediate)},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(3),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,c,u,a=1,l={},s=!1,f=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(c="setImmediate$"+Math.random()+"$",u=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(c)&&p(+t.data.slice(c.length))},e.addEventListener?e.addEventListener("message",u,!1):e.attachEvent("onmessage",u),r=function(t){e.postMessage(c+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var o={callback:e,args:t};return l[a]=o,r(a),a++},d.clearImmediate=m}function m(e){delete l[e]}function p(e){if(s)setTimeout(p,0,e);else{var t=l[e];if(t){s=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{m(e),s=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(0),n(4))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:c}catch(e){r=c}}();var a,l=[],s=!1,f=-1;function d(){s&&a&&(s=!1,a.length?l=a.concat(l):f=-1,l.length&&m())}function m(){if(!s){var e=u(d);s=!0;for(var t=l.length;t;){for(a=l,l=[];++f<t;)a&&a[f].run();f=-1,t=l.length}a=null,s=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===c||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function h(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arLine truncated
+34
View File
@@ -0,0 +1,34 @@
{
"name": "new-phone-who-dis-node",
"version": "0.1.0",
"description": "Resources configuration",
"main": "index.js",
"repository": "https://github.com/Re-Ignited-Development/new-phone-who-dis",
"author": "",
"scripts": {
"build": "webpack --mode production",
"format": "prettier --write \"src/**/*.ts\"",
"watch": "webpack --mode development --watch true"
},
"license": "MIT",
"private": false,
"dependencies": {
"@citizenfx/client": "^1.0.2792-1",
"@citizenfx/server": "^1.0.2792-1",
"@types/node": "^14.0.27",
"fivem-js": "^1.3.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^4.4.0",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",
"eslint-loader": "^4.0.2",
"prettier": "^2.0.5",
"remove-files-webpack-plugin": "^1.4.3",
"ts-loader": "^8.0.2",
"typescript": "^3.9.7",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
}
}
+8
View File
@@ -0,0 +1,8 @@
onNet("helloserver", () => {
const _source = (global as any).source;
const test = (x) => x;
console.log(`Hello from ${_source}`);
emitNet("helloclient", _source, "i got your message!");
});
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": ["types/*"]
},
"outDir": "./",
"noImplicitAny": false,
"module": "commonjs",
"target": "es6",
"allowJs": false,
"lib": ["es2017"],
"types": ["@citizenfx/server", "@types/node"],
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": ["./**/*"],
"exclude": ["**/node_modules", "**/__tests__/*"]
}
+75
View File
@@ -0,0 +1,75 @@
const webpack = require("webpack");
const path = require("path");
const RemovePlugin = require("remove-files-webpack-plugin");
const buildPath = path.resolve(__dirname, "dist");
const server = {
entry: "./server/server.ts",
module: {
rules: [
{
test: /\.tsx?$/,
use: ["ts-loader"],
exclude: /node_modules/,
},
],
},
plugins: [
new webpack.DefinePlugin({ "global.GENTLY": false }),
new RemovePlugin({
before: {
include: [path.resolve(buildPath, "server")],
},
watch: {
include: [path.resolve(buildPath, "server")],
},
}),
],
optimization: {
minimize: true,
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
output: {
filename: "[contenthash].server.js",
path: path.resolve(buildPath, "server"),
},
target: "node",
};
const client = {
entry: "./client/client.ts",
module: {
rules: [
{
test: /\.tsx?$/,
use: ["ts-loader"],
exclude: /node_modules/,
},
],
},
plugins: [
new RemovePlugin({
before: {
include: [path.resolve(buildPath, "client")],
},
watch: {
include: [path.resolve(buildPath, "client")],
},
}),
],
optimization: {
minimize: true,
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
output: {
filename: "[contenthash].client.js",
path: path.resolve(buildPath, "client"),
},
};
module.exports = [server, client];
+3825
View File
File diff suppressed because it is too large. Load diff