Skip to content

Commit

Permalink
feat: switch to common package layout
Browse files Browse the repository at this point in the history
  * Bundle the es modules into a single one
  * Bundle the css files into a single one
  * Minify the bundles for production builds

BREAKING CHANGE: A lot of things have been moved around. In particular, the es modules
  * module/controls.js
  * filterEffects/FilterManager.js
  * filterEffects/filtersDB.js
  * specialEffects/specialsDB.js
  * specialEffects/SpecialsLayer.js
  * weatherEffects/weatherDB.js
  * weatherEffects/WeatherLayer.js

  do not exist anymore. Asset files also have been moved.
  • Loading branch information
ghost91- committed Dec 11, 2021
1 parent 5f16d83 commit 3f99379
Show file tree
Hide file tree
Showing 194 changed files with 18,292 additions and 1,635 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foundry.js
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
},

env: {
browser: true,
es2021: true,
jquery: true,
},

extends: ["eslint:recommended", "@typhonjs-fvtt/eslint-config-foundry.js/0.8.0", "plugin:prettier/recommended"],

plugins: [],

globals: {
PIXI: "readonly",
},

rules: {
// Specify any specific ESLint rules.
},

overrides: [
{
files: ["./*.js", "./tools/**/*"],
env: {
node: true,
browser: false,
},
},
],
};
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ko_fi: ghostfvtt
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2021 Johannes Loher
#
# SPDX-License-Identifier: MIT

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
65 changes: 65 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# SPDX-FileCopyrightText: 2021 Johannes Loher
#
# SPDX-License-Identifier: MIT

name: Checks

on:
- push
- pull_request

env:
node_version: 16

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

- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci --cache .npm --prefer-offline

- name: Lint
run: npm run lint

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

- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci --cache .npm --prefer-offline

- name: Build
run: npm run build
121 changes: 121 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# SPDX-FileCopyrightText: 2021 Johannes Loher
#
# SPDX-License-Identifier: MIT

name: Publish

on:
push:
tags:
- "v*.*.*"

env:
node_version: 16

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

- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci --cache .npm --prefer-offline

- name: Lint
run: npm run lint

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

- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci --cache .npm --prefer-offline

- name: Build
run: npm run build
env:
NODE_ENV: production

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: dist

publish:
needs:
- lint
- build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Download production artifacts for publication
uses: actions/download-artifact@v2
with:
name: dist
path: dist

- name: Create zip file
working-directory: ./dist
run: zip -r ../module.zip .

- name: Extract version
run: |
echo "::set-output name=version::$(jq -r '.version' package.json)"
id: extract_version

- name: Create release
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: false
name: ${{steps.extract_version.outputs.version}}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "./src/module.json, ./module.zip"

- name: Publish to Foundry Admin
uses: Varriount/[email protected]
with:
username: ${{ secrets.FVTT_USERNAME }}
password: ${{ secrets.FVTT_PASSWORD }}
module-id: ${{ secrets.FVTT_PACKAGE_ID }}
manifest-url: https://github.com/${{ github.repository }}/releases/download/v${{ steps.extract_version.outputs.version }}/module.json
manifest-file: ./src/module.json
107 changes: 107 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# SPDX-FileCopyrightText: 2021 Johannes Loher
#
# SPDX-License-Identifier: MIT

name: Release

on: workflow_dispatch

env:
node_version: 16

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

- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci --cache .npm --prefer-offline

- name: Lint
run: npm run lint

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

- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci --cache .npm --prefer-offline

- name: Build
run: npm run build

release:
needs:
- lint
- build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

- name: Install node
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: .npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci --cache .npm --prefer-offline

- name: Configure committer
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Bump version
uses: qzb/[email protected]

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_PAT }}
branch: ${{ github.ref }}
tags: true
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
fxmaster.lock
fxmaster.lock
node_modules/
foundry.js
dist/
.vscode/
foundryconfig.json
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: false,
printWidth: 120,
tabWidth: 2,
};
18 changes: 18 additions & 0 deletions .versionrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const manifest = {
filename: "src/module.json",
updater: require("./manifest-version-updater"),
};

const package = {
filename: "package.json",
type: "json",
};

const packageLock = {
filename: "package-lock.json",
type: "json",
};

module.exports = {
bumpFiles: [package, packageLock, manifest],
};
Loading

0 comments on commit 3f99379

Please sign in to comment.