foundryvtt / foundryvtt-cli

The official Foundry VTT CLI
MIT License
60 stars 15 forks source link
cli foundryvtt foundryvtt-cli

foundryvtt-cli

The official Foundry VTT CLI

Installation

npm install -g @foundryvtt/foundryvtt-cli

Usage

Help

fvtt --help

Current CLI Version

fvtt --version

Configuration

fvtt configure

Determines if your configuration is correct and if not, prompts you to fix it.

View

fvtt configure view

View your current configuration.

Set

fvtt configure set "key" "value"

Set a configuration value.

Get

fvtt configure get "key"

Get a configuration value.

Path

fvtt configure path

Outputs the path to your configuration file.

Launch

fvtt launch

Launches Foundry VTT. Available options are:

Package

fvtt package

Output the current working package, if any.

Workon

fvtt package workon "1001-fish" --type "Module"

Swaps to working on a specific package, eliminating the need to pass --type and --id to other package commands.

Clear

fvtt package clear

Clears the current working package.

Unpack

fvtt package unpack "compendiumName"

Reads a database from the current Package /packs/ directory and writes each document as a serialized Object to its own file. There are a number of options available to customize the output, check out fvtt package unpack --help for more information.

Pack

fvtt package pack "compendiumName"

Reads a directory of serialized Objects and writes them to a database in the current Package /packs/ directory. There are a number of options available to customize the operation, check out fvtt package pack --help for more information.

Example Workflow

fvtt configure
fvtt package workon "1001-fish"
fvtt package unpack "fish"
. . . // Make some updates to the files
fvtt package pack "fish"

Development

git clone
cd foundryvtt-cli
npm install
npm run build
npm link

API

Certain internal functionality of the CLI is exposed as an API that can be imported into other projects.

Example Usage

import { compilePack, extractPack } from "@foundryvtt/foundryvtt-cli";

// Extract a NeDB compendium pack.
await extractpack("mymodule/packs/actors.db", "mymodule/packs/src/actors", { nedb: true });

// Compile a LevelDB compendium pack.
await compilePack("mymodule/packs/src/actors", "mymodule/packs/actors");

compilePack(src: string, dest: string, options?: object): Promise<void>

Compile source files into a compendium pack.

Parameters

extractPack(src: string, dest: string, options?: object): Promise<void>

Extract the contents of a compendium pack into individual source files for each primary Document.

Parameters

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.