generated from League-of-Foundry-Developers/foundry-typescript-template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2fac479
Showing
19 changed files
with
380 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var fs = require('fs'); | ||
console.log(JSON.parse(fs.readFileSync('dist/module.json', 'utf8')).includes.join(" ")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var fs = require('fs'); | ||
console.log(JSON.parse(fs.readFileSync('dist/module.json', 'utf8')).version); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Module CI/CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Get the version from 'module.json' | ||
- name: Get Version | ||
shell: bash | ||
id: get-version | ||
run: echo "::set-output name=version::$(node ./.github/workflows/get-version.js)" | ||
|
||
# Get the name from 'module.json' | ||
- name: Get Includes | ||
shell: bash | ||
id: get-includes | ||
run: echo "::set-output name=files::$(node ./.github/workflows/get-includes.js)" | ||
|
||
# create a zip file with all files required by the module to add to the release | ||
- name: Zip Files | ||
working-directory: ./dist #SORRY BUT YOU HAVE TO USE DIST JUST LIKE GET OVER IT OR FIGURE OUT A BETTER WAY | ||
run: zip -r ../module.zip ${{steps.get-includes.outputs.files}} | ||
|
||
#Useful only for the template so we can leave the manifest and download urls empty | ||
- name: Substitute Manifest and Download Links For Versioned Ones | ||
id: sub_manifest_link_latest | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: './dist/module.json' | ||
env: | ||
url: https://github.com/${{github.repository}} | ||
manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json | ||
download: https://github.com/${{github.repository}}/releases/latest/download/module.zip | ||
|
||
# Update the 'latest' release | ||
- name: Update Latest Release | ||
id: create_latest_release | ||
uses: ncipollo/release-action@v1 | ||
if: endsWith(github.ref, 'master') | ||
with: | ||
allowUpdates: true | ||
name: Latest | ||
draft: false | ||
prerelease: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
artifacts: './dist/module.json, ./module.zip' | ||
tag: latest | ||
|
||
#Substitute the Manifest and Download URLs in the module.json | ||
- name: Substitute Manifest and Download Links For Versioned Ones | ||
id: sub_manifest_link_version | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: './dist/module.json' | ||
env: | ||
url: https://github.com/${{github.repository}} | ||
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 | ||
|
||
# Create a release for this specific version | ||
- name: Create Version Release | ||
id: create_version_release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
allowUpdates: true # set this to false if you want to prevent updating existing releases | ||
name: Release ${{ steps.get-version.outputs.version }} | ||
draft: false | ||
prerelease: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
artifacts: './dist/module.json,./module.zip' | ||
tag: ${{ steps.get-version.outputs.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Spacemandev | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
![](https://img.shields.io/badge/Foundry-v0.7.9-informational) | ||
<!--- Downloads @ Latest Badge --> | ||
<!--- replace <user>/<repo> with your username/repository --> | ||
<!--- ![Latest Release Download Count](https://img.shields.io/github/downloads/<user>/<repo>/latest/module.zip) --> | ||
|
||
<!--- Forge Bazaar Install % Badge --> | ||
<!--- replace <your-module-name> with the `name` in your manifest --> | ||
<!--- ![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%2F<your-module-name>&colorB=4aa94a) --> | ||
|
||
# Changelog | ||
*Please for the love of all that you hold dear, do everyone a favor and include a changelog here rather than making people guess at the capabilities of your module since last release* | ||
|
||
# Description | ||
This is a typescript template to get you started. This is not intended for beginners. | ||
|
||
Please use the javascript template as necessary for your stuff. | ||
|
||
|
||
## Manifest Plus | ||
Adds the following fields to the manifest for package browsers to pick up and show information better: | ||
|
||
``` | ||
- includes: [] # list of files to include in the zip | ||
- icon: "" # link to icon img | ||
- cover: "" #link to cover img | ||
- screenshots: [] #links to screenshot images | ||
- video: "" | ||
- authors: [ | ||
{ | ||
"name": "name", | ||
"email": "email", | ||
"discord": "discord" | ||
} | ||
] | ||
``` | ||
|
||
|
||
## Versioned Releases | ||
|
||
The Github Actions script will automatically create a Latest release which will always have a module.json that points to the latest release, and a versioned release whenever you update the version in your module.json. | ||
|
||
This allows people who depend on a specific version of your module to just install that and be version locked. The versioned releases will *not* auto update. | ||
|
||
|
||
# License | ||
MIT License. Do what you will. PRs welcome. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Changelog | ||
*Please for the love of all that you hold dear, do everyone a favor and include a changelog here rather than making people guess at the capabilities of your module since last release* | ||
|
||
# Description | ||
This is a typescript template to get you started. This is not intended for beginners. | ||
|
||
Please use the javascript template as necessary for your stuff. | ||
|
||
|
||
## Manifest Plus | ||
Adds the following fields to the manifest for package browsers to pick up and show information better: | ||
|
||
``` | ||
- includes: [] # list of files to include in the zip | ||
- icon: "" # link to icon img | ||
- cover: "" #link to cover img | ||
- screenshots: [] #links to screenshot images | ||
- video: "" | ||
- authors: [ | ||
{ | ||
"name": "name", | ||
"email": "email", | ||
"discord": "discord" | ||
} | ||
] | ||
``` | ||
|
||
|
||
## Versioned Releases | ||
|
||
The Github Actions script will automatically create a Latest release which will always have a module.json that points to the latest release, and a versioned release whenever you update the version in your module.json. | ||
|
||
This allows people who depend on a specific version of your module to just install that and be version locked. The versioned releases will *not* auto update. | ||
|
||
|
||
# License | ||
MIT License. Do what you will. PRs welcome. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "foundry-typescript-template", | ||
"title": "Typescript Template", | ||
"description": "", | ||
"authors": [ | ||
{ | ||
"name": "spacemandev", | ||
"discord": "spacemandev#6256" | ||
} | ||
], | ||
"version": "0.0.1", | ||
"minimumCoreVersion": "0.6.0", | ||
"compatibleCoreVersion": "0.7.2", | ||
"url": "", | ||
"manifest": "", | ||
"download": "", | ||
"type": "module", | ||
"includes": [ | ||
"./assets/**", | ||
"./lang/**", | ||
"./scripts/**", | ||
"./styles/**", | ||
"./templates/**", | ||
"./module.json", | ||
"./README.md" | ||
], | ||
"media": [ | ||
{ | ||
"type": "icon", | ||
"location": "" | ||
}, | ||
{ | ||
"type": "cover", | ||
"location": "" | ||
}, | ||
{ | ||
"type": "screenshot", | ||
"location": "" | ||
} | ||
], | ||
"esmodules": [ | ||
"scripts/module.js" | ||
], | ||
"styles": [ | ||
"styles/module.css" | ||
], | ||
"languages": [ | ||
{ | ||
"lang": "en", | ||
"name": "English", | ||
"path": "lang/en.json" | ||
} | ||
] | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const gulp = require('gulp') | ||
const ts = require('gulp-typescript'); | ||
const project = ts.createProject('tsconfig.json') | ||
|
||
|
||
gulp.task('compile', () => { | ||
return gulp.src('src/**/*.ts') | ||
.pipe(project()) | ||
.pipe(gulp.dest('dist/')) | ||
}) | ||
|
||
gulp.task('copy', async () => { | ||
return new Promise((resolve,reject) => { | ||
gulp.src('README.md').pipe(gulp.dest("dist/")) | ||
gulp.src("src/module.json").pipe(gulp.dest('dist/')) | ||
gulp.src("src/lang/**").pipe(gulp.dest('dist/lang/')) | ||
gulp.src("src/templates/**").pipe(gulp.dest('dist/templates/')) | ||
gulp.src("src/styles/**").pipe(gulp.dest('dist/styles/')) | ||
gulp.src("src/assets/**").pipe(gulp.dest('dist/assets/')) | ||
resolve(); | ||
}) | ||
}) | ||
|
||
gulp.task('build', gulp.parallel('compile', 'copy')); | ||
|
||
|
||
/* | ||
// This is supposed to copy the dist folder into the modules directory for testing. Only works if you've set it up the right way | ||
//This works if development path is FoundryVTT/Data/dev/modules/swade-item-macros | ||
const MODULEPATH = "../../../modules/swade-item-macros/" | ||
gulp.task('foundry', () => { | ||
return gulp.src('dist/**').pipe(gulp.dest(MODULEPATH)) | ||
}) | ||
gulp.task("update", gulp.series('build', 'foundry')) | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "foundry-typescript-template", | ||
"version": "1.0.0", | ||
"description": "Foundry VTT Typescript Template", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "gulp build" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"gulp": "^4.0.2", | ||
"gulp-typescript": "^6.0.0-alpha.1" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^14.10.1", | ||
"foundry-pc-types": "gitlab:foundry-projects/foundry-pc/foundry-pc-types", | ||
"typescript": "^4.0.2" | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "foundry-typescript-template", | ||
"title": "Typescript Template", | ||
"description": "", | ||
"authors": [ | ||
{ | ||
"name": "spacemandev", | ||
"discord": "spacemandev#6256" | ||
} | ||
], | ||
"version": "0.0.1", | ||
"minimumCoreVersion": "0.7.9", | ||
"compatibleCoreVersion": "0.7.9", | ||
"manifestPlusVersion": "1.0.0", | ||
"url": "", | ||
"manifest": "", | ||
"download": "", | ||
"type": "module", | ||
"includes": [ | ||
"./assets/**", | ||
"./lang/**", | ||
"./scripts/**", | ||
"./styles/**", | ||
"./templates/**", | ||
"./module.json", | ||
"./README.md" | ||
], | ||
"media": [ | ||
{ | ||
"type": "icon", | ||
"location": "" | ||
}, | ||
{ | ||
"type": "cover", | ||
"location": "" | ||
}, | ||
{ | ||
"type": "screenshot", | ||
"location": "" | ||
} | ||
], | ||
"esmodules": [ | ||
"scripts/module.js" | ||
], | ||
"styles": [ | ||
"styles/module.css" | ||
], | ||
"languages": [ | ||
{ | ||
"lang": "en", | ||
"name": "English", | ||
"path": "lang/en.json" | ||
} | ||
] | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleResolution": "node", | ||
"target": "ES6", | ||
"lib": ["DOM", "ES6", "ES2017", "ES2018"], | ||
"types": ["foundry-pc-types", "node"], | ||
"allowUmdGlobalAccess": true | ||
}, | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleResolution": "node", | ||
"target": "ES6", | ||
"lib": ["DOM", "ES6", "ES2017", "ES2018"], | ||
"types": ["foundry-pc-types", "node"], | ||
"allowUmdGlobalAccess": true | ||
}, | ||
"files": ["./gulpfile.ts"], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
} |