This repository contains the CLI of NanoForge. Check releases to see versions of the CLI. Nanoforge is a powerful game engine for web browser.
To use Nanoforge CLI, please refer to the CLI documentation !
First, install the CLI :
npm install -g @nanoforge-dev/cliAnd then create a new project :
nf newThe documentation for nanoforge cli can be found at : https://nanoforge-dev.github.io/docs/cli
The nanoforge client interface has multiple commands usable :
nf [command] [options]Used to build your nanoforge project.
-d, --directory <directory>specify the working directory of the command.-c, --config <config>path to the config file.--client-entry <clientEntry>specify the entry file of the client.--server-entry <serverEntry>specify the entry file of the server.--client-static-dir <clientStaticDir>specify the static directory of the client.--server-static-dir <serverStaticDir>specify the static directory of the server.--client-out-dir <clientOutDir>specify the output directory of the client.--server-out-dir <serverOutDir>specify the output directory of the server.--editorbuild with editor config.--watchbuild app in watching mode. (default:false)
Used to create nanoforge components or systems.
<type>the type to create (component or system).-d, --directory <directory>specify the working directory of the command.-c, --config <config>path to the config file.-n, --name <name>name of the component/system.-s, --servercreate on server instead of client. (default:false)-p, --path <path>path to the component/system folder.
Used to run your nanoforge project in dev mode.
-d, --directory <directory>specify the working directory of the command.-c, --config <config>path to the config file.--generategenerate app files from config, like generate command in dev mode. (default:false)
Used to start the nanoforge editor.
[path]path to the project to open in the editor.-d, --directory <directory>specify the working directory of the command.--openopen the editor in the default web browser (default:trueif path is specified,falseotherwise).--no-opendo not open the editor in the default web browser.
Used to generate nanoforge project files from config.
-d, --directory <directory>specify the working directory of the command.-c, --config <config>path to the config file.--editorgenerate the editor main file.--watchgenerate app in watching mode. (default:false)
Used to add nanoforge components, systems or libraries to your project.
[names...]names of the components/systems/libraries to install.-d, --directory <directory>specify the working directory of the command.-l, --libinstall a library instead of a component/system. (default:false)-s, --serverinstall on server instead of client. (default:false)
Used to log in to the Nanoforge registry.
-d, --directory <directory>specify the working directory of the command.-l, --locallog in only for the current project. (default:false)-k, --api-key <key>API key for the Nanoforge registry.
Used to log out from the Nanoforge registry.
-d, --directory <directory>specify the working directory of the command.-l, --locallog out only for the current project.
Used to create a new nanoforge project.
-d, --directory <directory>specify the working directory of the command.--name <name>specify the name of your project.--path <path>specify the relative path where your project will be created (default: name of the project).--package-manager <packageManager>specify the package manager of your project.--language <language>specify the language of your project.--strictuse strict mode.--no-strictdo not use strict mode.--servercreate a server.--no-serverdo not create a server.--init-functionsinitialize functions.--no-init-functionsdo not initialize functions.--skip-installskip installing dependencies.--no-skip-installdo not skip installing dependencies.--dockergenerate docker files.--no-dockerdo not generate docker files.--no-lintdo not generate lint files.--editoradd editor dependencies.--gitgenerate a git repository.--no-gitdo not generate a git repository.--git-remote <gitRemote>set up a git remote (required if--gitis used).--no-git-remotedo not set up a git remote.
Used to publish a package to the Nanoforge registry.
-d, --directory <directory>specify the working directory of the command.
Used to start your nanoforge project.
-d, --directory <directory>specify the working directory of the command.-c, --config <config>path to the config file (default: "nanoforge.config.json").-p, --port <port>specify the port of the loader (the website to load the game).--client-dir <clientDirectory>specify the directory of the client.--server-dir <serverDirectory>specify the directory of the server.--watchrun app in watching mode. (default:false)--cert <cert>path to the SSL certificate for HTTPS.--key <key>path to the SSL key for HTTPS.
Used to unpublish a package from the Nanoforge registry.
-d, --directory <directory>specify the working directory of the command.
When running a NanoForge game with nf start, environment variables can be passed to the client and server applications via a .env file at the root of your project or directly in the environment.
NANOFORGE_CLIENT_SERVER_TCP_PORT=4445
NANOFORGE_CLIENT_SERVER_UDP_PORT=4444
NANOFORGE_CLIENT_SERVER_ADDRESS=127.0.0.1Variables are scoped by prefix:
| Prefix | Availability |
|---|---|
NANOFORGE_CLIENT_ |
Available in the client only |
NANOFORGE_SERVER_ |
Available in the server only |
NANOFORGE_ |
Available in both client and server |
Note: Prefixes are stripped before the variable is exposed to libraries.
For full documentation on how libraries consume these variables, see @nanoforge-dev/config.
Please read through our contribution guidelines before starting a pull request. We welcome contributions of all kinds, not just code! If you're stuck for ideas, look for the good first issue label on issues in the repository. If you have any questions about the project, feel free to ask them on Discussions. Before creating your own issue or pull request, always check to see if one already exists! Don't rush contributions, take your time and ensure you're doing it correctly.
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 ask on Discussions.
The config file schema can be found at : https://nanoforge-dev.github.io/docs/cli/config-schema.json
