Skip to content

Commit 3081a67

Browse files
committed
docs: Fix docs for latest loader & clean sections
1 parent b23f80e commit 3081a67

File tree

4 files changed

+221
-144
lines changed

4 files changed

+221
-144
lines changed

docs/build.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Build
3-
sidebar_position: 3
2+
title: Contributing
3+
sidebar_position: 5
44
---
55

66
# Build Nevermore locally
77
This document is intended to help people submit bug patches, new features, and more to Nevermore. If you would simply like to consume Nevermore and not contribute to it, then this is not the correct article. Please see the [installation](/docs/install) docs for more.
88

9-
To provide a bit of background, Nevermore is a mono-repo. This means that it has a few hundred packages in one repository. In general, you should feel free to deploy Nevermore compatible packages to your own repository. This is part of what using npm empowers us to do.
9+
To provide a bit of background, Nevermore is a mono-repo. This means that it has a few hundred packages in one repository. In general, you should feel free to deploy Nevermore compatible packages to your own repository. This is part of what using npm empowers us to do.
1010

1111
## What you need to be comfortable with
1212
Contributing to Nevermore is a little bit more difficult than consuming it. That being said, it shouldn't be too bad.
@@ -71,4 +71,4 @@ git clone https://github.com/Quenty/NevermoreEngine.git
7171
## Why does building need a custom version of Rojo?
7272
Nevermore does not need a custom version of Rojo to be consumed, but it does need one to be built. This custom version of Rojo understands symlinks and turn them into ObjectValues. These symlinks link the packages together and means that a change to a transient dependency, or direct dependency will immediately be shown in the upstream package.
7373

74-
As an added bonus, this custom version of Rojo also supports live-syncing mesh parts.
74+
As an added bonus, this custom version of Rojo also supports live-syncing mesh parts.

docs/design.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Design
3-
sidebar_position: 3
3+
sidebar_position: 4
44
---
55

66
# Nevermore design principles
@@ -69,4 +69,3 @@ to as wide of an audience as possible, in many ways document and design notes ar
6969
## Loading system
7070

7171
Nevermore's loading system has changed over time, but is generally responsible for loading many modules.
72-

docs/install.md

+52-25
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@ Nevermore should be installable within 2-3 minutes if you follow this guide.
1515
toc={toc.filter((node) => node.level <= 3)}
1616
/>
1717

18-
19-
## Fast track: Installing via NPM and the Nevermore CLI
20-
If you want to just try out Nevermore, making a new templated game can be the easiest way to do this. For this reason, there is now a Nevermore CLI that can be used. A CLI stands for command line interface.
18+
## Fast track: Installing via NPM and the Nevermore CLI (recommended)
19+
If you want to just try out Nevermore, making a new templated game can be the easiest way to do this. For this reason, there is now a Nevermore CLI that can be used. A CLI stands for command line interface.
2120

2221
* Install [Node.js](https://nodejs.org/en/download/) v14+ on your computer.
2322
* Install [rojo](https://rojo.space/docs/v7/getting-started/installation/) v7+ on your computer.
2423

25-
We can then use the npm command line to generate a working directory.
24+
We can then use the npm command line to generate a working directory.
2625

27-
1. Open a terminal, like Command Prompt, Powershell, or [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701) (recommended).
26+
1. Open a terminal, like Command Prompt, PowerShell, or [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701) (recommended).
2827
2. Change directory to the location you would like to initialize and create files. You can do this by typing `mkdir MyGame` and then `cd MyGame`. You can use `dir` or `ls` to list out the current directory.
29-
2. Run the command `npx nevermore init` to generate a new game.
28+
2. Run the command `npx nevermore init` to generate a new game.
3029
3. Run the command `npm install @quenty/maid` or whatever package you want.
3130

3231
:::tip
@@ -42,7 +41,7 @@ This will install the current version of Maid and all dependencies into the `nod
4241
[npm](https://www.npmjs.com/) is a package manager. Nevermore uses npm to manage package versions and install transient dependencies. A transient dependency is a dependency of a dependency (for example, [Blend](/api/Blend) depends upon [Maid](/api/Maid).
4342

4443
### How do I install additional packages?
45-
The default installation comes with very few packages. This is normal. You can see which packages are installed by looking at the `package.json` file in a text editor. To install additional packages, simply run the following command in a terminal
44+
The default installation comes with very few packages. This is normal. You can see which packages are installed by looking at the `package.json` file in a text editor. To install additional packages, simply run the following command in a terminal:
4645

4746
```bash
4847
npm install @quenty/servicebag
@@ -57,7 +56,7 @@ When you run `npm install` you end up with a `package-lock.json`. You should com
5756

5857
Nevermore is designed to work with games with existing architecture. If you're using Knit, a multi-script architecture, a custom framework or a single-script architecture, Nevermore provides a lot of utility modules that are useful in any of these scenarios. Nevermore's latest version also supports multiple copies of Nevermore running at once as long as bootstrapping is carefully managed. This can allow you to develop your game in an isolated way, or introduce Nevermore dependencies slowly as you need them.
5958

60-
If you want to install this into an existing game follow these instructions.
59+
If you want to install this into an existing game follow these instructions:
6160

6261
Ensure that you have [Node.js](https://nodejs.org/en/download/) v14+ installed on your computer.
6362

@@ -67,48 +66,70 @@ Ensure that you have [rojo](https://rojo.space/docs/v7/getting-started/installat
6766
1. Install `npm install @quenty/loader`
6867
2. Sync in the `node_modules` folder using Rojo. A common file format is something like this:
6968

70-
This is a rojo `project.json` file:
69+
This is an example of a Rojo `project.json` file that is generated by the Nevermore CLI:
7170
```json
7271
{
73-
"name": "GameName",
72+
"name": "MyGame",
7473
"globIgnorePaths": [ "**/.package-lock.json" ],
7574
"tree": {
7675
"$className": "DataModel",
7776
"ServerScriptService": {
78-
"integration": {
79-
"$path": "node_modules"
77+
"MyGame": {
78+
"$className": "Folder",
79+
"game": {
80+
"$path": "src/modules"
81+
},
82+
"node_modules": {
83+
"$path": "node_modules"
84+
}
85+
},
86+
"GameNameScripts": {
87+
"$path": "src/scripts/Server"
88+
}
89+
},
90+
"StarterPlayer": {
91+
"StarterPlayerScripts": {
92+
"GameNameScripts": {
93+
"$path": "src/scripts/Client"
94+
}
8095
}
8196
}
8297
}
8398
}
8499
```
85100

86-
You can put the `node_modules` folder whereever you want, but the recommended location is `ServerScriptService`.
101+
You can put the `MyGame` folder wherever you want, but the recommended location is `ServerScriptService`.
87102

88-
In your main script you will need to "bootstrap" the components such that `script.Parent.loader` is defined. To do this the following snippet will work.
103+
In your main script you will need to "bootstrap" the components such that `script.Parent.loader` is defined. To do this the following snippet will work, and is generated by the Nevermore CLI as `ServerMain.server.lua`:
89104

90105
```lua
91106
local ServerScriptService = game:GetService("ServerScriptService")
92107

93-
local loader = ServerScriptService.Path.To.NodeModules:FindFirstChild("LoaderUtils", true).Parent
94-
local packages = require(loader).bootstrapGame(ServerScriptService.Path.To.NodeModules)
108+
local loader = ServerScriptService.MyGame:FindFirstChild("LoaderUtils", true).Parent
109+
local require = require(loader).bootstrapGame(ServerScriptService.MyGame)
95110
```
96111

97-
This will create the following components which you can rename if you want.
112+
This will create the following folders in ReplicatedStorage when the game loads:
113+
1. MyGame
114+
* game
115+
* Client
116+
* Shared
117+
* Server
118+
* node_modules
98119

99-
1. ReplicatedStorage.Packages
100-
2. ReplicatedStorage.SharedPackages
101-
3. ServerScriptService.Packages
120+
:::caution
121+
You might notice that the Server folder is also cloned to the `game` folder in ReplicatedStorage. This is an intentional optimization that only happens in Studio.
122+
:::
102123

103-
From here, every exported package will exist in the packages folder root, with only modules needed to be replicated.
124+
From here, every exported package will exist in the `node_modules` folder, populated only by modules that need to be replicated to that context.
104125

105-
To access the exported packages on the client, you perform the same bootstrap operation on the new replicated location.
126+
To access the exported packages on the client, you perform the same bootstrap operation on the new replicated location (also generated, as `ClientMain.client.lua`):
106127

107128
```lua
108129
local ReplicatedStorage = game:GetService("ReplicatedStorage")
109130

110-
local loader = ReplicatedStorage.Path.To.Replicated.NodeModules:FindFirstChild("LoaderUtils", true).Parent
111-
local packages = require(loader).bootstrapGame(ReplicatedStorage.Path.To.Replicated.NodeModules)
131+
local loader = ReplicatedStorage:WaitForChild("MyGame"):WaitForChild("loader")
132+
local require = require(loader).bootstrapGame(loader.Parent)
112133
```
113134

114135
Assuming you've changed nothing, the path to the replicated modules should be the same as the one used on the server, just indexed under ReplicatedStorage instead.
@@ -123,7 +144,7 @@ Ensure that you have [rojo](https://rojo.space/docs/v7/getting-started/installat
123144
1. Run `npm init`
124145
2. Run `npm install @quenty/loader` and whatever packages you want.
125146

126-
In your bootstrapping code you can write something like this for your server code.
147+
In your bootstrapping code you can write something like this for your server code.
127148

128149
Notice we manually transform and parent our returned loader components. this allows us to bootstrap the
129150
components. We then parent the client component into ReplicatedFirst with dependencies.
@@ -177,6 +198,12 @@ serviceBag:Start()
177198
```
178199

179200
## Manually installing with NPM for Plugins
201+
You can use the Nevermore CLI to generate a project structure for a new plugin.
202+
180203
Ensure that you have [Node.js](https://nodejs.org/en/download/) v14+ installed on your computer.
181204

182205
Ensure that you have [rojo](https://rojo.space/docs/v7/getting-started/installation/) v7+ installed on your computer.
206+
207+
```bash
208+
npx nevermore init-plugin
209+
```

0 commit comments

Comments
 (0)