npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@foundryvtt/foundryvtt-cli

v1.0.3

Published

The Official CLI for Foundry VTT

Downloads

1,339

Readme

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:

  • --demo - Launches Foundry VTT in demo mode.
  • --port 30000 - Launches Foundry VTT on a specific port.
  • --world my-world - Launches Foundry VTT straight into a specific world.
  • --noupnp - Disable UPnP port forwarding.
  • --noupdate - Disable automatic update checking.
  • --adminKey "ABC123" - The admin key to secure Foundry VTT's Setup screen with.

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

  • src: string The directory containing the source files.
  • dest: string The target compendium pack.
  • options: object
    • nedb: boolean = false Whether to operate on a NeDB database, otherwise a LevelDB database is assumed.
    • yaml: boolean = false Whether the source files are in YAML format, otherwise JSON is assumed.
    • log: boolean = false Whether to log operation progress to the console.
    • recursive: boolean = false Whether to recurse into child directories under src, otherwise only source files located directly under src will be used.
    • transformEntry: (entry: object): Promise<false|void> A function that is called on every entry. Returning false indicates that the entry should be discarded.

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

  • src: string The source compendium pack.
  • dest: string The directory to write the extracted files into.
  • options: object
    • nedb: boolean = false Whether to operate on a NeDB database, otherwise a LevelDB database is assumed.
    • yaml: boolean = false Whether the source files are in YAML format, otherwise JSON is assumed.
    • yamlOptions object = {} Options to pass to yaml.dump when serializing Documents.
    • log: boolean = false Whether to log operation progress to the console.
    • documentType: string For NeDB operations, a documentType must be provided. This should be the same as the pack's type field in the module.json or system.json.
    • transformEntry: (entry: object): Promise<false|void> A function that is called on every entry. Returning false indicates that the entry should be discarded.
    • transformName: (entry: object): Promise<string|void> A function that is called on every entry. The value returned from this will be used as the entry's filename and must include the appropriate file extension. If nothing is returned, an auto-generated name will be used instead.
    • jsonOptions: object
      • replacer: (key: string, value: any): any|Array<string|number> A replacer function or an array of property names in the object to include in the resulting string.
      • space: string|number A number of spaces or a string to use as indentation.

Contributing

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