Skip to content

Commit f56ee0c

Browse files
committed
docs: update README files with new structure and detailed usage examples for all packages
1 parent c1b4288 commit f56ee0c

File tree

13 files changed

+1010
-152
lines changed

13 files changed

+1010
-152
lines changed

packages/asset-manager/README.md

Lines changed: 71 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,84 @@
1-
# Engine Asset Manager
1+
<div align="center">
2+
<br />
3+
<p>
4+
<a href="https://github.com/NanoForge-dev"><img src="https://github.com/NanoForge-dev/blob/main/.github/logo.png" width="546" alt="NanoForge" /></a>
5+
</p>
6+
<br />
7+
<p>
8+
<a href="https://www.npmjs.com/package/@nanoforge-dev/asset-manager"><img src="https://img.shields.io/npm/v/@nanoforge-dev/asset-manager.svg?maxAge=3600" alt="npm version" /></a>
9+
<a href="https://www.npmjs.com/package/@nanoforge-dev/asset-manager"><img src="https://img.shields.io/npm/dt/@nanoforge-dev/asset-manager.svg?maxAge=3600" alt="npm downloads" /></a>
10+
<a href="https://github.com/NanoForge-dev/Engine/actions"><img src="https://github.com/NanoForge-dev/Engine/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
11+
<a href="https://github.com/NanoForge-dev/Engine/commits/main/packages/asset-manager"><img src="https://img.shields.io/github/last-commit/NanoForge-dev/Engine.svg?logo=github&logoColor=ffffff&path=packages%2Fasset-manager" alt="Last commit." /></a>
12+
</p>
13+
</div>
214

3-
## Installing dependencies
15+
## About
416

5-
To install dependencies run:
17+
`@nanoforge-dev/asset-manager` is a manager for loading assets to uniform work with between client and server.
18+
19+
## Installation
20+
21+
**Node.js 24.11.0 or newer is required.**
622

723
```sh
8-
pnpm i
24+
npm install @nanoforge-dev/asset-manager
25+
yarn add @nanoforge-dev/asset-manager
26+
pnpm add @nanoforge-dev/asset-manager
27+
bun add @nanoforge-dev/asset-manager
928
```
1029

11-
## Building
30+
## Example usage
1231

13-
To build the project run:
32+
Initialize the library in your main file
1433

15-
```sh
16-
pnpm build
34+
```ts
35+
import { AssetManagerLibrary } from "@nanoforge-dev/asset-manager";
36+
import { type IRunOptions } from "@nanoforge-dev/common";
37+
import { NanoforgeFactory } from "@nanoforge-dev/core";
38+
39+
export async function main(options: IRunOptions) {
40+
const app = NanoforgeFactory.createClient(); // Or NanoforgeFactory.createServer()
41+
42+
const assetManager = new AssetManagerLibrary();
43+
44+
app.useAssetManager(assetManager);
45+
46+
await app.init(options);
47+
48+
await app.run();
49+
}
1750
```
1851

19-
## Tests
52+
Use to load assets
2053

21-
To run tests use:
54+
```ts
55+
export async function mySystem(registry: Registry, ctx: Context) {
56+
const assetManager = ctx.libs.getAssetManager<AssetManagerLibrary>();
2257

23-
```sh
24-
pnpm test
58+
const file = assetManager.getAsset("/path/to/file.txt");
59+
const text = await file.text();
60+
61+
// Do something with file or text
62+
}
2563
```
64+
65+
## Links
66+
67+
- [GitHub][source]
68+
- [npm][npm]
69+
70+
## Contributing
71+
72+
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
73+
[documentation][documentation].
74+
See [the contribution guide][contributing] if you'd like to submit a PR.
75+
76+
## Help
77+
78+
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to ask questions in [discussions][discussions].
79+
80+
[documentation]: https://github.com/NanoForge-dev/Engine
81+
[discussions]: https://github.com/NanoForge-dev/Engine/discussions
82+
[source]: https://github.com/NanoForge-dev/Engine/tree/main/packages/asset-manager
83+
[npm]: https://www.npmjs.com/package/@nanoforge-dev/asset-manager
84+
[contributing]: https://github.com/NanoForge-dev/Engine/blob/main/.github/CONTRIBUTING.md

packages/common/README.md

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,49 @@
1-
# Engine Common
1+
<div align="center">
2+
<br />
3+
<p>
4+
<a href="https://github.com/NanoForge-dev"><img src="https://github.com/NanoForge-dev/blob/main/.github/logo.png" width="546" alt="NanoForge" /></a>
5+
</p>
6+
<br />
7+
<p>
8+
<a href="https://www.npmjs.com/package/@nanoforge-dev/common"><img src="https://img.shields.io/npm/v/@nanoforge-dev/common.svg?maxAge=3600" alt="npm version" /></a>
9+
<a href="https://www.npmjs.com/package/@nanoforge-dev/common"><img src="https://img.shields.io/npm/dt/@nanoforge-dev/common.svg?maxAge=3600" alt="npm downloads" /></a>
10+
<a href="https://github.com/NanoForge-dev/Engine/actions"><img src="https://github.com/NanoForge-dev/Engine/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
11+
<a href="https://github.com/NanoForge-dev/Engine/commits/main/packages/common"><img src="https://img.shields.io/github/last-commit/NanoForge-dev/Engine.svg?logo=github&logoColor=ffffff&path=packages%2Fcommon" alt="Last commit." /></a>
12+
</p>
13+
</div>
214

3-
## Installing dependencies
15+
## About
416

5-
To install dependencies run:
17+
`@nanoforge-dev/common` is library with common interfaces and utilities used by Nanoforge Engine.
18+
19+
## Installation
20+
21+
**Node.js 24.11.0 or newer is required.**
622

723
```sh
8-
pnpm i
24+
npm install @nanoforge-dev/common
25+
yarn add @nanoforge-dev/common
26+
pnpm add @nanoforge-dev/common
27+
bun add @nanoforge-dev/common
928
```
1029

11-
## Building
30+
## Links
1231

13-
To build the project run:
32+
- [GitHub][source]
33+
- [npm][npm]
1434

15-
```sh
16-
pnpm build
17-
```
35+
## Contributing
1836

19-
## Tests
37+
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
38+
[documentation][documentation].
39+
See [the contribution guide][contributing] if you'd like to submit a PR.
2040

21-
To run tests use:
41+
## Help
2242

23-
```sh
24-
pnpm test
25-
```
43+
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to ask questions in [discussions][discussions].
44+
45+
[documentation]: https://github.com/NanoForge-dev/Engine
46+
[discussions]: https://github.com/NanoForge-dev/Engine/discussions
47+
[source]: https://github.com/NanoForge-dev/Engine/tree/main/packages/common
48+
[npm]: https://www.npmjs.com/package/@nanoforge-dev/common
49+
[contributing]: https://github.com/NanoForge-dev/Engine/blob/main/.github/CONTRIBUTING.md

packages/config/README.md

Lines changed: 121 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,134 @@
1-
# Engine Config
1+
<div align="center">
2+
<br />
3+
<p>
4+
<a href="https://github.com/NanoForge-dev"><img src="https://github.com/NanoForge-dev/blob/main/.github/logo.png" width="546" alt="NanoForge" /></a>
5+
</p>
6+
<br />
7+
<p>
8+
<a href="https://www.npmjs.com/package/@nanoforge-dev/config"><img src="https://img.shields.io/npm/v/@nanoforge-dev/config.svg?maxAge=3600" alt="npm version" /></a>
9+
<a href="https://www.npmjs.com/package/@nanoforge-dev/config"><img src="https://img.shields.io/npm/dt/@nanoforge-dev/config.svg?maxAge=3600" alt="npm downloads" /></a>
10+
<a href="https://github.com/NanoForge-dev/Engine/actions"><img src="https://github.com/NanoForge-dev/Engine/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
11+
<a href="https://github.com/NanoForge-dev/Engine/commits/main/packages/config"><img src="https://img.shields.io/github/last-commit/NanoForge-dev/Engine.svg?logo=github&logoColor=ffffff&path=packages%2Fconfig" alt="Last commit." /></a>
12+
</p>
13+
</div>
214

3-
## Installing dependencies
15+
## About
416

5-
To install dependencies run:
17+
`@nanoforge-dev/config` is a wrapper of [class-validator][class-validator] and [class-transformer][class-transformer] to imports validation and transformation decorators.
18+
19+
## Installation
20+
21+
**Node.js 24.11.0 or newer is required.**
622

723
```sh
8-
pnpm i
24+
npm install @nanoforge-dev/config
25+
yarn add @nanoforge-dev/config
26+
pnpm add @nanoforge-dev/config
27+
bun add @nanoforge-dev/config
928
```
1029

11-
## Building
30+
## Warning
1231

13-
To build the project run:
32+
This library is of exclusive usage for other libraries. To put variables in the environment to allow libraries to use it through this config library, you must put it in factory options :
1433

15-
```sh
16-
pnpm build
34+
```ts
35+
import { type IRunOptions } from "@nanoforge-dev/common";
36+
import { NanoforgeFactory } from "@nanoforge-dev/core";
37+
import { NetworkLibrary } from "@nanoforge-dev/network";
38+
39+
export async function main(options: IRunOptions) {
40+
const app = NanoforgeFactory.createClient({
41+
environment: {
42+
serverTcpPort: "4445",
43+
serverUdpPort: "4444",
44+
serverAddress: "127.0.0.1",
45+
},
46+
});
47+
48+
const network = new NetworkLibrary();
49+
50+
app.useNetwork(network);
51+
52+
await app.init(options);
53+
54+
await app.run();
55+
}
1756
```
1857

19-
## Tests
58+
## Example usage
2059

21-
To run tests use:
60+
Initialize the library in your main file.
2261

23-
```sh
24-
pnpm test
62+
```ts
63+
export class NetworkClientLibrary extends BaseNetworkLibrary {
64+
get __name(): string {
65+
return "NetworkClientLibrary";
66+
}
67+
68+
public override async __init(context: InitContext): Promise<void> {
69+
const config = await context.config.registerConfig(ClientConfigNetwork);
70+
71+
// Do something with config
72+
}
73+
}
2574
```
75+
76+
Using this config
77+
78+
```ts
79+
import {
80+
Default,
81+
Expose,
82+
IsByteLength,
83+
IsIpOrFQDN,
84+
IsOptional,
85+
IsPort,
86+
} from "@nanoforge-dev/config";
87+
88+
export class ClientConfigNetwork {
89+
// This var must be a string port (ex: "4444") but can be undefined
90+
@Expose()
91+
@IsOptional()
92+
@IsPort()
93+
serverTcpPort?: string;
94+
95+
@Expose()
96+
@IsOptional()
97+
@IsPort()
98+
serverUdpPort?: string;
99+
100+
// This var must be ip address or fqdn (it cannot be undefined)
101+
@Expose()
102+
@IsIpOrFQDN()
103+
serverAddress?: string;
104+
105+
// This var must be a byte length between 2 and 64. It can be undefined as it as a default value.
106+
@Expose()
107+
@Default("PACKET_END")
108+
@IsByteLength(2, 64)
109+
magicValue!: string;
110+
}
111+
```
112+
113+
## Links
114+
115+
- [GitHub][source]
116+
- [npm][npm]
117+
118+
## Contributing
119+
120+
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
121+
[documentation][documentation].
122+
See [the contribution guide][contributing] if you'd like to submit a PR.
123+
124+
## Help
125+
126+
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to ask questions in [discussions][discussions].
127+
128+
[documentation]: https://github.com/NanoForge-dev/Engine
129+
[discussions]: https://github.com/NanoForge-dev/Engine/discussions
130+
[source]: https://github.com/NanoForge-dev/Engine/tree/main/packages/config
131+
[npm]: https://www.npmjs.com/package/@nanoforge-dev/config
132+
[contributing]: https://github.com/NanoForge-dev/Engine/blob/main/.github/CONTRIBUTING.md
133+
[class-validator]: https://github.com/typestack/class-validator
134+
[class-transformer]: https://github.com/typestack/class-transformer

packages/core/README.md

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,66 @@
1-
# Engine Core
1+
<div align="center">
2+
<br />
3+
<p>
4+
<a href="https://github.com/NanoForge-dev"><img src="https://github.com/NanoForge-dev/blob/main/.github/logo.png" width="546" alt="NanoForge" /></a>
5+
</p>
6+
<br />
7+
<p>
8+
<a href="https://www.npmjs.com/package/@nanoforge-dev/core"><img src="https://img.shields.io/npm/v/@nanoforge-dev/core.svg?maxAge=3600" alt="npm version" /></a>
9+
<a href="https://www.npmjs.com/package/@nanoforge-dev/core"><img src="https://img.shields.io/npm/dt/@nanoforge-dev/core.svg?maxAge=3600" alt="npm downloads" /></a>
10+
<a href="https://github.com/NanoForge-dev/Engine/actions"><img src="https://github.com/NanoForge-dev/Engine/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
11+
<a href="https://github.com/NanoForge-dev/Engine/commits/main/packages/core"><img src="https://img.shields.io/github/last-commit/NanoForge-dev/Engine.svg?logo=github&logoColor=ffffff&path=packages%2Fcore" alt="Last commit." /></a>
12+
</p>
13+
</div>
214

3-
## Installing dependencies
15+
## About
416

5-
To install dependencies run:
17+
`@nanoforge-dev/core` is a core package that contains game main loop. It is used to initialize the game and run it.
18+
19+
## Installation
20+
21+
**Node.js 24.11.0 or newer is required.**
622

723
```sh
8-
pnpm i
24+
npm install @nanoforge-dev/core
25+
yarn add @nanoforge-dev/core
26+
pnpm add @nanoforge-dev/core
27+
bun add @nanoforge-dev/core
928
```
1029

11-
## Building
30+
## Example usage
1231

13-
To build the project run:
32+
Initialize the game in your main file.
1433

15-
```sh
16-
pnpm build
17-
```
34+
```ts
35+
import { type IRunOptions } from "@nanoforge-dev/common";
36+
import { NanoforgeFactory } from "@nanoforge-dev/core";
1837

19-
## Tests
38+
export async function main(options: IRunClientOptions) {
39+
const app = NanoforgeFactory.createClient();
2040

21-
To run tests use:
41+
await app.init(options);
2242

23-
```sh
24-
pnpm test
43+
await app.run();
44+
}
2545
```
46+
47+
## Links
48+
49+
- [GitHub][source]
50+
- [npm][npm]
51+
52+
## Contributing
53+
54+
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
55+
[documentation][documentation].
56+
See [the contribution guide][contributing] if you'd like to submit a PR.
57+
58+
## Help
59+
60+
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to ask questions in [discussions][discussions].
61+
62+
[documentation]: https://github.com/NanoForge-dev/Engine
63+
[discussions]: https://github.com/NanoForge-dev/Engine/discussions
64+
[source]: https://github.com/NanoForge-dev/Engine/tree/main/packages/core
65+
[npm]: https://www.npmjs.com/package/@nanoforge-dev/core
66+
[contributing]: https://github.com/NanoForge-dev/Engine/blob/main/.github/CONTRIBUTING.md

0 commit comments

Comments
 (0)