Foundryborne Daggerheart

repository·main·Indexed 41 days ago

https://github.com/foundryborne/daggerheart

A community-driven system for the Foundry Virtual Tabletop (VTT) designed to support the Daggerheart tabletop roleplaying game.

Tokens
1.9K
Snippets
4
Records
6
Agent score
2%

What's inside Foundryborne Daggerheart

  1. Install Foundryborne Daggerheart for Foundry VTT

    main

    You can install the Daggerheart system for Foundry VTT using one of three methods:

    1. In-App Search (Recommended): Search for Daggerheart or Foundryborne within the System Installation dialog in the FoundryVTT admin settings.
    2. Manifest URL: Paste the following URL into the Install System dialog on the FoundryVTT Setup menu: https://raw.githubusercontent.com/Foundryborne/daggerheart/refs/heads/main/system.json
    3. Manual Install: Download a .zip archive from the GitHub Releases page and extract it into your Foundry Data folder at Data/systems/daggerheart.
    https://raw.githubusercontent.com/Foundryborne/daggerheart/refs/heads/main/system.json
  2. Set up a development environment for Daggerheart

    main

    To develop on the Daggerheart system, follow these steps:

    1. Navigate to the repository directory:
      cd <path>/<to>/<repo>
    2. Install dependencies:
      npm install
    3. Configure environment variables: Copy .env.example to .env. You must set:
      • foundry path: Must point to main.js.
      • data path: Must point to the folder containing the Data folder (do not point to the Data folder itself).
    4. Setup symlinks: Run the following command in a shell with elevated privileges to set up types and symlink the daggerheart folder into your Foundry data:
      npm run createSymlink
    5. Start development:
      npm start
  3. Available development scripts

    main

    The following npm scripts are available for development:

    • npm start: Starts development mode with file watching and automatically launches Foundry.
    • npm run build: Performs a one-time build of the project.
    • npm run createSymlink: Sets up types and creates necessary output symlinks.
    npm start
    npm run build
    npm run createSymlink
  4. Global variables for JavaScript files

    main

    For .js and .mjs files, the ESLint configuration defines a set of read-only global variables to prevent no-undef errors. These include browser globals, project-specific constants (CONFIG, CONST), and various Foundry/PIXI/ProseMirror related classes and namespaces.

    Global Classes & Namespaces:

    • Color, Handlebars, Hooks, PIXI, ProseMirror, Roll
    • canvas, foundry, game, ui
    • ActiveEffect, Actor, BaseScene, ChatMessage, Combat, Combatant, Item, Macro, Scene, TokenDocument, RollTable
    • Collection, FormDataExtended, TextEditor

    Global Functions:

    • fromUuid, fromUuidSync, getDocumentClass, _del, _replace, _loc
    // Excerpt of globals defined in eslint.config.mjs
    languageOptions: {
        globals: {
            ...globals.browser,
            CONFIG: 'readonly',
            CONST: 'readonly',
            Color: 'readonly',
            Handlebars: 'readonly',
            Hooks: 'readonly',
            PIXI: 'readonly',
            ProseMirror: 'readonly',
            Roll: 'readonly',
            canvas: 'readonly',
            foundry: 'readonly',
            game: 'readonly',
            ui: 'readonly',
            fromUuid: 'readonly',
            fromUuidSync: 'readonly',
            getDocumentClass: 'readonly',
            _del: 'readonly',
            _replace: 'readonly',
            _loc: 'readonly',
            ActiveEffect: 'readonly',
            Actor: 'readonly',
            BaseScene: 'readonly',
            ChatMessage: 'readonly',
            Combat: 'readonly',
            Combatant: 'readonly',
            Item: 'readonly',
            Macro: 'readonly',
            Scene: 'readonly',
            TokenDocument: 'readonly',
            RollTable: 'readonly',
            Collection: 'readonly',
            FormDataExtended: 'readonly',
            TextEditor: 'readonly'
        }
    }
  5. Configure stylistic rules via stylisticRules

    main

    The project exports a stylisticRules object intended for use in ESLint configurations. It uses the @stylistic/eslint-plugin to enforce specific code formatting and style patterns. Key configurations include:

    • Indentation: 4 spaces, with 1 space for SwitchCase.
    • Line Length: Maximum of 120 characters, ignoring comments, strings, template literals, and regex literals.
    • Quotes: Single quotes, but allows template literals.
    • Arrow Functions: Parentheses are used only as needed.
    • Comma Dangle: Set to never.
    • Spacing: Enforces specific spacing for infix operators, keywords, semi-colons, unary operators, and more.
    export const stylisticRules = {
        '@stylistic/indent': [
            'error',
            4,
            {
                SwitchCase: 1
            }
        ],
        '@stylistic/max-len': ['error', { 
            code: 120,
            ignoreComments: true,
            ignoreStrings: true,
            ignoreTemplateLiterals: true,
            ignoreRegExpLiterals: true
        }],
        '@stylistic/quotes': ['error', 'single', { allowTemplateLiterals: 'always' }],
        '@stylistic/arrow-parens': ['error', 'as-needed'],
        '@stylistic/quote-props': ['error', 'as-needed'],
        '@stylistic/array-bracket-newline': ['error', 'consistent'],
        '@stylistic/key-spacing': 'error',
        '@stylistic/comma-dangle': ['error', 'never'],
        '@stylistic/space-in-parens': ['error', 'never'],
        '@stylistic/space-infix-ops': 2,
        '@stylistic/keyword-spacing': 2,
        '@stylistic/semi-spacing': 2,
        '@stylistic/no-multi-spaces': 2,
        '@stylistic/no-extra-semi': 2,
        '@stylistic/no-whitespace-before-property': 2,
        '@stylistic/space-unary-ops': 2
    };