Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepared a builder process for generate the packs directly from the project #283

Closed
wants to merge 15 commits into from
Closed
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ''

---

**Module Version:** v0.0.0

**Before open any issue**

1) Enable the module setting _"Enable debugging"_
2) Click F12 go to the _console_ tab
3) make the test you want and replicate the error
4) Go to the tab console open on point 2) and just right click and click 'Save as' and 'Save' or send a screenshot of the exception on the console.
5) Attach the text file on the github issue with all the logs related tot he module, or send a screenshot of the messages on the console.

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Browser:**
-

**Foundry Version:**

**Game System:**

**Additional context**
Add any other context (like other modules installed) about the problem here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---


82 changes: 82 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Thanks to Calego / ElfFriend (https://github.com/ElfFriend-DnD/) for the initial reference for this GH Action.
name: Module Tag / Release

on:
push:
tags:
- "v*"

jobs:
build:
environment: default
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2


- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "14.x"


- name: Install Dependencies
run: |
npm install -g yarn
yarn install


- name: Get Release Version From Tag
id: get_version
uses: battila7/get-version-action@0db33b6cb875aa6bc761ca535b74aef8925a6f0c


- name: Prepare Module Manifest
id: sub_manifest_link_version
uses: microsoft/variable-substitution@v1
with:
files: 'module.json'
env:
version: ${{steps.get_version.outputs.version-without-v}}
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json
download: https://github.com/${{github.repository}}/releases/download/${{steps.get_version.outputs.version}}/module.zip


- name: Build Release
run: |
set -euo pipefail
npm run-script build
npm run-script package


# Generate changelog for release body
- name: Generate Changelog
uses: scottbrenner/generate-changelog-action@f17b985298496cf8df35aa1104091c51e7bfea95
env:
REPO: ${{ github.repository }}


# Create a release for this specific version
- name: Create Release
uses: ncipollo/release-action@238505795d6d58d49b78980f271f70dfcd8efb35
with:
allowUpdates: true
name: ${{ env.RELEASE_VERSION }}
body: |
${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: './module.json,./package/module.zip'
tag: ${{ env.RELEASE_VERSION }}


# Publish the release to FoundryVTT's package repository.
#- name: FoundryVTT AutoPublish
# uses: Varriount/[email protected]
# with:
# username: ${{ secrets.FOUNDRY_ADMIN_USER }}
# password: ${{ secrets.FOUNDRY_ADMIN_PW }}
# module-id: 288
# manifest-url: https://github.com/${{ github.repository }}/releases/download/${{ env.RELEASE_VERSION }}/module.json
# manifest-file: ./module.json
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Thumbs.db
node_modules
.idea
/dist
/package
11 changes: 11 additions & 0 deletions 5e/generic_macro.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "",
"permission":{"default":0 },
"type":"script",
"flags":{},
"scope":"global",
"command":"",
"author":"",
"img":"icons/svg/dice-target.svg",
"actorIds":[]
}
165 changes: 158 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# Foundry VTT Macros Repository

![Latest Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffoundry-vtt-community%2Fmacros%2Fmaster%2Fmodule.json&label=Latest%20Release&prefix=v&query=$.version&colorB=red&style=for-the-badge)
![Foundry Core Compatible Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffoundry-vtt-community%2Fmacros%2Fmaster%2Fmodule.json&label=Foundry%20Version&query=$.compatibleCoreVersion&colorB=orange&style=for-the-badge)
[![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Ffoundry_community_macros&colorB=006400&style=for-the-badge)](https://forge-vtt.com/bazaar#package=foundry_community_macros)
[![Foundry Hub Endorsements](https://img.shields.io/endpoint?logoColor=white&url=https%3A%2F%2Fwww.foundryvtt-hub.com%2Fwp-json%2Fhubapi%2Fv1%2Fpackage%2Ffoundry_community_macros%2Fshield%2Fendorsements&style=for-the-badge)](https://www.foundryvtt-hub.com/package/foundry_community_macros/)
![Latest Release Download Count](https://img.shields.io/github/downloads/foundry-vtt-community/macros/latest/module.zip?color=2b82fc&label=DOWNLOADS&style=for-the-badge) [![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Ffoundry_community_macros&colorB=006400&style=for-the-badge)](https://forge-vtt.com/bazaar#package=foundry_community_macros) ![Foundry Core Compatible Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffoundry-vtt-community%2Fmacros%2Fmaster%2Fmodule.json&label=Foundry%20Version&query=$.compatibleCoreVersion&colorB=orange&style=for-the-badge) ![Latest Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Ffoundry-vtt-community%2Fmacros%2Fmaster%2Fmodule.json&label=Latest%20Release&prefix=v&query=$.version&colorB=red&style=for-the-badge) [![Foundry Hub Endorsements](https://img.shields.io/endpoint?logoColor=white&url=https%3A%2F%2Fwww.foundryvtt-hub.com%2Fwp-json%2Fhubapi%2Fv1%2Fpackage%2Ffoundry_community_macros%2Fshield%2Fendorsements&style=for-the-badge)](https://www.foundryvtt-hub.com/package/foundry_community_macros/) ![GitHub all releases](https://img.shields.io/github/downloads/foundry-vtt-community/macros/total?style=for-the-badge)

Foundry community-contributed macros are noted here and merged into the Foundry Community Macros module for ease of use.

> Macros may cause unintended side effects, such as issues with performance. Please read the comments in each macro to understand how it works before running!

## Installation

### Usage as a Module
It's always easiest to install modules from the in game add-on browser.

You can now install this module automatically by specifying the following public module URL :
To install this module manually:
1. Inside the Foundry "Configuration and Setup" screen, click "Add-on Modules"
2. Click "Install Module"
3. In the "Manifest URL" field, paste the following url:
`https://raw.githubusercontent.com/foundry-vtt-community/macros/master/module.json`
4. Click 'Install' and wait for installation to complete
5. Don't forget to enable the module in game using the "Manage Module" button

`https://raw.githubusercontent.com/foundry-vtt-community/macros/main/module.json`
### Usage as a Module

As GM go to the **Manage Modules** options menu in your **World Settings** tab then enable the **Foundry Community Macros** module.

Expand All @@ -24,6 +27,7 @@ This module adds all of the community macros as a Compendium Packs called **FVTT
You can open these packs, right click and click on import the macros you want. You can then add these macros to the **Macro Toolbar** at the bottom of the screen.

### Usage without the Module:

1. Download the `.js` file to your machine
2. Create a new macro in Foundry VTT
3. Give it a name and set the **Type** to "Script"
Expand All @@ -46,3 +50,150 @@ You can make pull requests to add or update macros here: [https://github.com/fou
2. Click on add file at the top
3. Name your file with a `.js` ending and paste your content and save (add details in the description field of your `.js` file)
4. Save the file and then open a pull request (GitHub should walk you through these steps)

## How prepare the Build for the dynamic build action ?

To simplify the creation of packs with a github action activate during the creaion of the release we can use this method:

1. Go under a macros folder like `5e`
2. Choose a macro like `stealth_check.js` an create a new json file with the same base name `stealth_check.json`
3. Prepare a json structure for your macro entry:

Here a json example:

```json
{
"name":"Stealth Check",
"permission":{"default":0 },
"type":"script",
"flags":{},
"scope":"global",
"command":"", // HERE IS WHERE THE ACTION PROCESS WILL PUT THE TEXT OF THE MACRO
"author":"",
"img":"icons/svg/dice-target.svg",
"actorIds":[],
"_id":"2RitOkKtnQe9pbuF" // THIS IS OPTIONAL BUT ESSENTIAL IF YOU WANT TO MAINTAIN THE REFERENCE OR NEDB WILL CREATE A NEW ONE
}
```

**Point 2 and 3 are optional** if no javascript file is founded we use the generic json model `generic_macro.json`, the '_id' attribute will be generated from the nedb library, here the example:

```json
{
"name": "<NAME OF THE FILE MACRO JAVASCRIPT>",
"permission":{"default":0 },
"type":"script",
"flags":{},
"scope":"global",
"command":"", // HERE IS WHERE THE ACTION PROCESS WILL PUT THE TEXT OF THE MACRO
"author":"",
"img":"icons/svg/dice-target.svg",
"actorIds":[]
}
```

## Other macro repositories with some good macros from the community

- [Kekilla0 Personal-Macros](https://github.com/Kekilla0/Personal-Macros)
- [Otigon Foundry-Macros](https://github.com/otigon/Foundry-Macros)
- [MisterHims DnD5e-WildShape-Macro](https://github.com/MisterHims/DnD5e-WildShape-Macro)
- [Crymic foundry-vtt-macros](https://gitlab.com/crymic/foundry-vtt-macros)
- [Rinnocenti Personal-Macros](https://github.com/rinnocenti/Personal-Macros)
- [VanceCole macros](https://github.com/VanceCole/macros)
- [Unsoluble fvtt-macros](https://github.com/unsoluble/fvtt-macros)
- [flamewave000 fvtt-macros](https://github.com/flamewave000/fvtt-macros)
- [itamarcu foundry-macros](https://github.com/itamarcu/foundry-macros)
- [itamarcu shemetz-macros](https://github.com/itamarcu/shemetz-macros)
- [trioderegion fvtt-macros](https://github.com/trioderegion/fvtt-macros)
- [theripper93 FoundryVTT-Macro](https://github.com/theripper93/FoundryVTT-Macros)
- [Freeze020 foundry-vtt-scripts](https://gitlab.com/Freeze020/foundry-vtt-scripts)
- [Jeznar Utility-Macros](https://github.com/Jeznar/Utility-Macros)
- [Kuffeh1 Foundry](https://github.com/Kuffeh1/Foundry)
- [caewok Foundry-Macros](https://github.com/caewok/Foundry-Macros)
- [GeneralZero FounderyMacros](https://github.com/GeneralZero/FounderyMacros)
- [JamesBrandts FoundryVTT Macro](https://github.com/JamesBrandts/FoundryVTT)

# Build

## Install all packages

```bash
npm install
```
## npm build scripts

### build

will build the code and copy all necessary assets into the dist folder and make a symlink to install the result into your foundry data; create a
`foundryconfig.json` file with your Foundry Data path.

```json
{
"dataPath": "~/.local/share/FoundryVTT/"
}
```

`build` will build and set up a symlink between `dist` and your `dataPath`.

```bash
npm run-script build
```

### NOTE:

You don't need to build the `foundryconfig.json` file you can just copy the content of the `dist` folder on the module folder under `modules` of Foundry

### build:watch

`build:watch` will build and watch for changes, rebuilding automatically.

```bash
npm run-script build:watch
```

### clean

`clean` will remove all contents in the dist folder (but keeps the link from build:install).

```bash
npm run-script clean
```
### lint and lintfix

`lint` launch the eslint process based on the configuration [here](./.eslintrc)

```bash
npm run-script lint
```

`lintfix` launch the eslint process with the fix argument

```bash
npm run-script lintfix
```

### prettier-format

`prettier-format` launch the prettier plugin based on the configuration [here](./.prettierrc)

```bash
npm run-script prettier-format
```

### package

`package` generates a zip file containing the contents of the dist folder generated previously with the `build` command. Useful for those who want to manually load the module or want to create their own release

```bash
npm run-script package
```

## [Changelog](./changelog.md)

## Issues

Any issues, bugs, or feature requests are always welcome to be reported directly to the [Issue Tracker](https://github.com/foundry-vtt-community/macros/issues ), or using the [Bug Reporter Module](https://foundryvtt.com/packages/bug-reporter/).

## License

This Foundry VTT module is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) and the [Foundry Virtual Tabletop Limited License Agreement for module development](https://foundryvtt.com/article/license/).
5 changes: 5 additions & 0 deletions foundryconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dataPath": "/absolute/path/to/your/FoundryVTT/Data",
"repository": "",
"rawURL": ""
}
Loading