fiverunner 0.9.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,19 +6,29 @@
6
6
 
7
7
  <p align="center">Run FiveM resources in your browser and in CI.<br>No GTA V, no FXServer, no restarts.</p>
8
8
 
9
- > **Status:** early development. `npx fiverunner test` runs the Lua tests of FiveM resources in Node, and `npx fiverunner dev` runs resources and their NUI in your browser. Watch the repository to follow along.
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/fiverunner"><img src="https://img.shields.io/npm/v/fiverunner" alt="Version on npm"></a>
11
+ <a href="https://github.com/DariusHQ/fiverunner/actions/workflows/ci.yml"><img src="https://github.com/DariusHQ/fiverunner/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
12
+ <a href="https://github.com/DariusHQ/fiverunner/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/fiverunner" alt="License"></a>
13
+ </p>
14
+
15
+ > Where a resource behaves differently than in FiveM, [tell us](https://github.com/DariusHQ/fiverunner/issues/new/choose).
10
16
 
11
17
  ![The appearance editor of illenium-appearance on the screen of a player, over a cartoon meadow where her little character wears what the editor picks](docs/media/appearance.png)
12
18
 
13
19
  **[Watch the demo](https://github.com/DariusHQ/fiverunner/releases/download/v0.9.0/fiverunner.mp4)** (122 seconds, with sound): the whole Stable recipe of Qbox for txAdmin, tested, then in the dev UI, where a player registers a character, dresses her in illenium-appearance, opens ox_inventory and the bank of Renewed-Banking, and is dragged across the map to a garage, where she takes her car out.
14
20
 
21
+ **[Try it in your browser](https://dariushq.github.io/fiverunner/)**: a small city, in Lua and JavaScript, that runs in the page, with nothing to install. Edit its files, press Run, and walk around it.
22
+
15
23
  ```bash
16
24
  npx fiverunner test
17
25
  npx fiverunner dev
18
26
  ```
19
27
 
20
- - **Real resources, as they are released.** The 43 resources of the Stable recipe of Qbox start on your machine in seconds: its core, its inventory, its garages, its bank.
21
- - **Real NUIs.** Your pages run in a browser, and talk to your callbacks as they do in FiveM: the appearance editor, the inventory and the bank of the recipe work as players use them.
28
+ Run them with Node 22 or later, in the folder of a resource or of a server, the one with `server.cfg` and `resources`. A script that needs a framework runs in the folder of its server, next to the framework.
29
+
30
+ - **Real resources, as they are released.** The 43 resources of the Stable recipe of Qbox start on your machine in seconds: its core, its inventory, its garages, its bank, and its phone, which is JavaScript.
31
+ - **Real NUIs.** Your pages run in a browser, and talk to your callbacks as they do in FiveM: the appearance editor, the inventory, the bank and the phone of the recipe work as players use them.
22
32
  - **Tests in CI.** Each test gets a server of its own, players, and a database in memory, and time moves as fast as it can.
23
33
  - **A world to look at.** Under the frames of NUI, the screen of each player shows the world round their ped, as a cartoon or in the style of GTA V, and the cartoon dresses them as your scripts do.
24
34
 
@@ -50,7 +60,7 @@ npx fiverunner test
50
60
 
51
61
  ![The tests of QBox, passing in a terminal](docs/media/tests.png)
52
62
 
53
- Each test gets a server of its own, with your resources started, and players whose clients run your client scripts. Resources that use oxmysql get a database of their own, in memory, that speaks MariaDB's SQL and starts with the tables of your `.sql` files. Time moves as fast as it can, so tests that wait take no time. [docs/testing.md](docs/testing.md) tells all that tests can do, and [examples/bank](examples/bank) is a resource with tests.
63
+ Each test gets a server of its own, with your resources started, and players whose clients run your client scripts. Resources that use oxmysql get a database of their own, in memory, that speaks MariaDB's SQL and starts with the tables of your `.sql` files. Time moves as fast as it can, so tests that wait take no time. `--coverage` writes the lines of Lua that they ran, for lcov, and `--junit` a report for your CI. [docs/testing.md](docs/testing.md) tells all that tests can do, and [examples/bank](examples/bank) is a resource with tests.
54
64
 
55
65
  ## Developing resources
56
66
 
@@ -60,19 +70,25 @@ Run your project in your browser:
60
70
  npx fiverunner dev
61
71
  ```
62
72
 
63
- The dev UI has the console of your server, where you run commands, its resources, which you start, stop and restart, the events that the server and the players send each other, which you trigger too, its state bags, and a map of its entities and of the blips of the players, classic, as a cartoon or in the style of GTA V, where you drag players to move them. Connect players, whose clients run your client scripts, each with a screen that shows the frames of its NUI over the world round their ped: click through your pages, which talk to your callbacks as they do in FiveM. As you save files, the dev UI restarts the resources that they belong to, and the players stay. [docs/dev.md](docs/dev.md) tells all that it does.
73
+ The dev UI has the console of your server, where you run commands, its resources, which you start, stop and restart, the events that the server and the players send each other, which you trigger too, its state bags, an inspector of what each resource has and of the time it takes, with a box that runs code inside it, and a map of its entities and of the blips of the players, classic, as a cartoon or in the style of GTA V, where you drag players to move them. Connect players, whose clients run your client scripts, each with a screen that shows the frames of its NUI over the world round their ped: click through your pages, which talk to your callbacks as they do in FiveM, and walk or drive with W, A, S and D. As you save files, the dev UI restarts the resources that they belong to, and the players stay. [docs/dev.md](docs/dev.md) tells all that it does, and [examples/city](examples/city) is a small server to play it on: citizens move in through a card, buy food, take a car out, and write to each other on a phone in JavaScript.
64
74
 
65
75
  ![The Stable recipe of Qbox in the dev UI: the console of its server, the events that its player sent, its resources and state bags, and the map of its world](docs/media/dev-ui.png)
66
76
 
77
+ ![The inspector of the dev UI: the resources of the server, with the time that each takes, the exports, events and commands of Renewed-Banking, and the convars of the server](docs/media/inspector.png)
78
+
67
79
  ![The map of the dev UI in the style of the pause menu of GTA V: the blips that the resources of Qbox put on the map of a player, with its header, a legend and its buttons](docs/media/map-gta.png)
68
80
 
69
81
  ![The map of the dev UI as a cartoon: the blips of Qbox as the tokens of a board game, on a meadow with trees](docs/media/map-cartoon.png)
70
82
 
71
83
  ## Frameworks
72
84
 
73
- QBox and ESX run on FiveRunner: CI runs qbx_core, ox_lib, ox_inventory, qbx_vehicles and es_extended, as they are released, on every change, with players who log in, earn money, carry items, get jobs and are saved as they leave. [docs/compatibility.md](docs/compatibility.md) lists what passes.
85
+ QBCore, QBox and ESX run on FiveRunner: CI runs them, as they are released, on every change, with players who log in, earn money, carry items, get jobs and are saved as they leave. [docs/compatibility.md](docs/compatibility.md) lists what passes.
74
86
 
75
- So does the whole Stable recipe of Qbox for txAdmin, with its 43 resources: they start without errors but those of npwd, whose phone is JavaScript, which FiveRunner does not run. A player takes a car out of a garage of qbx_garages, picks clothes in illenium-appearance, and opens ox_inventory and the bank of Renewed-Banking, as [its tests](compat/qbox-stable/tests/recipe.test.lua) check, which CI runs on every change on all of its resources but npwd and screencapture.
87
+ The whole recipe of QBCore for txAdmin runs too, with its 72 resources, without errors. A player creates a character in qb-multicharacter, picks where to start in qb-spawn, gets dressed in qb-clothing, opens qb-inventory and qb-banking, and takes a car out of qb-garages, with what the database keeps of it, as [its tests](compat/qbcore/tests/qbcore.test.lua) check.
88
+
89
+ ![The first clothes of a character in qb-clothing, with the HUD of qb-hud, on the screen of a player, over a cartoon meadow by the apartment that she picked](docs/media/qbcore.png)
90
+
91
+ So does the whole Stable recipe of Qbox for txAdmin, with its 43 resources, without errors. A player takes a car out of a garage of qbx_garages, picks clothes in illenium-appearance, opens ox_inventory and the bank of Renewed-Banking, and keeps a contact in the phone of npwd, whose server is JavaScript that talks to the database with its own mysql2, as [its tests](compat/qbox-stable/tests/recipe.test.lua) check, which CI runs on every change.
76
92
 
77
93
  ![The character registration of QBox, from the NUI of ox_lib, on the screen of a player in the dev UI](docs/media/qbox-registration.png)
78
94
 
@@ -82,14 +98,14 @@ So does the whole Stable recipe of Qbox for txAdmin, with its 43 resources: they
82
98
 
83
99
  ![The bank of Renewed-Banking on the screen of a player, with her personal account and her balance](docs/media/bank.png)
84
100
 
85
- ## Planned
86
-
87
- - A playground in the browser, which runs resources without installing anything.
101
+ ![The phone of npwd, with its apps, on the screen of a player, over a cartoon meadow where her little character stands](docs/media/phone.png)
88
102
 
89
103
  ## How it works
90
104
 
91
105
  Your scripts run on CfxLua, the Lua 5.4 runtime FiveM ships, compiled to WebAssembly: the same syntax extensions, vectors and quaternions, `json` and `msgpack`. Each resource gets its own Lua state, one per side and per player, the same isolation FiveM gives you. On top of that, FiveRunner reimplements the Cfx scripting runtime: events with `source` and net-safety, exports, function references, state bags, threads and `Wait`, and the natives API.
92
106
 
107
+ JavaScript runs on QuickJS, compiled to WebAssembly too, in a context for each resource on each side, with the globals of FiveM's runtime: `on`, `emit`, `exports`, `setTick` and the natives by their names. Servers also give it what bundles ask of Node, such as `require`, `Buffer` and `fs`, and the drivers of MySQL that resources carry reach FiveRunner's database on its port.
108
+
93
109
  Servers also get FiveM's own `io` and `os` libraries, its VFS and file permissions, its HTTP client and server, its server variables and its console, and oxmysql, whose exports run on SQLite, which FiveRunner teaches MariaDB's SQL.
94
110
 
95
111
  ## Differences from FiveM
@@ -98,7 +114,11 @@ FiveRunner follows FiveM's Windows server and its clients down to their error me
98
114
 
99
115
  ## Clean room
100
116
 
101
- FiveRunner's scripting runtime is a clean-room implementation and contains no code from the FiveM platform. CfxLua and its libraries are open source; see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). FiveRunner is not affiliated with or endorsed by Cfx.re, Rockstar Games or Take-Two Interactive.
117
+ FiveRunner's scripting runtime is a clean-room implementation and contains no code from the FiveM platform. CfxLua, QuickJS and their libraries are open source; see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). FiveRunner is not affiliated with or endorsed by Cfx.re, Rockstar Games or Take-Two Interactive.
118
+
119
+ ## Contributing
120
+
121
+ Resources that behave differently than in FiveM help most. [CONTRIBUTING.md](CONTRIBUTING.md) tells how to report them, how to run FiveRunner from its source, and the rules of its clean room. [CHANGELOG.md](CHANGELOG.md) tells what each version brought.
102
122
 
103
123
  ## License
104
124
 
@@ -8,7 +8,8 @@ Every script runtime also loads one Lua library, [lua-promises](#lua-promises).
8
8
  catalog of FiveM natives is generated from the
9
9
  [CitizenFX typings](#citizenfx-typings), and the types of the files NUI serves from the
10
10
  [mime](#mime) package. The database of FiveRunner's oxmysql is
11
- [SQLite](#sqlite-and-sqlite-wasm). The dev UI gives the pages of frames [jQuery](#jquery) at
11
+ [SQLite](#sqlite-and-sqlite-wasm), and JavaScript runs on
12
+ [QuickJS](#quickjs-and-quickjs-emscripten). The dev UI gives the pages of frames [jQuery](#jquery) at
12
13
  nui://game/ui/jquery.js, as FiveM's NUI does.
13
14
 
14
15
  ## Lua and LuaGLM
@@ -385,6 +386,66 @@ at the version pinned in [package.json](package.json). SQLite is in the
385
386
  [public domain](https://sqlite.org/copyright.html). The package is licensed under the
386
387
  Apache License, Version 2.0. The license text is at the end of this file.
387
388
 
389
+ ## QuickJS and quickjs-emscripten
390
+
391
+ `quickjs.wasm`, next to the built tool, and its copy among the assets of the dev UI, are
392
+ QuickJS compiled to WebAssembly, and the built tool and the dev UI bundle the JavaScript
393
+ that runs them, all from the npm packages
394
+ [@jitl/quickjs-wasmfile-release-sync](https://www.npmjs.com/package/@jitl/quickjs-wasmfile-release-sync),
395
+ [@jitl/quickjs-ffi-types](https://www.npmjs.com/package/@jitl/quickjs-ffi-types) and
396
+ [quickjs-emscripten-core](https://www.npmjs.com/package/quickjs-emscripten-core) at the
397
+ versions pinned in [package.json](package.json). MIT License.
398
+
399
+ ```text
400
+ quickjs-emscripten:
401
+ The MIT License
402
+
403
+ quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
404
+
405
+ Permission is hereby granted, free of charge, to any person obtaining a copy
406
+ of this software and associated documentation files (the "Software"), to deal
407
+ in the Software without restriction, including without limitation the rights
408
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
409
+ copies of the Software, and to permit persons to whom the Software is
410
+ furnished to do so, subject to the following conditions:
411
+
412
+ The above copyright notice and this permission notice shall be included in all
413
+ copies or substantial portions of the Software.
414
+
415
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
416
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
417
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
418
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
419
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
420
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
421
+ SOFTWARE.
422
+
423
+
424
+ quickjs:
425
+ QuickJS Javascript Engine
426
+
427
+ Copyright (c) 2017-2021 Fabrice Bellard
428
+ Copyright (c) 2017-2021 Charlie Gordon
429
+
430
+ Permission is hereby granted, free of charge, to any person obtaining a copy
431
+ of this software and associated documentation files (the "Software"), to deal
432
+ in the Software without restriction, including without limitation the rights
433
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
434
+ copies of the Software, and to permit persons to whom the Software is
435
+ furnished to do so, subject to the following conditions:
436
+
437
+ The above copyright notice and this permission notice shall be included in
438
+ all copies or substantial portions of the Software.
439
+
440
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
441
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
442
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
443
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
444
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
445
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
446
+ THE SOFTWARE.
447
+ ```
448
+
388
449
  ## Apache License 2.0
389
450
 
390
451
  ```text