RC-4 | Repo initialization

This commit is contained in:
Oliver-Akins 2024-12-10 01:01:12 -07:00
parent 0787446c8d
commit a48071b29a
11 changed files with 2419 additions and 0 deletions

54
.github/workflows/draft-release.yaml vendored Normal file
View file

@ -0,0 +1,54 @@
name: Create Draft Release
on: [workflow_dispatch]
jobs:
everything:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v4
# Install node and NPM
- uses: actions/setup-node@v4
with:
node-version: "19"
# Install required packages
- run: npm install
- name: Reading the module.json for the version
id: "version"
run: cat module.json | echo version=`jq -r ".version"` >> "$GITHUB_OUTPUT"
# Check that tag doesn't exist
- uses: mukunku/tag-exists-action@v1.5.0
id: check-tag
with:
tag: "v${{ steps.version.outputs.version }}"
- name: "Ensure that the tag doesn't exist"
if: ${{ steps.check-tag.outputs.exists == 'true' }}
run: exit 1
- name: Ensure there are specific files to release
if: ${{ vars.files_to_release == '' }}
run: exit 1
- name: Move module.json to a temp file
id: manifest-move
run: mv module.json module.temp.json
- name: Update the download property in the manifest
id: manifest-update
run: cat module.temp.json | jq -r --tab '.download = "https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.version }}/release.zip"' > module.json
- name: Create the zip
run: zip -r release.zip ${{ vars.files_to_release }}
- name: Create the draft release
uses: ncipollo/release-action@v1
with:
tag: "v${{ steps.version.outputs.version }}"
commit: ${{ github.ref }}
draft: true
generateReleaseNotes: true
artifacts: "release.zip,module.json"

87
eslint.config.mjs Normal file
View file

@ -0,0 +1,87 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
export default [
// Tell eslint to ignore files that I don't mind being formatted slightly differently
{ ignores: [ `scripts/` ] },
{
languageOptions: {
globals: globals.browser,
},
},
pluginJs.configs.recommended,
// MARK: Foundry Globals
{
languageOptions: {
globals: {
CONFIG: `writable`,
game: `readonly`,
Handlebars: `readonly`,
Hooks: `readonly`,
ui: `readonly`,
Actor: `readonly`,
Actors: `readonly`,
Item: `readonly`,
Items: `readonly`,
foundry: `readonly`,
ChatMessage: `readonly`,
ActiveEffect: `readonly`,
Dialog: `readonly`,
renderTemplate: `readonly`,
TextEditor: `readonly`,
},
},
},
// MARK: Project Specific
{
plugins: {
"@stylistic": stylistic,
},
languageOptions: {
globals: {},
},
rules: {
"curly": `error`,
"func-names": [`warn`, `as-needed`],
"grouped-accessor-pairs": `error`,
"no-alert": `error`,
"no-empty": [`error`, { allowEmptyCatch: true }],
"no-implied-eval": `error`,
"no-invalid-this": `error`,
"no-lonely-if": `error`,
"no-unneeded-ternary": `error`,
"no-nested-ternary": `error`,
"no-var": `error`,
"no-unused-vars": [
`error`,
{
"vars": `local`,
"args": `after-used`,
"varsIgnorePattern": `^_`,
"argsIgnorePattern": `^_`,
},
],
"sort-imports": [`warn`, { "ignoreCase": true, "allowSeparatedGroups": true }],
"@stylistic/semi": [`warn`, `always`, { "omitLastInOneLineBlock": true }],
"@stylistic/no-trailing-spaces": `warn`,
"@stylistic/space-before-blocks": [`warn`, `always`],
"@stylistic/space-infix-ops": `warn`,
"@stylistic/eol-last": `warn`,
"@stylistic/operator-linebreak": [`warn`, `before`],
"@stylistic/indent": [`warn`, `tab`],
"@stylistic/brace-style": [`warn`, `1tbs`, { "allowSingleLine": true }],
"@stylistic/quotes": [`warn`, `backtick`, { "avoidEscape": true }],
"@stylistic/comma-dangle": [`warn`, { arrays: `always-multiline`, objects: `always-multiline`, imports: `always-multiline`, exports: `always-multiline`, functions: `always-multiline` }],
"@stylistic/comma-style": [`warn`, `last`],
"@stylistic/dot-location": [`error`, `property`],
"@stylistic/no-confusing-arrow": `error`,
"@stylistic/no-whitespace-before-property": `error`,
"@stylistic/nonblock-statement-body-position": [
`error`,
`beside`,
{ "overrides": { "while": `below` } },
],
},
},
];

1
langs/en-ca.json Normal file
View file

@ -0,0 +1 @@
{}

43
module.json Normal file
View file

@ -0,0 +1,43 @@
{
"id": "ripcrypt",
"title": "RipCrypt",
"description": "",
"version": "0.0.0",
"compatibility": {
"minimum": 12,
"verified": 12,
"maximum": 12
},
"authors": [
{
"name": "Oliver Akins",
"url": "https://oliver.akins.me"
}
],
"esmodules": [
"module/main.mjs"
],
"styles": [],
"languages": [
{
"lang": "en",
"name": "English (Canadian)",
"path": "langs/en-ca.json"
}
],
"url": "https://github.com/Oliver-Akins/Foundry-RipCrypt",
"manifest": "https://github.com/Oliver-Akins/Foundry-RipCrypt/releases/latest/download/module.json",
"download": "https://github.com/Oliver-Akins/Foundry-RipCrypt/releases/latest/download/release.zip",
"readme": "README.md",
"bugs": "",
"flags": {
"hotReload": {
"extensions": ["css", "hbs", "json", "mjs", "svg"],
"paths": ["Apps", "langs", "styles", "module"]
}
},
"documentTypes": {
"Actor": {},
"Item": {}
}
}

View file

@ -0,0 +1,17 @@
const loaders = {
svg(data) {
const iconName = data.path.split(`/`).slice(-1)[0].slice(0, -4);
Logger.debug(`hot-reloading icon: ${iconName}`);
Hooks.call(`${game.system.id}-hmr:svg`, iconName, data);
},
mjs() {window.location.reload()},
css(data) {
Logger.debug(`Hot-reloading CSS: ${data.path}`);
Hooks.call(`${game.system.id}-hmr:css`, data);
},
};
Hooks.on(`hotReload`, async (data) => {
if (!loaders[data.extension]) {return}
return loaders[data.extension](data);
});

5
module/hooks/init.mjs Normal file
View file

@ -0,0 +1,5 @@
import { Logger } from "../utils/Logger.mjs";
Hooks.once(`init`, () => {
Logger.log(`Initializing`);
});

5
module/hooks/ready.mjs Normal file
View file

@ -0,0 +1,5 @@
import { Logger } from "../utils/Logger.mjs";
Hooks.once(`ready`, () => {
Logger.log(`Ready`);
});

0
module/main.mjs Normal file
View file

22
module/utils/Logger.mjs Normal file
View file

@ -0,0 +1,22 @@
const augmentedProps = new Set([
`debug`,
`log`,
`error`,
`info`,
`warn`,
`group`,
`time`,
`timeEnd`,
`timeLog`,
`timeStamp`,
]);
/** @type {Console} */
export const Logger = new Proxy(console, {
get(target, prop, _receiver) {
if (augmentedProps.has(prop)) {
return (...args) => target[prop](game.system.id, `|`, ...args);
};
return target[prop];
},
});

2173
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

12
package.json Normal file
View file

@ -0,0 +1,12 @@
{
"devDependencies": {
"@eslint/js": "^9.16.0",
"@foundryvtt/foundryvtt-cli": "^1.0.3",
"@stylistic/eslint-plugin": "^2.12.0",
"eslint": "^9.16.0"
},
"scripts": {
"lint": "eslint --fix",
"lint:nofix": "eslint"
}
}