├── .github └── workflows │ ├── get-includes.js │ ├── get-version.js │ └── main.yml ├── .gitignore ├── LICENSE.MIT ├── README.md ├── dist ├── README.md ├── lang │ └── en.json ├── module.json ├── scripts │ └── module.js └── styles │ └── module.css ├── gulpfile.ts ├── package.json ├── src ├── lang │ └── en.json ├── module.json ├── scripts │ └── module.ts ├── styles │ └── module.css └── tsconfig.json └── tsconfig.json /.github/workflows/get-includes.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | console.log(JSON.parse(fs.readFileSync('dist/module.json', 'utf8')).includes.join(" ")); 3 | -------------------------------------------------------------------------------- /.github/workflows/get-version.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | console.log(JSON.parse(fs.readFileSync('dist/module.json', 'utf8')).version); 3 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Module CI/CD 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | 14 | # Get the version from 'module.json' 15 | - name: Get Version 16 | shell: bash 17 | id: get-version 18 | run: echo "::set-output name=version::$(node ./.github/workflows/get-version.js)" 19 | 20 | # Get the name from 'module.json' 21 | - name: Get Includes 22 | shell: bash 23 | id: get-includes 24 | run: echo "::set-output name=files::$(node ./.github/workflows/get-includes.js)" 25 | 26 | # create a zip file with all files required by the module to add to the release 27 | - name: Zip Files 28 | working-directory: ./dist #SORRY BUT YOU HAVE TO USE DIST JUST LIKE GET OVER IT OR FIGURE OUT A BETTER WAY 29 | run: zip -r ../module.zip ${{steps.get-includes.outputs.files}} 30 | 31 | #Useful only for the template so we can leave the manifest and download urls empty 32 | - name: Substitute Manifest and Download Links For Versioned Ones 33 | id: sub_manifest_link_latest 34 | uses: microsoft/variable-substitution@v1 35 | with: 36 | files: './dist/module.json' 37 | env: 38 | url: https://github.com/${{github.repository}} 39 | manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json 40 | download: https://github.com/${{github.repository}}/releases/latest/download/module.zip 41 | 42 | # Update the 'latest' release 43 | - name: Update Latest Release 44 | id: create_latest_release 45 | uses: ncipollo/release-action@v1 46 | if: endsWith(github.ref, 'master') 47 | with: 48 | allowUpdates: true 49 | name: Latest 50 | draft: false 51 | prerelease: false 52 | token: ${{ secrets.GITHUB_TOKEN }} 53 | artifacts: './dist/module.json, ./module.zip' 54 | tag: latest 55 | 56 | #Substitute the Manifest and Download URLs in the module.json 57 | - name: Substitute Manifest and Download Links For Versioned Ones 58 | id: sub_manifest_link_version 59 | uses: microsoft/variable-substitution@v1 60 | with: 61 | files: './dist/module.json' 62 | env: 63 | url: https://github.com/${{github.repository}} 64 | manifest: https://github.com/${{github.repository}}/releases/latest/download/module.json 65 | download: https://github.com/${{github.repository}}/releases/download/${{steps.get-version.outputs.version}}/module.zip 66 | 67 | # Create a release for this specific version 68 | - name: Create Version Release 69 | id: create_version_release 70 | uses: ncipollo/release-action@v1 71 | with: 72 | allowUpdates: true # set this to false if you want to prevent updating existing releases 73 | name: Release ${{ steps.get-version.outputs.version }} 74 | draft: false 75 | prerelease: false 76 | token: ${{ secrets.GITHUB_TOKEN }} 77 | artifacts: './dist/module.json,./module.zip' 78 | tag: ${{ steps.get-version.outputs.version }} 79 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /LICENSE.MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Repository Owner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://img.shields.io/badge/Foundry-v0.7.9-informational) 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | # Changelog 11 | *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* 12 | 13 | # Description 14 | This is a typescript template to get you started. This is not intended for beginners. 15 | 16 | Please use the javascript template as necessary for your stuff. 17 | 18 | 19 | ## Manifest Plus 20 | Adds the following fields to the manifest for package browsers to pick up and show information better: 21 | 22 | ``` 23 | - includes: [] # list of files to include in the zip 24 | - icon: "" # link to icon img 25 | - cover: "" #link to cover img 26 | - screenshots: [] #links to screenshot images 27 | - video: "" 28 | - authors: [ 29 | { 30 | "name": "name", 31 | "email": "email", 32 | "discord": "discord" 33 | } 34 | ] 35 | 36 | ``` 37 | 38 | 39 | ## Versioned Releases 40 | 41 | 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. 42 | 43 | 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. 44 | 45 | 46 | # License 47 | MIT License. Do what you will. PRs welcome. 48 | -------------------------------------------------------------------------------- /dist/README.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | *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* 3 | 4 | # Description 5 | This is a typescript template to get you started. This is not intended for beginners. 6 | 7 | Please use the javascript template as necessary for your stuff. 8 | 9 | 10 | ## Manifest Plus 11 | Adds the following fields to the manifest for package browsers to pick up and show information better: 12 | 13 | ``` 14 | - includes: [] # list of files to include in the zip 15 | - icon: "" # link to icon img 16 | - cover: "" #link to cover img 17 | - screenshots: [] #links to screenshot images 18 | - video: "" 19 | - authors: [ 20 | { 21 | "name": "name", 22 | "email": "email", 23 | "discord": "discord" 24 | } 25 | ] 26 | 27 | ``` 28 | 29 | 30 | ## Versioned Releases 31 | 32 | 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. 33 | 34 | 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. 35 | 36 | 37 | # License 38 | MIT License. Do what you will. PRs welcome. 39 | -------------------------------------------------------------------------------- /dist/lang/en.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/League-of-Foundry-Developers/foundry-typescript-template/b7c567fafcdea6cb02d3987ebc6fc11941eeba33/dist/lang/en.json -------------------------------------------------------------------------------- /dist/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foundry-typescript-template", 3 | "title": "Typescript Template", 4 | "description": "", 5 | "authors": [ 6 | { 7 | "name": "spacemandev", 8 | "discord": "spacemandev#6256" 9 | } 10 | ], 11 | "version": "0.0.1", 12 | "minimumCoreVersion": "0.6.0", 13 | "compatibleCoreVersion": "0.7.2", 14 | "url": "", 15 | "manifest": "", 16 | "download": "", 17 | "type": "module", 18 | "includes": [ 19 | "./assets/**", 20 | "./lang/**", 21 | "./scripts/**", 22 | "./styles/**", 23 | "./templates/**", 24 | "./module.json", 25 | "./README.md" 26 | ], 27 | "media": [ 28 | { 29 | "type": "icon", 30 | "location": "" 31 | }, 32 | { 33 | "type": "cover", 34 | "location": "" 35 | }, 36 | { 37 | "type": "screenshot", 38 | "location": "" 39 | } 40 | ], 41 | "esmodules": [ 42 | "scripts/module.js" 43 | ], 44 | "styles": [ 45 | "styles/module.css" 46 | ], 47 | "languages": [ 48 | { 49 | "lang": "en", 50 | "name": "English", 51 | "path": "lang/en.json" 52 | } 53 | ] 54 | } -------------------------------------------------------------------------------- /dist/scripts/module.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/League-of-Foundry-Developers/foundry-typescript-template/b7c567fafcdea6cb02d3987ebc6fc11941eeba33/dist/scripts/module.js -------------------------------------------------------------------------------- /dist/styles/module.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/League-of-Foundry-Developers/foundry-typescript-template/b7c567fafcdea6cb02d3987ebc6fc11941eeba33/dist/styles/module.css -------------------------------------------------------------------------------- /gulpfile.ts: -------------------------------------------------------------------------------- 1 | const gulp = require('gulp') 2 | const ts = require('gulp-typescript'); 3 | const project = ts.createProject('tsconfig.json') 4 | 5 | 6 | gulp.task('compile', () => { 7 | return gulp.src('src/**/*.ts') 8 | .pipe(project()) 9 | .pipe(gulp.dest('dist/')) 10 | }) 11 | 12 | gulp.task('copy', async () => { 13 | return new Promise((resolve,reject) => { 14 | gulp.src('README.md').pipe(gulp.dest("dist/")) 15 | gulp.src("src/module.json").pipe(gulp.dest('dist/')) 16 | gulp.src("src/lang/**").pipe(gulp.dest('dist/lang/')) 17 | gulp.src("src/templates/**").pipe(gulp.dest('dist/templates/')) 18 | gulp.src("src/styles/**").pipe(gulp.dest('dist/styles/')) 19 | gulp.src("src/assets/**").pipe(gulp.dest('dist/assets/')) 20 | resolve(); 21 | }) 22 | }) 23 | 24 | gulp.task('build', gulp.parallel('compile', 'copy')); 25 | 26 | 27 | /* 28 | // 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 29 | //This works if development path is FoundryVTT/Data/dev/modules/swade-item-macros 30 | const MODULEPATH = "../../../modules/swade-item-macros/" 31 | 32 | gulp.task('foundry', () => { 33 | return gulp.src('dist/**').pipe(gulp.dest(MODULEPATH)) 34 | }) 35 | 36 | gulp.task("update", gulp.series('build', 'foundry')) 37 | */ 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foundry-typescript-template", 3 | "version": "1.0.0", 4 | "description": "Foundry VTT Typescript Template", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "gulp build" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "gulp": "^4.0.2", 13 | "gulp-typescript": "^6.0.0-alpha.1" 14 | }, 15 | "dependencies": { 16 | "@types/node": "^14.10.1", 17 | "foundry-pc-types": "gitlab:foundry-projects/foundry-pc/foundry-pc-types", 18 | "typescript": "^4.0.2" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/lang/en.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/League-of-Foundry-Developers/foundry-typescript-template/b7c567fafcdea6cb02d3987ebc6fc11941eeba33/src/lang/en.json -------------------------------------------------------------------------------- /src/module.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foundry-typescript-template", 3 | "title": "Typescript Template", 4 | "description": "", 5 | "authors": [ 6 | { 7 | "name": "spacemandev", 8 | "discord": "spacemandev#6256" 9 | } 10 | ], 11 | "version": "0.0.1", 12 | "minimumCoreVersion": "0.7.9", 13 | "compatibleCoreVersion": "0.7.9", 14 | "manifestPlusVersion": "1.0.0", 15 | "url": "", 16 | "manifest": "", 17 | "download": "", 18 | "type": "module", 19 | "includes": [ 20 | "./assets/**", 21 | "./lang/**", 22 | "./scripts/**", 23 | "./styles/**", 24 | "./templates/**", 25 | "./module.json", 26 | "./README.md" 27 | ], 28 | "media": [ 29 | { 30 | "type": "icon", 31 | "location": "" 32 | }, 33 | { 34 | "type": "cover", 35 | "location": "" 36 | }, 37 | { 38 | "type": "screenshot", 39 | "location": "" 40 | } 41 | ], 42 | "esmodules": [ 43 | "scripts/module.js" 44 | ], 45 | "styles": [ 46 | "styles/module.css" 47 | ], 48 | "languages": [ 49 | { 50 | "lang": "en", 51 | "name": "English", 52 | "path": "lang/en.json" 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /src/scripts/module.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/League-of-Foundry-Developers/foundry-typescript-template/b7c567fafcdea6cb02d3987ebc6fc11941eeba33/src/scripts/module.ts -------------------------------------------------------------------------------- /src/styles/module.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/League-of-Foundry-Developers/foundry-typescript-template/b7c567fafcdea6cb02d3987ebc6fc11941eeba33/src/styles/module.css -------------------------------------------------------------------------------- /src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "moduleResolution": "node", 4 | "target": "ES6", 5 | "lib": ["DOM", "ES6", "ES2017", "ES2018"], 6 | "types": ["foundry-pc-types", "node"], 7 | "allowUmdGlobalAccess": true 8 | }, 9 | "exclude": [ 10 | "node_modules" 11 | ] 12 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "moduleResolution": "node", 4 | "target": "ES6", 5 | "lib": ["DOM", "ES6", "ES2017", "ES2018"], 6 | "types": ["foundry-pc-types", "node"], 7 | "allowUmdGlobalAccess": true 8 | }, 9 | "files": ["./gulpfile.ts"], 10 | "exclude": [ 11 | "node_modules" 12 | ] 13 | } --------------------------------------------------------------------------------