Skip to content

Commit

Permalink
[#3, #4, #5, #6, #7] Update for v12
Browse files Browse the repository at this point in the history
  • Loading branch information
krbz999 committed Aug 29, 2024
1 parent 4d16f6d commit aef2ac0
Show file tree
Hide file tree
Showing 18 changed files with 1,596 additions and 120 deletions.
44 changes: 44 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"globals": {},
"env": {
"browser": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"indent": ["error", 2, {"SwitchCase": 1}],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"quote-props": ["error", "as-needed"],
"array-bracket-newline": ["error", "consistent"],
"no-unused-vars": 0,
"key-spacing": "error",
"comma-dangle": "error",
"space-in-parens": ["error", "never"],
"space-infix-ops": 2,
"keyword-spacing": 2,
"semi-spacing": 2,
"no-multi-spaces": 2,
"no-extra-semi": 2,
"no-whitespace-before-property": 2,
"space-unary-ops": 2,
"no-multiple-empty-lines": ["error", {"max": 1, "maxEOF": 0}],
"object-curly-spacing": ["error", "never"],
"comma-spacing": ["error"],
"no-undef": "off",
"space-before-blocks": 2,
"arrow-spacing": 2,
"eol-last": ["error", "always"],
"no-mixed-operators": ["error", {
"allowSamePrecedence": true,
"groups": [
["==", "!=", "===", "!==", ">", ">=", "<", "<=", "&&", "||", "in", "instanceof"]
]
}]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.mjs text eol=lf
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: zhell
open_collective: # Replace with a single Open Collective username
ko_fi: zhell
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: File an issue about unexpected behaviour
title: "[BUG]"
labels: ''
assignees: ''

---

**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.

**Setup**
Describe your foundry setup.
- Module version:
- Foundry core version and build:
- Other modules disabled? Yes/No

**Additional context**
Add any other context about the problem here.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE REQUEST]"
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Setup**
- Module version:
- Foundry core version and build:
- [Does your feature request involve other modules? If so, list them here.]

**Additional context**
Add any other context or screenshots about the feature request here.
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Release Creation

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

# Combine CSS files into a single CSS file
- name: Combine CSS files
run: |
cat styles/*.css > module.css
# Get part of the tag after the `v`.
- name: Extract tag version number
id: get_version
uses: battila7/get-version-action@v2

# Remove HotReload and update version, download, and style properties.
- name: Modify Manifest to remove HotReload
uses: microsoft/variable-substitution@v1
with:
files: "module.json"
env:
flags.hotReload: false
version: ${{steps.get_version.outputs.version-without-v}}
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/module.zip
styles: "[\"module.css\"]"
esmodules: "[\"module.mjs\"]"

# Set up Node
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: '20.10.0'
cache: 'npm'

# `npm ci` is recommended:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
- name: Install Dependencies
run: npm ci

# Run build scripts
- name: Build All
run: npm run build

# Create zip file.
- name: Create ZIP archive
run: zip -r ./module.zip module.json module.mjs module.css lang/ templates/

# Create a release for this specific version.
- name: Update Release with Files
if: "!github.event.release.prerelease"
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
name: ${{ github.event.release.name }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "./module.json, ./module.zip"
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
46 changes: 46 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features",
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 125,
"editor.rulers": [
{
"column": 125,
"color": "#ff00ff9a"
}
]
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"javascript.format.semicolons": "insert",
"css.format.spaceAroundSelectorSeparator": true,
"css.lint.duplicateProperties": "warning",
"css.lint.zeroUnits": "warning",
"editor.tabSize": 2,
"editor.formatOnSave": false,
"editor.formatOnSaveMode": "modifications",
"files.trimTrailingWhitespace": true,
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"javascript.validate.enable": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.autoClosingTags": false,
"typescript.check.npmIsInstalled": false,
"typescript.disableAutomaticTypeAcquisition": true,
"typescript.format.enable": false,
"typescript.format.insertSpaceAfterCommaDelimiter": false,
"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"typescript.format.insertSpaceAfterKeywordsInControlFlowStatements": false,
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false,
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"typescript.suggest.enabled": false,
"typescript.surveys.enabled": false,
"typescript.validate.enable": false,
"html.format.wrapLineLength": 125,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"eslint.validate": ["javascript"]
}
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Interested in following along with development of any of my modules? Join the [Discord server](https://discord.gg/QAG8eWABGT).
Interested in following along with development of any of my modules? Join the [Discord server](https://discord.gg/QAG8eWABGT).

# Door Macro
Apply macro directly to the door.
Expand All @@ -11,3 +11,10 @@ Open a door's config and enter the macro editor placed in the header (door icon)
If the macro needs to do things only a GM is allowed to do, like toggle lights for example, you can set the macro to be executed as GM. This will cause the macro to find the first active GM available and execute it as them. If not set to be executed as GM, the macro is executed as the user who changed the state of the door.

In addition, there is now `WallDocument#callMacro(type="never", options={})`, which can be used to execute an arbitrary script embedded on the Door manually. The types are "whenOpened", "whenClosed", "whenLocked", "whenUnlocked", "whenHidden", "whenRevealed", and "never", the last of which is never executed automatically.

When a script is executed, the following parameters are made available:
- `door`: The `WallDocument` that was changed.
- `scene`: The `Scene` in which the door is embedded.
- `event`: An object containing additional data.
- `event.user`: The `User` that triggered the script.
- `event.trigger`: The triggering event name from the list above.
8 changes: 6 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"DOORMACRO.AS_GM": "Execute as GM:",
"DOORMACRO.AS_GM": "Execute as GM",
"DOORMACRO.AsGMTooltip": "Run this embedded script as if the first found GM client had executed it.",
"DOORMACRO.Door": "Door: {id}",
"DOORMACRO.never": "Never Automatically",
Expand All @@ -8,5 +8,9 @@
"DOORMACRO.whenLocked": "When Locked",
"DOORMACRO.whenOpened": "When Opened",
"DOORMACRO.whenRevealed": "When Revealed",
"DOORMACRO.whenUnlocked": "When Unlocked"
"DOORMACRO.whenUnlocked": "When Unlocked",
"DOORMACRO.Config": {
"Title": "Door Macro: {id}",
"Command": "Command: {trigger}"
}
}
20 changes: 13 additions & 7 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"id": "doormacro",
"title": "Door Macro",
"version": "11.0.1",
"version": "AUTOMATIC",
"authors": [
{
"name": "Zhell",
"url": "https://github.com/krbz999",
"discord": "Zhell#9201",
"ko-fi": "https://ko-fi.com/zhell"
"discord": "zhell9201",
"ko-fi": "https://ko-fi.com/zhell",
"patreon": "https://patreon.com/zhell"
}
],
"compatibility": {
"minimum": "11",
"maximum": "11",
"verified": "11"
"minimum": 12,
"verified": 12
},
"esmodules": [
"setup.mjs"
Expand All @@ -29,7 +29,13 @@
"flags": {}
}
],
"flags": {
"hotReload": {
"extensions": ["json", "css"],
"paths": ["styles/*.css", "lang/en.json"]
}
},
"url": "https://github.com/krbz999/doormacro",
"manifest": "https://github.com/krbz999/doormacro/releases/latest/download/module.json",
"download": "https://github.com/krbz999/doormacro/releases/download/v11.0.1/module.zip"
"download": "AUTOMATIC"
}
Loading

0 comments on commit aef2ac0

Please sign in to comment.