Usage
Creating a new project
In order to create a new project you need to run:Commands
Multiple commands exist in the CLI:build
Used to build your nanoforge project.-d, --directory <directory>specify the working directory of the command.-c, --config <config>path to the config file. (Schema)--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)
create
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. (Schema)-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.
dev
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. (Schema)--generategenerate app files from config, like generate command in dev mode. (default:false)
editor
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.
generate
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. (Schema)--editorgenerate the editor main file.--watchgenerate app in watching mode. (default:false)
install/add
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)
login
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.
logout
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.
new
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.
publish
Used to publish a package to the Nanoforge registry.-d, --directory <directory>specify the working directory of the command.
start
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”). (Schema)-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.
unpublish
Used to unpublish a package from the Nanoforge registry.-d, --directory <directory>specify the working directory of the command.
Environment Variables
When running a NanoForge game (vianf start), environment variables can be passed to the client and server applications through a .env file at the root of the project or directly in the environment.
| 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 <https://github.com/NanoForge-dev/Engine/tree/main/packages/config>__.