@thzero/black-meridian-library_common 0.1.5 → 0.1.6
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 +66 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
# black-meridian-library_common
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Shared constants and data classes for the Black Meridian servers. It has no server or browser dependencies beyond `@thzero/library_common`, so both servers and clients can import it.
|
|
6
|
+
|
|
7
|
+
Used by `server_auth`, `server_vessel` and `server_zone`.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
6
10
|
|
|
7
11
|
[](https://npmjs.org/package/@thzero/black-meridian-library_common)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @thzero/black-meridian-library_common
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Node.js 24 or later. The package is an ES module.
|
|
18
|
+
|
|
19
|
+
## Contents
|
|
20
|
+
|
|
21
|
+
| Path | What it is |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `constants.js` | `PubSub.Channels`: the channel names vessels and zones use (`enter`, plus builders for `changes`, `space`, `vessel` and `zone`). `Timing`: tick and message rates (Hz) and the enter, lost and drop timeouts (seconds). |
|
|
24
|
+
| `data/user.js` | `UserData`, which extends `@thzero/library_common`'s base user with `gameData`, and creates `Settings` for its settings. |
|
|
25
|
+
| `data/settingsUser.js` | `Settings`, the user settings with `games` and `gameSystems`. |
|
|
26
|
+
| `data/userGame.js` | `UserGameData`, a player's stats: badges, kills, deaths, victories, rating and the factions, mechs and scenarios played. |
|
|
27
|
+
|
|
28
|
+
There is no `index.js`, so import files by path:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import Constants from '@thzero/black-meridian-library_common/constants.js';
|
|
32
|
+
import UserData from '@thzero/black-meridian-library_common/data/user.js';
|
|
33
|
+
|
|
34
|
+
const channel = Constants.PubSub.Channels.zone(gameId, zoneId);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Development
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install
|
|
41
|
+
npm test
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Tests use the built-in `node --test` runner and live in `test/`.
|
|
45
|
+
|
|
46
|
+
| Script | What it does |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `version.sh` / `version.bat` | Bumps the version in `package.json` with `library-cli` (`npm install -g @thzero/library_cli`). |
|
|
49
|
+
| `push.sh` / `push.bat` | Adds, commits and pushes with the given message. |
|
|
50
|
+
| `pushversion.sh` / `pushversion.bat` | Bumps the version, then pushes. |
|
|
51
|
+
| `ncupd.sh` / `ncupd.bat` | Reinstalls with every dependency upgraded to latest (`npm install -g npm-check-updates`). |
|
|
52
|
+
| `pushnpm.bat` | `ncupd`, then `pushversion` with "npm updates". |
|
|
53
|
+
|
|
54
|
+
## Release
|
|
55
|
+
|
|
56
|
+
Work happens on `dev`. Both workflows check out `dev`, push to it, open a pull request from `dev` to `master`, merge it, and publish to npm. Only the repository owner can run them.
|
|
57
|
+
|
|
58
|
+
- **Publish CI** (`.github/workflows/publish.yaml`): run it by hand from the Actions tab (Run workflow). It installs, tests, bumps the version, commits with the label you give, merges to `master` and publishes.
|
|
59
|
+
- **Build CI** (`.github/workflows/build.yaml`): starts on a `repository_dispatch` event. With `client_payload.action` set to `npm` it upgrades dependencies first; with the event type `version` it bumps the version. It tests, then commits, merges and publishes only when something changed.
|
|
60
|
+
|
|
61
|
+
The workflows need these repository secrets:
|
|
62
|
+
|
|
63
|
+
| Secret | Used for |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| `NPM_TOKEN` | `npm publish`. A granular access token with read and write on `@thzero` packages and 2FA bypass. |
|
|
66
|
+
| `ACCESS_TOKEN` | Build CI only, for the `build_all` event: a personal access token that can dispatch to `thzero/library_build`. |
|
|
67
|
+
|
|
68
|
+
Under Settings, Actions, General, set Workflow permissions to "Read and write permissions" and check "Allow GitHub Actions to create and approve pull requests". Without these the push and pull request steps fail.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
See [license.md](license.md).
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thzero/black-meridian-library_common",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6",
|
|
5
5
|
"version_major": 0,
|
|
6
6
|
"version_minor": 1,
|
|
7
|
-
"version_patch":
|
|
7
|
+
"version_patch": 6,
|
|
8
8
|
"version_date": "11/28/2026",
|
|
9
9
|
"description": "",
|
|
10
10
|
"author": "thZero",
|