diff --git a/apps/cef/.eslintrc.cjs b/apps/browser/.eslintrc.cjs similarity index 100% rename from apps/cef/.eslintrc.cjs rename to apps/browser/.eslintrc.cjs diff --git a/apps/cef/index.html b/apps/browser/index.html similarity index 100% rename from apps/cef/index.html rename to apps/browser/index.html diff --git a/apps/cef/package.json b/apps/browser/package.json similarity index 79% rename from apps/cef/package.json rename to apps/browser/package.json index e16d3d4..63b2b89 100644 --- a/apps/cef/package.json +++ b/apps/browser/package.json @@ -1,10 +1,10 @@ { - "name": "rage-fw-example-cef", + "name": "rage-fw-example-browser", "version": "0.0.0", "type": "module", "author": "Entity Seven Group", - "license": "CC BY-ND", - "description": "CEF side of rage-fw example", + "license": "MIT", + "description": "Browser side of rage-fw-example", "scripts": { "dev": "vite", "build": "tsc && vite build", @@ -12,9 +12,9 @@ "preview": "vite preview" }, "dependencies": { + "@entityseven/rage-fw-browser": "0.2.0", "react": "^18.2.0", - "react-dom": "^18.2.0", - "rage-fw-cef": "latest" + "react-dom": "^18.2.0" }, "devDependencies": { "@types/react": "^18.2.66", diff --git a/apps/cef/public/vite.svg b/apps/browser/public/vite.svg similarity index 100% rename from apps/cef/public/vite.svg rename to apps/browser/public/vite.svg diff --git a/apps/browser/src/App.tsx b/apps/browser/src/App.tsx new file mode 100644 index 0000000..0d9e5de --- /dev/null +++ b/apps/browser/src/App.tsx @@ -0,0 +1,28 @@ +import { fw } from '@entityseven/rage-fw-browser' +import { useEffect, useState } from 'react' + +function App() { + const [data, setData] = useState('initial') + + useEffect(() => { + fw.event.register('customBrowserEvent', async message => { + setData(p => p + ' | ' + message) + + const response = await fw.event.triggerServer('customServerEvent', [ + 'hello from browser', + ]) + setData(p => p + ' | ' + response) + + return 'response from browser' + }) + }, []) + + return ( +
+

Hello World!

+

{data}

+
+ ) +} + +export default App diff --git a/apps/cef/src/assets/react.svg b/apps/browser/src/assets/react.svg similarity index 100% rename from apps/cef/src/assets/react.svg rename to apps/browser/src/assets/react.svg diff --git a/apps/cef/src/index.css b/apps/browser/src/index.css similarity index 100% rename from apps/cef/src/index.css rename to apps/browser/src/index.css diff --git a/apps/cef/src/main.tsx b/apps/browser/src/main.tsx similarity index 100% rename from apps/cef/src/main.tsx rename to apps/browser/src/main.tsx diff --git a/apps/cef/src/vite-env.d.ts b/apps/browser/src/vite-env.d.ts similarity index 100% rename from apps/cef/src/vite-env.d.ts rename to apps/browser/src/vite-env.d.ts diff --git a/apps/cef/tsconfig.json b/apps/browser/tsconfig.json similarity index 100% rename from apps/cef/tsconfig.json rename to apps/browser/tsconfig.json diff --git a/apps/cef/tsconfig.node.json b/apps/browser/tsconfig.node.json similarity index 100% rename from apps/cef/tsconfig.node.json rename to apps/browser/tsconfig.node.json diff --git a/apps/cef/vite.config.ts b/apps/browser/vite.config.ts similarity index 100% rename from apps/cef/vite.config.ts rename to apps/browser/vite.config.ts diff --git a/apps/cef/src/App.tsx b/apps/cef/src/App.tsx deleted file mode 100644 index f6b0b54..0000000 --- a/apps/cef/src/App.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { fw } from 'rage-fw-cef' -import { useEffect, useState } from 'react' - -function App() { - const [data, setData] = useState('') - - useEffect(() => { - fw.event.register('customCefEvent', ([test]) => { - setData(test) - return 'response from cef' - }) - }, []) - - return ( - <> -

Hello World!

-

{data}

- - ) -} - -export default App diff --git a/apps/shared/declarations/rage-fw-shared-types/index.d.ts b/apps/shared/declarations/rage-fw-shared-types/index.d.ts index 09030d4..71c52e1 100644 --- a/apps/shared/declarations/rage-fw-shared-types/index.d.ts +++ b/apps/shared/declarations/rage-fw-shared-types/index.d.ts @@ -1,13 +1,13 @@ -declare module 'rage-fw-shared-types' { +declare module '@entityseven/rage-fw-shared-types' { export interface RageFW_ICustomClientEvent { - customClientEvent(greetings: string): Promise + customClientEvent(greetings: string): string } export interface RageFW_ICustomServerEvent { customServerEvent(greetings: string): string } - export interface RageFW_ICustomCefEvent { - customCefEvent(greetings: string): string + export interface RageFW_ICustomBrowserEvent { + customBrowserEvent(greetings: string): string } } diff --git a/package.json b/package.json index fb77fdf..b1846c9 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,7 @@ { "name": "framework-example", - "version": "0.1.0", - "author": "Entity Seven Group", - "license": "CC BY-ND", "description": "This project is example of RAGE FW usage.", + "workspaces": ["apps/*"], "scripts": { "server:update": "cd server && rage-win64.exe", "build:client": "cd apps/client && pnpm build", @@ -12,12 +10,15 @@ "build:all": "pnpm build:client && pnpm build:server && pnpm build:cef" }, "devDependencies": { + "@entityseven/rage-fw-shared-types": "0.2.0", "@ragempcommunity/types-client": "^2.1.8", "@ragempcommunity/types-server": "^2.1.8", "@ragempcommunity/types-cef": "^2.1.8", - "rage-fw-shared-types": "latest", "esbuild": "^0.21.5", "typescript": "^5.4.5", "prettier": "^3.3.2" - } + }, + "author": "Entity Seven Group", + "license": "MIT", + "version": "0.1.0" } diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 1aaea1b..6e78735 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,5 +1,5 @@ packages: - - "apps/cef" + - "apps/browser" - "apps/client" - "apps/server" - "apps/shared" \ No newline at end of file diff --git a/server/conf.json b/server/conf.json index 5ced364..1cf5028 100644 --- a/server/conf.json +++ b/server/conf.json @@ -1,9 +1,10 @@ { "maxplayers" : 100, - "name" : "RAGE FW Server powered by Entity Seven Group", + "name" : "RageFW Example Server. Powered by Entity Seven Group", "gamemode" : "freeroam", "stream-distance" : 300.0, "announce" : false, "csharp" : "disabled", + "allow-cef-debugging": true, "port": 22005 } \ No newline at end of file