Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs.json

This file was deleted.

54 changes: 54 additions & 0 deletions docs/docs/commands/1-overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: Commands
description: Overview of every NanoForge CLI command
---

import { Card, CardGroup } from "mintlify/components";

## Using the CLI

Every command follows the same shape:

```bash
nf [command] [options]
```

Most commands accept `-d, --directory <directory>` to set the working directory and
`-c, --config <config>` to point at a specific configuration file. Run any command with `--help` to
see its full option list:

```bash
nf <command> --help
```

## Available commands

<CardGroup cols={2}>
<Card title="new" href="./2-commands/1-new">
Scaffold a brand new NanoForge project.
</Card>
<Card title="dev" href="./2-commands/2-dev">
Run your project in development mode with watching.
</Card>
<Card title="build" href="./2-commands/3-build">
Compile your client and server for production.
</Card>
<Card title="start" href="./2-commands/4-start">
Serve a built project, optionally over HTTPS.
</Card>
<Card title="generate" href="./2-commands/5-generate">
Generate project files from your configuration.
</Card>
<Card title="create" href="./2-commands/6-create">
Create a single component or system.
</Card>
<Card title="install / add" href="./2-commands/7-install">
Add components, systems, or libraries from the registry.
</Card>
<Card title="editor" href="./2-commands/8-editor">
Launch the NanoForge visual editor.
</Card>
<Card title="registry" href="./2-commands/9-registry">
Authenticate, publish, and unpublish packages.
</Card>
</CardGroup>
54 changes: 54 additions & 0 deletions docs/docs/commands/2-commands/1-new.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: new
description: Create a new NanoForge project
---

## Overview

`nf new` scaffolds a brand new NanoForge project. Run without flags it is fully interactive,
prompting for everything it needs. Any answer can be supplied up front as a flag to skip the
corresponding prompt.

## Usage

```bash
nf new
```

## Options

| Option | Description |
| ---------------------------------------------- | ----------------------------------------------------------------------- |
| `-d, --directory <directory>` | Working directory of the command. |
| `--name <name>` | Name of your project. |
| `--path <path>` | Relative path where the project is created (default: the project name). |
| `--package-manager <pm>` | Package manager: `npm`, `yarn`, `pnpm`, or `bun`. |
| `--language <language>` | Project language: `ts` or `js`. |
| `--strict` / `--no-strict` | Enable or disable strict mode. |
| `--server` / `--no-server` | Generate a server alongside the client. |
| `--init-functions` / `--no-init-functions` | Add lifecycle init functions. |
| `--skip-install` / `--no-skip-install` | Skip installing dependencies after scaffolding. |
| `--docker` / `--no-docker` | Generate Docker files. |
| `--no-lint` | Skip generating lint configuration files. |
| `--editor` | Add editor dependencies. |
| `--git` / `--no-git` | Initialize a git repository. |
| `--git-remote <gitRemote>` / `--no-git-remote` | Set up a git remote (requires `--git`). |

## Examples

**Interactive:**

```bash
nf new
```

**Non-interactive TypeScript project with a server:**

```bash
nf new \
--name my-game \
--language ts \
--package-manager pnpm \
--server \
--no-docker
```
37 changes: 37 additions & 0 deletions docs/docs/commands/2-commands/2-dev.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: dev
description: Run your NanoForge project in development mode
---

## Overview

`nf dev` runs your NanoForge project in development mode. It is the command you keep open while
working — it serves the game and reacts to changes.

## Usage

```bash
nf dev
```

## Options

| Option | Description |
| ----------------------------- | ------------------------------------------------------------------------------------------ |
| `-d, --directory <directory>` | Working directory of the command. |
| `-c, --config <config>` | Path to the configuration file. |
| `--generate` | Generate app files from config in dev mode, like the `generate` command. Default: `false`. |

## Examples

**Standard dev run:**

```bash
nf dev
```

**Regenerate files from config while developing:**

```bash
nf dev --generate
```
45 changes: 45 additions & 0 deletions docs/docs/commands/2-commands/3-build.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: build
description: Build your NanoForge project for production
---

## Overview

`nf build` compiles your NanoForge project. The client and server entry points, static directories,
and output directories all default to the values in your
[configuration file](../../configuration/1-configuration-file) and can be overridden per run.

## Usage

```bash
nf build
```

## Options

| Option | Description |
| --------------------------------------- | -------------------------------------- |
| `-d, --directory <directory>` | Working directory of the command. |
| `-c, --config <config>` | Path to the configuration file. |
| `--client-entry <clientEntry>` | Entry file of the client. |
| `--server-entry <serverEntry>` | Entry file of the server. |
| `--client-static-dir <clientStaticDir>` | Static directory of the client. |
| `--server-static-dir <serverStaticDir>` | Static directory of the server. |
| `--client-out-dir <clientOutDir>` | Output directory of the client. |
| `--server-out-dir <serverOutDir>` | Output directory of the server. |
| `--editor` | Build with the editor configuration. |
| `--watch` | Build in watch mode. Default: `false`. |

## Examples

**Build using the configuration defaults:**

```bash
nf build
```

**Rebuild on change with a custom client output directory:**

```bash
nf build --watch --client-out-dir dist/client
```
51 changes: 51 additions & 0 deletions docs/docs/commands/2-commands/4-start.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: start
description: Start a built NanoForge project
---

import { Note } from "mintlify/components";

## Overview

`nf start` serves a previously built NanoForge project. It launches the loader (the website that
loads the game) and, when enabled, the server. It can also serve over HTTPS when given a
certificate and key.

## Usage

```bash
nf start
```

## Options

| Option | Description |
| -------------------------------- | ----------------------------------------------------------------- |
| `-d, --directory <directory>` | Working directory of the command. |
| `-c, --config <config>` | Path to the configuration file. Default: `nanoforge.config.json`. |
| `-p, --port <port>` | Port of the loader (the website that loads the game). |
| `--client-dir <clientDirectory>` | Directory of the built client. |
| `--server-dir <serverDirectory>` | Directory of the built server. |
| `--watch` | Run in watch mode. Default: `false`. |
| `--cert <cert>` | Path to the SSL certificate for HTTPS. |
| `--key <key>` | Path to the SSL key for HTTPS. |

## Examples

**Start on a custom port:**

```bash
nf start --port 8080
```

**Start over HTTPS:**

```bash
nf start --cert ./certs/cert.pem --key ./certs/key.pem
```

<Note>
Environment variables (for example server addresses and ports) are read from a `.env` file at the
project root when the game starts. See [Environment
variables](../../configuration/2-environment-variables).
</Note>
39 changes: 39 additions & 0 deletions docs/docs/commands/2-commands/5-generate.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: generate
description: Generate NanoForge project files from configuration
---

## Overview

`nf generate` generates project files from your [configuration](../../configuration/1-configuration-file).
It reads the config and produces the entry files and wiring your project needs, including the editor
main file when requested.

## Usage

```bash
nf generate
```

## Options

| Option | Description |
| ----------------------------- | ----------------------------------------- |
| `-d, --directory <directory>` | Working directory of the command. |
| `-c, --config <config>` | Path to the configuration file. |
| `--editor` | Generate the editor main file. |
| `--watch` | Generate in watch mode. Default: `false`. |

## Examples

**Generate once:**

```bash
nf generate
```

**Regenerate on change, including the editor entry:**

```bash
nf generate --editor --watch
```
42 changes: 42 additions & 0 deletions docs/docs/commands/2-commands/6-create.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: create
description: Create a NanoForge component or system
---

## Overview

`nf create` scaffolds a single ECS **component** or **system** in your project. By default it
creates files for the client; pass `--server` to target the server instead.

## Usage

```bash
nf create <type>
```

`<type>` is either `component` or `system`.

## Options

| Option | Description |
| ----------------------------- | ------------------------------------------------------------- |
| `<type>` | The type to create: `component` or `system`. |
| `-d, --directory <directory>` | Working directory of the command. |
| `-c, --config <config>` | Path to the configuration file. |
| `-n, --name <name>` | Name of the component or system. |
| `-s, --server` | Create on the server instead of the client. Default: `false`. |
| `-p, --path <path>` | Path to the component/system folder. |

## Examples

**Create a client component:**

```bash
nf create component --name Position
```

**Create a server system:**

```bash
nf create system --name Movement --server
```
46 changes: 46 additions & 0 deletions docs/docs/commands/2-commands/7-install.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: install / add
description: Add components, systems, or libraries to your project
---

import { Note } from "mintlify/components";

## Overview

`nf install` (aliased as `nf add`) pulls components, systems, or libraries from the NanoForge
registry into your project. By default it installs components and systems for the client; use
`--lib` for libraries and `--server` to target the server.

## Usage

```bash
nf install [names...]
```

## Options

| Option | Description |
| ----------------------------- | ------------------------------------------------------------------ |
| `[names...]` | Names of the components/systems/libraries to install. |
| `-d, --directory <directory>` | Working directory of the command. |
| `-l, --lib` | Install a library instead of a component/system. Default: `false`. |
| `-s, --server` | Install on the server instead of the client. Default: `false`. |

## Examples

**Install a component for the client:**

```bash
nf install my-org/health-bar
```

**Install a library on the server:**

```bash
nf add my-org/physics --lib --server
```

<Note>
Installing from a private scope may require authentication. See the [registry
commands](./9-registry) to log in first.
</Note>
Loading
Loading