@cybermp-community/resource-builder 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +303 -2
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +584 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +1040 -0
- package/dist/index.js +1 -0
- package/dist/run-CmhtmY2x.js +7018 -0
- package/dist/run-CmhtmY2x.js.map +1 -0
- package/package.json +64 -3
- package/schema/config.json +122 -0
- package/templates/project-default/Dockerfile +17 -0
- package/templates/project-default/README.md +57 -0
- package/templates/project-default/_dockerignore +26 -0
- package/templates/project-default/_gitignore +32 -0
- package/templates/project-default/addons/gamemode/browser/env.d.ts +1 -0
- package/templates/project-default/addons/gamemode/browser/index.html +12 -0
- package/templates/project-default/addons/gamemode/browser/package.json +21 -0
- package/templates/project-default/addons/gamemode/browser/src/App.vue +40 -0
- package/templates/project-default/addons/gamemode/browser/src/global.d.ts +7 -0
- package/templates/project-default/addons/gamemode/browser/src/main.ts +4 -0
- package/templates/project-default/addons/gamemode/browser/tsconfig.json +7 -0
- package/templates/project-default/addons/gamemode/browser/vite.config.ts +15 -0
- package/templates/project-default/addons/gamemode/client/src/global.d.ts +5 -0
- package/templates/project-default/addons/gamemode/client/src/index.ts +11 -0
- package/templates/project-default/addons/gamemode/client/tsconfig.json +4 -0
- package/templates/project-default/addons/gamemode/package.json +22 -0
- package/templates/project-default/addons/gamemode/resource.toml +12 -0
- package/templates/project-default/addons/gamemode/server/src/global.d.ts +5 -0
- package/templates/project-default/addons/gamemode/server/src/index.ts +13 -0
- package/templates/project-default/addons/gamemode/server/tsconfig.json +7 -0
- package/templates/project-default/addons/gamemode/shared/src/index.ts +2 -0
- package/templates/project-default/biome.json +43 -0
- package/templates/project-default/cybermp.config.json +6 -0
- package/templates/project-default/docker-compose.yml +19 -0
- package/templates/project-default/package.json +25 -0
- package/templates/project-default/pnpm-workspace.yaml +6 -0
- package/templates/project-default/server.toml +21 -0
- package/templates/project-default/tsconfig.json +7 -0
- package/templates/types.json +15 -0
- package/tsconfig.base.json +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cybermp-community/resource-builder",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Build tool for CyberMP projects: project config, addon resolution, server.toml, redscripts and the `cybermp` CLI.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cybermp",
|
|
7
|
+
"cyberpunk-2077",
|
|
8
|
+
"redscripts",
|
|
9
|
+
"build-tool"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/cybermp-community/resource-toolchain.git",
|
|
15
|
+
"directory": "packages/resource-builder"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/cybermp-community/resource-toolchain/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/cybermp-community/resource-toolchain/tree/main/packages/resource-builder#readme",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json",
|
|
28
|
+
"./schema/*": "./schema/*",
|
|
29
|
+
"./tsconfig.base.json": "./tsconfig.base.json"
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"bin": {
|
|
34
|
+
"cybermp": "./dist/cli.js"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist",
|
|
38
|
+
"schema",
|
|
39
|
+
"templates",
|
|
40
|
+
"tsconfig.base.json",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=22.0.0"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^26.6.11",
|
|
51
|
+
"tsdown": "^0.23.7",
|
|
52
|
+
"typescript": "^7.0.2",
|
|
53
|
+
"vitest": "^5.1.2"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@cybermp-community/addon": "^0.1.0",
|
|
57
|
+
"adm-zip": "^0.6.1",
|
|
58
|
+
"esbuild": "^0.28.2",
|
|
59
|
+
"smol-toml": "^1.9.1",
|
|
60
|
+
"tar": "^7.5.24"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsdown",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:watch": "vitest"
|
|
66
|
+
}
|
|
6
67
|
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schemas.cybermp-community.dev/builder/config.json",
|
|
4
|
+
"title": "CyberMP project configuration",
|
|
5
|
+
"description": "Project-wide settings for a CyberMP project, read from cybermp.config.json in the project root. The file is optional; every field has a default. server.toml and per-addon build settings are not project keys.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Optional schema URL for editor completion."
|
|
12
|
+
},
|
|
13
|
+
"resourcesDir": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"default": "resources",
|
|
16
|
+
"description": "Directory passed to the server as -rdir. Relative values are resolved against the project root; the default `resources` is resolved the same way, so the effective path is always absolute."
|
|
17
|
+
},
|
|
18
|
+
"workDir": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"default": ".cybermp",
|
|
21
|
+
"description": "Build state directory: compiler cache and unpacked release addons. Relative values are resolved against the project root; the default `.cybermp` is resolved the same way, so the effective path is always absolute."
|
|
22
|
+
},
|
|
23
|
+
"addons": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"description": "Addon discovery, ordering and materialization settings.",
|
|
27
|
+
"properties": {
|
|
28
|
+
"local": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": { "type": "string" },
|
|
31
|
+
"default": ["addons/*"],
|
|
32
|
+
"description": "Directory globs, relative to the project root, that resolve local source addons. Absolute globs and `..` segments are rejected."
|
|
33
|
+
},
|
|
34
|
+
"order": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": { "type": "string" },
|
|
37
|
+
"default": [],
|
|
38
|
+
"description": "Explicit addon load order. Addons not listed follow in dependency-graph order."
|
|
39
|
+
},
|
|
40
|
+
"overrides": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"default": {},
|
|
43
|
+
"description": "Manifest edits applied to the materialized addon copy, keyed by addon name.",
|
|
44
|
+
"additionalProperties": { "$ref": "#/$defs/addonOverride" }
|
|
45
|
+
},
|
|
46
|
+
"disabled": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": { "type": "string" },
|
|
49
|
+
"default": [],
|
|
50
|
+
"description": "Addons kept installed but neither built nor listed in server.toml."
|
|
51
|
+
},
|
|
52
|
+
"extraResources": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": { "type": "string" },
|
|
55
|
+
"default": [],
|
|
56
|
+
"description": "Hand-managed resources in resourcesDir, copied into server.toml as they are."
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"redscripts": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"description": "Redscript compilation settings.",
|
|
64
|
+
"properties": {
|
|
65
|
+
"enabled": {
|
|
66
|
+
"type": "boolean",
|
|
67
|
+
"default": true,
|
|
68
|
+
"description": "Whether final_redscripts is built at all."
|
|
69
|
+
},
|
|
70
|
+
"compilerVersion": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"default": "0.5.31",
|
|
73
|
+
"description": "Pinned redscript-cli version, compatible with the core baseline."
|
|
74
|
+
},
|
|
75
|
+
"platform": {
|
|
76
|
+
"enum": ["win", "linux"],
|
|
77
|
+
"description": "Optional platform whose compiler and core baseline are used. When absent, the builder resolves the effective platform where it needs one: this field, then the first server platform, then the host platform."
|
|
78
|
+
},
|
|
79
|
+
"baseline": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"default": "core",
|
|
82
|
+
"examples": ["core", "none"],
|
|
83
|
+
"description": "`core` uses the downloaded core baseline; `none` compiles together with the core sources; any other value is a path to a baseline file."
|
|
84
|
+
},
|
|
85
|
+
"output": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"default": "final_redscripts",
|
|
88
|
+
"pattern": "^[a-z0-9][a-z0-9_-]*$",
|
|
89
|
+
"description": "Resource name of the compiled scripts: one lowercase path segment. `core`, `mp`, `resources` and `hotreload` are reserved, and the name may not be one the project already uses as an addon or hand-managed resource."
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"server": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"additionalProperties": false,
|
|
96
|
+
"description": "Downloaded CyberMP server builds.",
|
|
97
|
+
"properties": {
|
|
98
|
+
"platforms": {
|
|
99
|
+
"type": "array",
|
|
100
|
+
"items": { "enum": ["win", "linux"] },
|
|
101
|
+
"description": "Platform builds to keep downloaded. Defaults to the host platform."
|
|
102
|
+
},
|
|
103
|
+
"version": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"description": "Pinned server release tag; the latest release when absent."
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"$defs": {
|
|
111
|
+
"addonOverride": {
|
|
112
|
+
"type": "object",
|
|
113
|
+
"additionalProperties": false,
|
|
114
|
+
"description": "Manifest fields a project may override on a materialized addon copy.",
|
|
115
|
+
"properties": {
|
|
116
|
+
"cef_url": { "type": "string" },
|
|
117
|
+
"hotreload": { "type": "boolean" },
|
|
118
|
+
"use_game_natives": { "type": "boolean" }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Builds the project, then hands its resources to the official server image.
|
|
2
|
+
FROM --platform=linux/amd64 node:22-slim AS builder
|
|
3
|
+
|
|
4
|
+
RUN corepack enable
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
COPY . .
|
|
9
|
+
RUN __PACKAGE_MANAGER__ install
|
|
10
|
+
RUN __PACKAGE_MANAGER__ run build
|
|
11
|
+
|
|
12
|
+
FROM --platform=linux/amd64 ghcr.io/cyber-mp/server:latest
|
|
13
|
+
|
|
14
|
+
WORKDIR /cybermp
|
|
15
|
+
|
|
16
|
+
COPY --from=builder /app/resources /cybermp/resources
|
|
17
|
+
COPY server.toml /cybermp/server.toml
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# __PROJECT_NAME__
|
|
2
|
+
|
|
3
|
+
A CyberMP project scaffolded by `cybermp init`: one project configuration, local
|
|
4
|
+
addons under `addons/`, and a `server.toml` the build keeps in sync.
|
|
5
|
+
|
|
6
|
+
## Getting started
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
__PACKAGE_MANAGER__ install
|
|
10
|
+
cybermp download # fetch the CyberMP server binaries
|
|
11
|
+
cybermp build # build the addons and rewrite server.toml
|
|
12
|
+
cybermp run # start the server against this project
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Layout
|
|
16
|
+
|
|
17
|
+
| Path | What it is |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `cybermp.config.json` | Project settings: where addons live, build state directory, redscripts. |
|
|
20
|
+
| `server.toml` | The server configuration. `cybermp build` rewrites `resources`. |
|
|
21
|
+
| `addons/gamemode` | The example addon: client and server scripts, a shared module, a Vue page. |
|
|
22
|
+
| `addons/gamemode/browser` | The CEF page, built with Vite into `dist/` and copied by the build. |
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
| Command | What it does |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `cybermp check` | Validate the project: addon manifests and the `server.toml` order. |
|
|
29
|
+
| `cybermp build` | Build every addon, materialize the resources, rewrite `server.toml`. |
|
|
30
|
+
| `cybermp download` | Fetch the server binaries into `.cybermp/mp`. |
|
|
31
|
+
| `cybermp run` | Start the downloaded server with this project as its working directory. |
|
|
32
|
+
| `cybermp create addon <name>` | Scaffold another local addon. |
|
|
33
|
+
|
|
34
|
+
## The example addon
|
|
35
|
+
|
|
36
|
+
`addons/gamemode/package.json` carries the `cybermp` marker: the resource name
|
|
37
|
+
and the build settings. Every directory matching `addons/*` is a local addon, so
|
|
38
|
+
copy the example or scaffold a new one and it is picked up automatically.
|
|
39
|
+
|
|
40
|
+
The `cybermp` marker is what makes a directory an addon:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
"cybermp": {
|
|
44
|
+
"resource": "gamemode",
|
|
45
|
+
"build": {
|
|
46
|
+
"client": { "entry": "client/src/index.ts" },
|
|
47
|
+
"server": { "entry": "server/src/index.ts" },
|
|
48
|
+
"browser": { "dist": "dist" }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The type packages each realm's `mp` global comes from are pinned by
|
|
54
|
+
`cybermp init`: the official `@cybermp/*` packages by default. Pass
|
|
55
|
+
`--types=community` to pin the community set instead (it refuses a realm the
|
|
56
|
+
typecheck gate has blocked until that package compiles), and bump the pins
|
|
57
|
+
together with the CLI so the whole project compiles against one API version.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
.pnpm-store/
|
|
3
|
+
*.log
|
|
4
|
+
|
|
5
|
+
# CyberMP binaries, server data and build outputs
|
|
6
|
+
.cybermp/
|
|
7
|
+
mp/
|
|
8
|
+
cache/
|
|
9
|
+
logs/
|
|
10
|
+
crashdumps/
|
|
11
|
+
tmp/
|
|
12
|
+
*.zip
|
|
13
|
+
resources/
|
|
14
|
+
|
|
15
|
+
# Environment and secrets
|
|
16
|
+
.env
|
|
17
|
+
.env.*.local
|
|
18
|
+
|
|
19
|
+
# Git, editors and docs
|
|
20
|
+
.git/
|
|
21
|
+
.github/
|
|
22
|
+
.idea/
|
|
23
|
+
.vscode/
|
|
24
|
+
README.md
|
|
25
|
+
Dockerfile
|
|
26
|
+
docker-compose*.yml
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
.pnpm-store/
|
|
4
|
+
pnpm-debug.log*
|
|
5
|
+
*.log
|
|
6
|
+
|
|
7
|
+
# CyberMP server binaries, caches and build state
|
|
8
|
+
/.cybermp/
|
|
9
|
+
/mp/
|
|
10
|
+
/cache/
|
|
11
|
+
/crashdumps/
|
|
12
|
+
/logs/
|
|
13
|
+
*.zip
|
|
14
|
+
|
|
15
|
+
# Build outputs
|
|
16
|
+
/resources/
|
|
17
|
+
dist/
|
|
18
|
+
|
|
19
|
+
# Environment
|
|
20
|
+
.env
|
|
21
|
+
.env.local
|
|
22
|
+
.env.*.local
|
|
23
|
+
|
|
24
|
+
# IDEs
|
|
25
|
+
.idea/
|
|
26
|
+
.vscode/*
|
|
27
|
+
!.vscode/extensions.json
|
|
28
|
+
!.vscode/settings.json
|
|
29
|
+
|
|
30
|
+
# OS files
|
|
31
|
+
.DS_Store
|
|
32
|
+
Thumbs.db
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>__PROJECT_NAME__</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="app"></div>
|
|
10
|
+
<script type="module" src="/src/main.ts"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@__PROJECT_NAME__/gamemode-browser",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"typecheck": "vue-tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"vue": "^3.5.42"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"__BROWSER_TYPES_PACKAGE__": "^__BROWSER_TYPES_VERSION__",
|
|
17
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
18
|
+
"vite": "^8.2.2",
|
|
19
|
+
"vue-tsc": "^3.3.11"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hud">
|
|
3
|
+
<h1>__PROJECT_NAME__</h1>
|
|
4
|
+
<p>{{ message }}</p>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
const message = 'CEF page ready';
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<style scoped>
|
|
13
|
+
.hud {
|
|
14
|
+
position: fixed;
|
|
15
|
+
bottom: 24px;
|
|
16
|
+
left: 24px;
|
|
17
|
+
padding: 16px 20px;
|
|
18
|
+
color: #fff;
|
|
19
|
+
background: rgba(0, 0, 0, 0.65);
|
|
20
|
+
border-left: 4px solid #fcee0a;
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
23
|
+
user-select: none;
|
|
24
|
+
z-index: 9999;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h1 {
|
|
28
|
+
margin: 0 0 4px;
|
|
29
|
+
color: #fcee0a;
|
|
30
|
+
font-size: 24px;
|
|
31
|
+
letter-spacing: 1px;
|
|
32
|
+
text-transform: uppercase;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
p {
|
|
36
|
+
margin: 0;
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
opacity: 0.85;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url';
|
|
2
|
+
import vue from '@vitejs/plugin-vue';
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
|
|
5
|
+
// `base: './'` keeps the built page loadable from CEF, which serves it from
|
|
6
|
+
// the resource directory rather than from a web root.
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
base: './',
|
|
9
|
+
plugins: [vue()],
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: {
|
|
12
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ROUND_MESSAGE } from '../../shared/src/index.js';
|
|
2
|
+
|
|
3
|
+
console.log('[gamemode] client initialized');
|
|
4
|
+
|
|
5
|
+
mp.events.on('resourceStart', () => {
|
|
6
|
+
mp.events.emitServer('gamemode:hello', ROUND_MESSAGE);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
mp.events.onServer('gamemode:greeting', (text: string) => {
|
|
10
|
+
console.log(`[gamemode] ${text}`);
|
|
11
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@__PROJECT_NAME__/gamemode",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Example CyberMP addon: client and server scripts with a Vue browser page.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"typecheck": "tsc -p client && tsc -p server"
|
|
9
|
+
},
|
|
10
|
+
"cybermp": {
|
|
11
|
+
"resource": "gamemode",
|
|
12
|
+
"build": {
|
|
13
|
+
"client": { "entry": "client/src/index.ts" },
|
|
14
|
+
"server": { "entry": "server/src/index.ts" },
|
|
15
|
+
"browser": { "dist": "dist" }
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"__CLIENT_TYPES_PACKAGE__": "^__CLIENT_TYPES_VERSION__",
|
|
20
|
+
"__SERVER_TYPES_PACKAGE__": "^__SERVER_TYPES_VERSION__"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#:schema https://schemas.cyber.mp/resource/schema.json
|
|
2
|
+
|
|
3
|
+
client_script = ["./client.js"]
|
|
4
|
+
server_script = ["./server.js"]
|
|
5
|
+
|
|
6
|
+
cef_url = "./browser/index.html"
|
|
7
|
+
|
|
8
|
+
use_game_natives = true
|
|
9
|
+
hotreload = true
|
|
10
|
+
|
|
11
|
+
author = "__PROJECT_NAME__"
|
|
12
|
+
version = "0.1.0"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ROUND_MESSAGE } from '../../shared/src/index.js';
|
|
2
|
+
|
|
3
|
+
console.log('[gamemode] server initialized');
|
|
4
|
+
|
|
5
|
+
mp.events.on('playerConnected', (playerId: number) => {
|
|
6
|
+
const player = mp.players.at(playerId);
|
|
7
|
+
console.log(`[gamemode] ${player.nickname} joined`);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
mp.events.onClient('gamemode:hello', (player, text: string) => {
|
|
11
|
+
console.log(`[gamemode] ${player.nickname}: ${text}`);
|
|
12
|
+
mp.events.emitClient(player, 'gamemode:greeting', `Welcome to ${ROUND_MESSAGE}!`);
|
|
13
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.6.9/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": true
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": true,
|
|
10
|
+
"includes": ["**", "!**/resources", "!**/dist", "!**/pnpm-lock.yaml"]
|
|
11
|
+
},
|
|
12
|
+
"formatter": {
|
|
13
|
+
"enabled": true,
|
|
14
|
+
"formatWithErrors": false,
|
|
15
|
+
"indentStyle": "space",
|
|
16
|
+
"indentWidth": 2,
|
|
17
|
+
"lineWidth": 100,
|
|
18
|
+
"lineEnding": "lf"
|
|
19
|
+
},
|
|
20
|
+
"javascript": {
|
|
21
|
+
"formatter": {
|
|
22
|
+
"quoteStyle": "single",
|
|
23
|
+
"semicolons": "always",
|
|
24
|
+
"trailingCommas": "all",
|
|
25
|
+
"arrowParentheses": "always",
|
|
26
|
+
"bracketSpacing": true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"linter": {
|
|
30
|
+
"enabled": true,
|
|
31
|
+
"rules": {
|
|
32
|
+
"preset": "recommended"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"assist": {
|
|
36
|
+
"enabled": true,
|
|
37
|
+
"actions": {
|
|
38
|
+
"source": {
|
|
39
|
+
"organizeImports": "on"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
services:
|
|
2
|
+
server:
|
|
3
|
+
container_name: cybermp-server
|
|
4
|
+
platform: linux/amd64
|
|
5
|
+
build:
|
|
6
|
+
context: .
|
|
7
|
+
dockerfile: Dockerfile
|
|
8
|
+
environment:
|
|
9
|
+
NODE_ENV: production
|
|
10
|
+
IS_DOCKER: "true"
|
|
11
|
+
stdin_open: true
|
|
12
|
+
tty: true
|
|
13
|
+
volumes:
|
|
14
|
+
- ./cache:/cybermp/cache
|
|
15
|
+
- ./crashdumps:/cybermp/crashdumps
|
|
16
|
+
- ./logs:/cybermp/logs
|
|
17
|
+
ports:
|
|
18
|
+
- ${PORT:-2077}:2077/tcp
|
|
19
|
+
- ${PORT:-2077}:2077/udp
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "A CyberMP project built with the community toolchain.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"packageManager": "__PACKAGE_MANAGER_PIN__",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=22.0.0"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "cybermp build",
|
|
13
|
+
"check": "cybermp check",
|
|
14
|
+
"download": "cybermp download",
|
|
15
|
+
"lint": "biome check .",
|
|
16
|
+
"run": "cybermp run",
|
|
17
|
+
"typecheck": "tsc --noEmit"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@biomejs/biome": "^2.6.9",
|
|
21
|
+
"@cybermp-community/resource-builder": "__BUILDER_RANGE__",
|
|
22
|
+
"@types/node": "^26.6.11",
|
|
23
|
+
"typescript": "^7.0.2"
|
|
24
|
+
}
|
|
25
|
+
}
|