Compare commits

..

No commits in common. "master" and "0.3.0" have entirely different histories.

47 changed files with 5042 additions and 4052 deletions

View file

@ -19,7 +19,6 @@ module.exports = {
plugins: [],
globals: {
DefaultTokenConfig: false,
PrototypeTokenDocument: false,
},
@ -29,7 +28,7 @@ module.exports = {
overrides: [
{
files: ['./*.js', './*.cjs', './*.mjs', './tools/**/*'],
files: ['./*.js', './tools/**/*'],
env: {
node: true,
browser: false,

160
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,160 @@
# SPDX-FileCopyrightText: 2021 Johannes Loher
# SPDX-FileCopyrightText: 2021 Oliver Rümpelein
#
# SPDX-License-Identifier: MIT
image: node:lts
stages:
- test
- build
- prepare-release
- release
- publish
cache: &global_cache
paths:
- .yarn/cache
lint:
stage: test
before_script:
- yarn install --immutable
script:
- yarn lint
cache:
<<: *global_cache
reuse:
stage: test
image:
name: fsfe/reuse:latest
entrypoint: ['']
script:
- reuse lint
build:
stage: build
before_script:
- yarn install --immutable
- if [[ ! -z ${CI_COMMIT_TAG+x} ]]; then export NODE_ENV=production; fi
script:
- yarn build
- mv dist darkness-dependent-vision
cache:
<<: *global_cache
artifacts:
paths:
- darkness-dependent-vision
expire_in: 1 week
publish-artifacts:
stage: prepare-release
image: alpine:latest
before_script:
- apk update
- apk add zip curl
script: |
zip -r darkness-dependent-vision.zip darkness-dependent-vision/*
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file darkness-dependent-vision.zip "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/$CI_COMMIT_TAG/darkness-dependent-vision.zip"
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file darkness-dependent-vision/module.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/$CI_COMMIT_TAG/module.json"
rules:
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
changelog:
stage: prepare-release
before_script:
- yarn install --immutable
script:
- yarn changelog
cache:
<<: *global_cache
artifacts:
paths:
- CHANGELOG.md
rules:
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
.release-template: &release-template
stage: release
before_script:
- yarn install --immutable
- apt update
- apt install --yes jq
- REPOSITORY_URL=$(echo "${CI_REPOSITORY_URL}" | sed -e "s|gitlab-ci-token:.*@|${RELEASE_TOKEN}:${RELEASE_TOKEN_SECRET}@|g")
- git remote set-url origin $REPOSITORY_URL
- git config user.name $GITLAB_USER_LOGIN
- git config user.email $GITLAB_USER_EMAIL
- git branch -D ci-processing || true
- git checkout -b ci-processing
cache:
<<: *global_cache
script: |
yarn bump-version --release=${RELEASE_TYPE}
RELEASE_VERSION=$(jq -r '.version' < package.json)
git add package.json src/module.json
git --no-pager diff
git commit -m "chore(release): ${RELEASE_VERSION}"
git tag -f ${RELEASE_VERSION}
git push origin ci-processing:${CI_BUILD_REF_NAME} -o ci.skip
git push origin ${RELEASE_VERSION}
only:
- master
when: manual
release-patch:
variables:
RELEASE_TYPE: patch
<<: *release-template
release-minor:
variables:
RELEASE_TYPE: minor
<<: *release-template
release-major:
variables:
RELEASE_TYPE: major
<<: *release-template
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo 'release job'
rules:
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
release:
tag_name: $CI_COMMIT_TAG
description: './CHANGELOG.md'
assets:
links:
- name: 'darkness-dependent-vision.zip'
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/$CI_COMMIT_TAG/darkness-dependent-vision.zip'
filepath: /darkness-dependent-vision.zip
link_type: package
- name: 'module.json'
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/$CI_COMMIT_TAG/module.json'
filepath: /module.json
link_type: other
publish-latest-manifest:
stage: publish
image: alpine:latest
before_script:
- apk update
- apk add zip curl
script: |
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file darkness-dependent-vision/module.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/darkness-dependent-vision/latest/module.json"
rules:
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
publish-to-foundry-admin:
stage: publish
image: johannesloher/foundry-publish
variables:
FVTT_MANIFEST_PATH: darkness-dependent-vision/module.json
FVTT_MANIFEST_URL: ${CI_PROJECT_URL}/-/releases/${CI_COMMIT_TAG}/downloads/module.json
script: foundry-publish
rules:
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'

View file

@ -1,7 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: darkness-dependent-vision
Upstream-Contact: Johannes Loher <johannes.loher@fg4f.de>
Source: https://git2.f3l.de/saluu/darkness-dependent-vision
Source: https://git.f3l.de/ghost/darkness-dependent-vision
Files: .yarn/**
Copyright: Copyright (c) 2016-present, Yarn Contributors. All rights reserved.

View file

@ -1,32 +0,0 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
variables:
- &node_image node:lts
when:
- event: push
- event: tag
- event: manual
steps:
install:
image: *node_image
commands:
- yarn install --immutable
lint:
group: test
image: *node_image
commands:
- yarn lint
reuse:
group: test
image: fsfe/reuse:latest
commands:
- reuse lint
build:
group: build
image: *node_image
commands:
- yarn build

View file

@ -1,72 +0,0 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
variables:
- &node_image node:lts
when:
event: tag
evaluate: CI_COMMIT_TAG matches "^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$"
depends_on:
- checks
steps:
install:
image: *node_image
commands:
- yarn install --immutable
build:
image: *node_image
environment:
NODE_ENV: production
commands:
- yarn build
package:
group: prepare-release
image: alpine:latest
commands:
- apk update
- apk add zip curl
- mv dist ${CI_REPO_NAME}
- zip -r ${CI_REPO_NAME}.zip ${CI_REPO_NAME}/*
changelog:
group: prepare-release
image: *node_image
commands:
- yarn changelog
release:
image: woodpeckerci/plugin-gitea-release
settings:
base_url: ${CI_FORGE_URL}
title: ${CI_COMMIT_TAG}
note: CHANGELOG.md
files:
- ${CI_REPO_NAME}.zip
- ${CI_REPO_NAME}/module.json
api_key:
from_secret: forge_token
publish-latest-manifest:
group: publish
image: alpine:latest
commands:
- apk update
- apk add curl
- 'curl --header "Authorization: token $${FORGE_TOKEN}" -X "DELETE" "${CI_FORGE_URL}/api/packages/${CI_REPO_OWNER}/generic/${CI_REPO_NAME}/latest/module.json"'
- 'curl --fail --header "Authorization: token $${FORGE_TOKEN}" --upload-file ${CI_REPO_NAME}/module.json "${CI_FORGE_URL}/api/packages/${CI_REPO_OWNER}/generic/${CI_REPO_NAME}/latest/module.json"'
secrets:
- forge_token
publish-to-foundry-admin:
group: publish
image: johannesloher/foundry-publish
environment:
FVTT_DELETE_OBSOLETE_VERSIONS: 'true'
commands:
- export FVTT_MANIFEST_PATH=${CI_REPO_NAME}/module.json
- export FVTT_MANIFEST_URL=${CI_REPO_URL}/releases/download/${CI_COMMIT_TAG}/module.json
- foundry-publish
secrets:
- fvtt_package_id
- fvtt_username
- fvtt_password

View file

@ -1,39 +0,0 @@
# SPDX-FileCopyrightText: 2023 Johannes Loher
#
# SPDX-License-Identifier: MIT
variables:
- &node_image node:lts
when:
event: manual
branch: ${CI_REPO_DEFAULT_BRANCH}
depends_on:
- checks
steps:
install:
image: *node_image
commands:
- yarn install --immutable
release:
image: *node_image
commands:
- apt-get update
- apt-get install --yes jq
- export REPOSITORY_URL=$(echo "${CI_REPO_CLONE_URL}" | sed -e "s|://|://$${FORGE_TOKEN_NAME}:$${FORGE_TOKEN}@|g")
- git remote set-url origin $${REPOSITORY_URL}
- git config user.name woodpecker[bot]
- git config user.email woodpecker[bot]@${CI_SYSTEM_HOST}
- yarn bump-version --release=${RELEASE_TYPE}
- export RELEASE_VERSION=$(jq -r '.version' < package.json)
- git --no-pager diff
- git add package.json module.json
- 'git commit -m "chore(release): $${RELEASE_VERSION}"'
- git tag -f $${RELEASE_VERSION}
- git push origin ${CI_COMMIT_BRANCH}
- git push origin $${RELEASE_VERSION}
secrets:
- forge_token_name
- forge_token

768
.yarn/releases/yarn-3.1.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View file

@ -1,20 +1,20 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const relPnpApiPath = "../../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
// Setup the environment to be able to require eslint/lib/api.js
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);
// Defer to the real eslint/lib/api.js your application uses
module.exports = absRequire(`eslint/lib/api.js`);

View file

@ -1,6 +1,6 @@
{
"name": "eslint",
"version": "8.25.0-sdk",
"version": "8.1.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
}

View file

@ -1,13 +1,13 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../.pnp.cjs";
const relPnpApiPath = "../../../.pnp.js";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {

View file

@ -1,6 +1,6 @@
{
"name": "prettier",
"version": "2.7.1-sdk",
"version": "2.4.1-sdk",
"main": "./index.js",
"type": "commonjs"
}

View file

@ -2,4 +2,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
yarnPath: .yarn/releases/yarn-3.8.6.cjs
yarnPath: .yarn/releases/yarn-3.1.1.cjs

View file

@ -7,12 +7,21 @@ SPDX-License-Identifier: MIT
This project is being developed under the terms of the
[LIMITED LICENSE AGREEMENT FOR MODULE DEVELOPMENT] for Foundry Virtual Tabletop.
The project itself is licensed under multiple licenses. [REUSE] is used to
specify the licenses for the individual files. Most of the licenses are
specified either inside the source file or by an accompanying `.license` file,
but for some files, the licenses are specified in [.reuse/dep5].
The project itself is licensed under multiple licenses. It is difficult to keep
this section up to date, so here is a brief summary as of June 2021:
* The images in [img] are licensed under [CC BY 4.0].
* The files in [.yarn] by the [Yarn] Contributors are licensed under
[BSD-2-Clause].
* Other files are licensed under [MIT].
For more accurate information, check the individual files.
[Yarn]: https://github.com/yarnpkg/berry
[LIMITED LICENSE AGREEMENT FOR MODULE DEVELOPMENT]: https://foundryvtt.com/article/license/
[REUSE]: https://reuse.software/
[.reuse/dep5]: .reuse/dep5
[CC BY 4.0]: LICENSES/CC-BY-4.0.txt
[MIT]: LICENSES/MIT.txt
[BSD-2-Clause]: LICENSES/BSD-2-Clause.txt
[img]: img
[.yarn]: .yarn

View file

@ -6,12 +6,6 @@ SPDX-License-Identifier: MIT
# Darkness Dependent Vision
[![status-badge](https://ci.f3l.de/api/badges/1/status.svg)](https://ci.f3l.de/repos/1)
[![REUSE status](https://api.reuse.software/badge/git2.f3l.de/saluu/darkness-dependent-vision)](https://api.reuse.software/info/git2.f3l.de/saluu/darkness-dependent-vision)
[![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%2Fdarkness-dependent-vision&colorB=4aa94a)](https://forge-vtt.com/bazaar#package=darkness-dependent-vision)
[![Supported foundry versions](https://img.shields.io/endpoint?url=https://foundryshields.com/version?url=https%3A%2F%2Fgit2.f3l.de%2Fapi%2Fpackages%2Fsaluu%2Fgeneric%2Fdarkness-dependent-vision%2Flatest%2Fmodule.json)](https://git2.f3l.de/saluu/darkness-dependent-vision)
[![Ko-fi](https://img.shields.io/badge/Ko--fi-ghostfvtt-00B9FE?logo=kofi)](https://ko-fi.com/ghostfvtt)
A module for [Foundry Virtual Tabletop] that provides functionality to make the
dim and bright vision of tokens depend on the scene's darkness level.
@ -21,12 +15,12 @@ To install and use the Darkness Dependent Vision module for Foundry Virtual
Tabletop, simply paste the following URL into the **Install Module** dialog on
the Setup menu of the application.
https://git2.f3l.de/api/packages/saluu/generic/darkness-dependent-vision/latest/module.json
https://git.f3l.de/ghost/darkness-dependent-vision/-/raw/latest/src/module.json?inline=false
### libWrapper
This module uses the [libWrapper] library for wrapping core methods. It is only
a soft dependency (a shim is provided) but it is highly recommended to install
a soft dependency (a shim is provided) but it is highly recommended installing
libWrapper as a module for the best experience and compatibility with other
modules.
@ -116,13 +110,23 @@ it to work.
This project is being developed under the terms of the
[LIMITED LICENSE AGREEMENT FOR MODULE DEVELOPMENT] for Foundry Virtual Tabletop.
The project itself is licensed under multiple licenses. [REUSE] is used to
specify the licenses for the individual files. Most of the licenses are
specified either inside the source file or by an accompanying `.license` file,
but for some files, the licenses are specified in [.reuse/dep5].
The project itself is licensed under multiple licenses. It is difficult to keep
this section up to date, so here is a brief summary as of June 2021:
* The images in [img] are licensed under [CC BY 4.0].
* The files in [.yarn] by the [Yarn] Contributors are licensed under
[BSD-2-Clause].
* Other files are licensed under [MIT].
For more accurate information, check the individual files.
[Foundry Virtual Tabletop]: http://foundryvtt.com
[libWrapper]: https://github.com/ruipin/fvtt-lib-wrapper
[Yarn]: https://github.com/yarnpkg/berry
[LIMITED LICENSE AGREEMENT FOR MODULE DEVELOPMENT]: https://foundryvtt.com/article/license/
[REUSE]: https://reuse.software/
[.reuse/dep5]: .reuse/dep5
[CC BY 4.0]: LICENSES/CC-BY-4.0.txt
[MIT]: LICENSES/MIT.txt
[BSD-2-Clause]: LICENSES/BSD-2-Clause.txt
[img]: img
[.yarn]: .yarn

View file

@ -1,41 +0,0 @@
{
"name": "darkness-dependent-vision",
"id": "darkness-dependent-vision",
"title": "Darkness Dependent Vision",
"description": "A module for Foundry Virtual Tabletop that provides functionality to make the dim and bright vision of tokens depend on the scene's darkness level.",
"version": "0.3.13",
"author": "Johannes Loher",
"authors": [
{
"name": "Johannes Loher",
"email": "johannes.loher@fg4f.de"
}
],
"minimumCoreVersion": "9.236",
"compatibleCoreVersion": "9",
"compatibility": {
"minimum": "9.236",
"verified": "9",
"maximum": "9"
},
"esmodules": ["darkness-dependent-vision.js"],
"languages": [
{
"lang": "de",
"name": "Deutsch",
"path": "lang/de.json"
},
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
}
],
"url": "https://git2.f3l.de/saluu/darkness-dependent-vision",
"manifest": "https://git2.f3l.de/api/packages/saluu/generic/darkness-dependent-vision/latest/module.json",
"download": "https://git2.f3l.de/saluu/darkness-dependent-vision/releases/download/0.3.13/darkness-dependent-vision.zip",
"bugs": "https://git2.f3l.de/saluu/darkness-dependent-vision/issues",
"changelog": "https://git2.f3l.de/saluu/darkness-dependent-vision/releases/tag/0.3.13",
"readme": "https://git2.f3l.de/saluu/darkness-dependent-vision/raw/tag/0.3.13/README.md",
"license": "https://git2.f3l.de/saluu/darkness-dependent-vision/raw/tag/0.3.13/LICENSE.md"
}

View file

@ -1,16 +1,16 @@
{
"private": true,
"name": "darkness-dependent-vision",
"version": "0.3.13",
"version": "0.3.0",
"description": "A module for Foundry Virtual Tabletop that provides functionality to make the dim and bright vision of tokens depend on the scene's darkness level.",
"license": "https://git2.f3l.de/saluu/darkness-dependent-vision/src/branch/master/LICENSE.md",
"homepage": "https://git2.f3l.de/saluu/darkness-dependent-vision",
"license": "https://git.f3l.de/ghost/darkness-dependent-vision#licensing",
"homepage": "https://git.f3l.de/ghost/darkness-dependent-vision",
"repository": {
"type": "git",
"url": "https://git2.f3l.de/saluu/darkness-dependent-vision"
"url": "https://git.f3l.de/ghost/darkness-dependent-vision"
},
"bugs": {
"url": "https://git2.f3l.de/saluu/darkness-dependent-vision/issues"
"url": "https://git.f3l.de/ghost/darkness-dependent-vision/-/issues"
},
"contributors": [
{
@ -18,7 +18,6 @@
"email": "johannes.loher@fg4f.de"
}
],
"type": "module",
"scripts": {
"build": "run-s clean:files build:files",
"build:files": "rollup -c",
@ -36,30 +35,31 @@
"changelog": "conventional-changelog -p conventionalcommits -o CHANGELOG.md -r 2"
},
"devDependencies": {
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@guanghechen/rollup-plugin-copy": "6.0.2",
"@commitlint/cli": "15.0.0",
"@commitlint/config-conventional": "15.0.0",
"@guanghechen/rollup-plugin-copy": "1.8.5",
"@typhonjs-fvtt/eslint-config-foundry.js": "0.8.0",
"conventional-changelog-cli": "5.0.0",
"conventional-changelog-conventionalcommits": "8.0.0",
"eslint": "8.57.1",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "4.2.1",
"fs-extra": "11.2.0",
"gulp": "5.0.0",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"conventional-changelog-cli": "^2.1.1",
"conventional-changelog-conventionalcommits": "^4.6.1",
"eslint": "8.5.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "4.0.0",
"fs-extra": "10.0.0",
"gulp": "4.0.2",
"husky": "7.0.4",
"lint-staged": "12.1.2",
"npm-run-all": "4.1.5",
"prettier": "2.8.8",
"rimraf": "6.0.1",
"rollup": "4.24.0",
"prettier": "2.5.1",
"rimraf": "3.0.2",
"rollup": "2.61.1",
"rollup-plugin-sourcemaps": "0.6.3",
"rollup-plugin-terser": "7.0.2",
"semver": "7.6.3",
"yargs": "17.7.2"
"semver": "7.3.5",
"yargs": "17.3.0"
},
"lint-staged": {
"*.(js|mjs|cjs)": "eslint --fix",
"*.(json|css|yml)": "prettier --write"
},
"packageManager": "yarn@3.8.6"
"packageManager": "yarn@3.1.1"
}

View file

@ -1,7 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", ":automergeAll", ":automergeBranch", ":prHourlyLimitNone", ":prConcurrentLimitNone"],
"lockFileMaintenance": {
"enabled": true
}
"extends": ["config:base", ":automergeAll", ":automergeBranch", ":prHourlyLimitNone", ":prConcurrentLimitNone"]
}

View file

@ -2,28 +2,18 @@
//
// SPDX-License-Identifier: MIT
import { copy } from '@guanghechen/rollup-plugin-copy';
import copy from '@guanghechen/rollup-plugin-copy';
import sourcemaps from 'rollup-plugin-sourcemaps';
import { terser } from 'rollup-plugin-terser';
import { distDirectory, name, sourceDirectory } from './tools/const.mjs';
const staticFiles = [
'.reuse',
'img',
'lang',
'LICENSE.md',
'LICENSES',
'module.json.license',
'module.json',
'README.md',
'templates',
];
const staticFiles = ['module.json', 'lang', 'templates'];
const isProduction = process.env.NODE_ENV === 'production';
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
input: { [`${name}`]: `${sourceDirectory}/${name}.js` },
input: { [`module/${name}`]: `${sourceDirectory}/module/${name}.js` },
output: {
dir: distDirectory,
format: 'es',
@ -31,8 +21,9 @@ const config = {
assetFileNames: '[name].[ext]',
},
plugins: [
sourcemaps(),
copy({
targets: [{ src: staticFiles, dest: distDirectory }],
targets: [{ src: staticFiles.map((file) => `${sourceDirectory}/${file}`), dest: distDirectory }],
}),
isProduction && terser({ ecma: 2020, keep_fnames: true }),
],

35
src/module.json Normal file
View file

@ -0,0 +1,35 @@
{
"name": "darkness-dependent-vision",
"title": "Darkness Dependent Vision",
"description": "A module for Foundry Virtual Tabletop that provides functionality to make the dim and bright vision of tokens depend on the scene's darkness level.",
"version": "0.3.0",
"author": "Johannes Loher",
"authors": [
{
"name": "Johannes Loher",
"email": "johannes.loher@fg4f.de"
}
],
"minimumCoreVersion": "9.236",
"compatibleCoreVersion": "9",
"esmodules": ["module/darkness-dependent-vision.js"],
"languages": [
{
"lang": "de",
"name": "Deutsch",
"path": "lang/de.json"
},
{
"lang": "en",
"name": "English",
"path": "lang/en.json"
}
],
"url": "https://git.f3l.de/ghost/darkness-dependent-vision",
"manifest": "https://git.f3l.de/api/v4/projects/ghost%2Fdarkness-dependent-vision/packages/generic/darkness-dependent-vision/latest/module.json",
"download": "https://git.f3l.de/ghost/darkness-dependent-vision/-/releases/0.3.0/downloads/darkness-dependent-vision.zip",
"license": "https://git.f3l.de/ghost/darkness-dependent-vision#licensing",
"readme": "https://git.f3l.de/ghost/darkness-dependent-vision/-/blob/master/README.md",
"bugs": "https://git.f3l.de/ghost/darkness-dependent-vision/-/issues",
"changelog": "https://git.f3l.de/ghost/darkness-dependent-vision/-/releases/0.3.0"
}

View file

@ -52,10 +52,6 @@ export class DarknessDependentVisionConfig extends FormApplication {
return `${name}: ${game.i18n.localize('DarknessDependentVision.Title')}`;
}
get isDefault() {
return this.options.tokenConfig instanceof DefaultTokenConfig;
}
async getData() {
const data = this.isPrototype ? this.actor.data.token : this.token.data;
return {
@ -73,23 +69,9 @@ export class DarknessDependentVisionConfig extends FormApplication {
}
async _updateObject(event, formData) {
// Configure the Default Token Configuration
if (this.isDefault) {
const current = game.settings.get('core', DefaultTokenConfig.SETTING);
const update = foundry.utils.mergeObject(current, formData, { inplace: false });
const result = await game.settings.set('core', DefaultTokenConfig.SETTING, update);
const tokenConfig = this.options.tokenConfig;
tokenConfig.data = new foundry.data.TokenData(result);
tokenConfig.object = new TokenDocument(tokenConfig.data, { actor: null });
tokenConfig.token = tokenConfig.object;
tokenConfig.render();
return result;
}
// Configure the Prototype Token data of an Actor
if (this.isPrototype) return this.actor.update({ token: formData });
// Update an embedded Token document
return this.token.update(formData);
else return this.token.update(formData);
}
}

View file

@ -22,7 +22,7 @@ function onGetTokenConfigHeaderButtons(tokenConfig, buttons) {
class: 'configure-darkness-dependent-vision',
icon: 'fas fa-eye',
onclick: async () => {
return new DarknessDependentVisionConfig(tokenConfig.object, { tokenConfig }).render(true);
return new DarknessDependentVisionConfig(tokenConfig.object).render(true);
},
});
}

View file

@ -1,16 +1,11 @@
// SPDX-License-Identifier: MIT
// Copyright © 2021 fvtt-lib-wrapper Rui Pinheiro
'use strict';
// 2021 Johannes Loher
//
// SPDX-License-Identifier: MIT
// A shim for the libWrapper library
export let libWrapper = undefined;
export const VERSIONS = [1, 12, 1];
export const TGT_SPLIT_RE = new RegExp('([^.[]+|\\[(\'([^\'\\\\]|\\\\.)+?\'|"([^"\\\\]|\\\\.)+?")\\])', 'g');
export const TGT_CLEANUP_RE = new RegExp('(^\\[\'|\'\\]$|^\\["|"\\]$)', 'g');
// Main shim code
Hooks.once('init', () => {
// Check if the real module is already loaded - if so, use it
if (globalThis.libWrapper && !(globalThis.libWrapper.is_fallback ?? true)) {
@ -24,31 +19,14 @@ Hooks.once('init', () => {
return true;
}
static get WRAPPER() {
return 'WRAPPER';
}
static get MIXED() {
return 'MIXED';
}
static get OVERRIDE() {
return 'OVERRIDE';
}
static register(package_id, target, fn, type = 'MIXED', { chain = undefined, bind = [] } = {}) {
static register(package_id, target, fn, type = 'MIXED', { chain = undefined } = {}) {
const is_setter = target.endsWith('#set');
target = !is_setter ? target : target.slice(0, -4);
const split = target.match(TGT_SPLIT_RE).map((x) => x.replace(/\\(.)/g, '$1').replace(TGT_CLEANUP_RE, ''));
const split = target.split('.');
const fn_name = split.pop();
const root_nm = split.splice(0, 1)[0];
let obj, fn_name;
if (split.length == 0) {
obj = globalThis;
fn_name = root_nm;
} else {
const _eval = eval;
fn_name = split.pop();
obj = split.reduce((x, y) => x[y], globalThis[root_nm] ?? _eval(root_nm));
}
const _eval = eval; // The browser doesn't expose all global variables (e.g. 'Game') inside globalThis, but it does to an eval. We copy it to a variable to have it run in global scope.
const obj = split.reduce((x, y) => x[y], globalThis[root_nm] ?? _eval(root_nm));
let iObj = obj;
let descriptor = null;
@ -58,19 +36,18 @@ Hooks.once('init', () => {
iObj = Object.getPrototypeOf(iObj);
}
if (!descriptor || descriptor?.configurable === false)
throw new Error(
`libWrapper Shim: '${target}' does not exist, could not be found, or has a non-configurable descriptor.`,
);
throw `libWrapper Shim: '${target}' does not exist, could not be found, or has a non-configurable descriptor.`;
let original = null;
const wrapper =
chain ?? (type.toUpperCase?.() != 'OVERRIDE' && type != 3)
? function (...args) {
return fn.call(this, original.bind(this), ...bind, ...args);
chain ?? type != 'OVERRIDE'
? function () {
return fn.call(this, original.bind(this), ...arguments);
}
: function (...args) {
return fn.call(this, ...bind, ...args);
: function () {
return fn.apply(this, arguments);
};
if (!is_setter) {
if (descriptor.value) {
original = descriptor.value;
@ -80,7 +57,7 @@ Hooks.once('init', () => {
descriptor.get = wrapper;
}
} else {
if (!descriptor.set) throw new Error(`libWrapper Shim: '${target}' does not have a setter`);
if (!descriptor.set) throw `libWrapper Shim: '${target}' does not have a setter`;
original = descriptor.set;
descriptor.set = wrapper;
}
@ -91,8 +68,11 @@ Hooks.once('init', () => {
};
//************** USER CUSTOMIZABLE:
// Set up the ready hook that shows the "libWrapper not installed" warning dialog. Remove if undesired.
{
// Whether to warn GM that the fallback is being used
const WARN_FALLBACK = true;
// Set up the ready hook that shows the "libWrapper not installed" warning dialog
if (WARN_FALLBACK) {
//************** USER CUSTOMIZABLE:
// Package ID & Package Title - by default attempts to auto-detect, but you might want to hardcode your package ID and title here to avoid potential auto-detect issues
const [PACKAGE_ID, PACKAGE_TITLE] = (() => {

View file

@ -3,32 +3,29 @@
// SPDX-License-Identifier: MIT
import fs from 'fs-extra';
import path from 'node:path';
import semver from 'semver';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
const packageType = 'module';
const repositoryOwner = process.env.CI_REPO_OWNER;
const repositoryName = process.env.CI_REPO_NAME;
const repositoryURL = process.env.CI_REPO_LINK;
const forgeURL = process.env.CI_FORGE_URL;
import { sourceDirectory } from './const.mjs';
const manifestURL = `${forgeURL}/api/packages/${repositoryOwner}/generic/${repositoryName}/latest/${packageType}.json`;
const getDownloadURL = (version) => `${repositoryURL}/releases/download/${version}/${repositoryName}.zip`;
const bugsURL = `${repositoryURL}/issues`;
const getChangelogURL = (version) => `${repositoryURL}/releases/tag/${version}`;
const getReadmeURL = (version) => `${repositoryURL}/raw/tag/${version}/README.md`;
const getLicenseURL = (version) => `${repositoryURL}/raw/tag/${version}/LICENSE.md`;
const manifestPath = `${packageType}.json`;
const getDownloadURL = (version) =>
`https://git.f3l.de/ghost/darkness-dependent-vision/-/releases/${version}/downloads/darkness-dependent-vision.zip`;
const getChangelogURL = (version) => `https://git.f3l.de/ghost/darkness-dependent-vision/-/releases/${version}`;
/**
* Get the contents of the manifest file as object.
* @returns {unknown} An object describing the manifest
* @returns {{file: unknown, name: string}} An object describing the manifest
*/
function getManifest() {
const manifestPath = path.join(sourceDirectory, 'module.json');
if (fs.existsSync(manifestPath)) {
return fs.readJSONSync(manifestPath);
return {
file: fs.readJSONSync(manifestPath),
name: 'module.json',
};
}
}
@ -71,16 +68,11 @@ function bumpVersion(release) {
console.log(`Bumping version number to '${targetVersion}'`);
packageJson.version = targetVersion;
fs.writeJSONSync('package.json', packageJson, { spaces: 2 });
manifest.version = targetVersion;
manifest.url = repositoryURL;
manifest.manifest = manifestURL;
manifest.download = getDownloadURL(targetVersion);
manifest.bugs = bugsURL;
manifest.changelog = getChangelogURL(targetVersion);
manifest.readme = getReadmeURL(targetVersion);
manifest.license = getLicenseURL(targetVersion);
fs.writeJSONSync(manifestPath, manifest, { spaces: 2 });
fs.writeJSONSync('package.json', packageJson, { spaces: 4 });
manifest.file.version = targetVersion;
manifest.file.download = getDownloadURL(targetVersion);
manifest.file.changelog = getChangelogURL(targetVersion);
fs.writeJSONSync(path.join(sourceDirectory, manifest.name), manifest.file, { spaces: 4 });
}
const argv = yargs(hideBin(process.argv)).usage('Usage: $0').option('release', {

View file

@ -7,7 +7,7 @@ import path from 'node:path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { destinationDirectory, distDirectory, foundryconfigFile, name } from './const.mjs';
import { destinationDirectory, distDirectory, foundryconfigFile, name, sourceDirectory } from './const.mjs';
/**
* Get the data path of Foundry VTT based on what is configured in the {@link foundryconfigFile}.
@ -29,7 +29,7 @@ function getDataPath() {
* @param {boolean} clean Whether to remove the link instead of creating it
*/
async function linkPackage(clean) {
if (!fs.existsSync(path.resolve('module.json'))) {
if (!fs.existsSync(path.resolve(sourceDirectory, 'module.json'))) {
throw new Error('Could not find module.json');
}

6780
yarn.lock

File diff suppressed because it is too large Load diff