diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3d8d8e4 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# v0.1.1 + +- Added missing description to module.json +- Added this file +- Updated gitignore to ignore .mp4 files for the future +- Fixed a few more module.json things.. + +# v0.1 + +- initial (beta) release \ No newline at end of file diff --git a/README.md b/README.md index 05070c7..14d909c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ GitHub release (latest by date) GitHub GitHub Releases -This module provides a very opinionated alternative to how the roll workflow in DnD5e and how they're displayed. +This module provides an opinionated alternative to how the roll workflow in DnD5e and how they're displayed. Main goal is to provide some flexibility in how much information is displayed to the players from the GM side, while also automating some basic tasks. To avoid having to care about all possible edge cases and houserules almost every automatic generated result is toggleable. **This is a replacement for the part of MESS that modified DnD 5es rolling! While it is not exactly the same, this is my new revision of it and MESS won't be maintained in this regard anymore!** @@ -150,4 +150,6 @@ These are just ideas, they may or may not happen. - [ ] template auto targetting - [ ] Basic roll statistics - [ ] Chat Filter (filtering on player, action and whisper basis) -- [ ] Automatic rolling of attack/dmg rolls \ No newline at end of file +- [ ] Automatic rolling of attack/dmg rolls +- [ ] Clean-up SCSS (and code) +- [ ] Manifest+ \ No newline at end of file diff --git a/doc/auto-dmg-apply-button-2020-12-16_18.33.46.mp4 b/doc/auto-dmg-apply-button-2020-12-16_18.33.46.mp4 deleted file mode 100644 index 17e5e5f..0000000 Binary files a/doc/auto-dmg-apply-button-2020-12-16_18.33.46.mp4 and /dev/null differ diff --git a/gulpfile.js b/gulpfile.js index af6a8a7..77456e5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,45 +1,43 @@ -const gulp = require('gulp'); -const fs = require('fs-extra'); -const path = require('path'); -const stringify = require('json-stringify-pretty-compact'); -const less = require('gulp-less'); -const git = require('gulp-git'); -const concat = require('gulp-concat'); +const gulp = require("gulp"); +const fs = require("fs-extra"); +const path = require("path"); +const stringify = require("json-stringify-pretty-compact"); +const less = require("gulp-less"); +const git = require("gulp-git"); +const concat = require("gulp-concat"); -const chalk = require('chalk'); +const chalk = require("chalk"); -const argv = require('yargs').argv; +const argv = require("yargs").argv; +const sass = require("gulp-sass"); +sass.compiler = require("node-sass"); -const sass = require('gulp-sass'); -sass.compiler = require('node-sass'); +const browserSync = require("browser-sync").create(); -const browserSync = require('browser-sync').create(); - -const moduleName = "mars-5e"; -const repoBaseUrl = 'https://github.com/Moerill/'; -const rawBaseUrl = 'https://raw.githubusercontent.com/Moerill/' +const moduleName = "fvtt-mars-5e"; +const repoBaseUrl = "https://github.com/Moerill/"; +const rawBaseUrl = "https://raw.githubusercontent.com/Moerill/"; function getManifest() { - const json = {root: ''}; - - const modulePath = 'module.json'; - const systemPath = 'system.json'; - - if (fs.existsSync(modulePath)) { - json.file = fs.readJSONSync(modulePath); - json.name = 'module.json'; - } else if (fs.existsSync(systemPath)) { - json.file = fs.readJSONSync(systemPath); - json.name = 'system.json'; - } else { - return; - } - - return json; + const json = { root: "" }; + + const modulePath = "module.json"; + const systemPath = "system.json"; + + if (fs.existsSync(modulePath)) { + json.file = fs.readJSONSync(modulePath); + json.name = "module.json"; + } else if (fs.existsSync(systemPath)) { + json.file = fs.readJSONSync(systemPath); + json.name = "system.json"; + } else { + return; + } + + return json; } - /********************/ /* BUILD */ /********************/ @@ -48,58 +46,71 @@ function getManifest() { * Build Less */ function buildLess() { - return gulp.src('less/*.less').pipe(concat(moduleName + '.css')).pipe(less()).pipe(gulp.dest('.')).pipe(browserSync.stream()); + return gulp + .src("less/*.less") + .pipe(concat(moduleName + ".css")) + .pipe(less()) + .pipe(gulp.dest(".")) + .pipe(browserSync.stream()); } function buildSass() { - return gulp.src('sass/**/*.scss') - .pipe(sass().on('error', sass.logError)) - .pipe(concat(moduleName + '.css')) - .pipe(gulp.dest('.')) - .pipe(browserSync.stream()); + return gulp + .src("sass/**/*.scss") + .pipe(sass().on("error", sass.logError)) + .pipe(concat(moduleName + ".css")) + .pipe(gulp.dest(".")) + .pipe(browserSync.stream()); } - /** * Copy static files */ async function watchFiles() { - try { - browserSync.reload(); - return Promise.resolve(); - } catch (err) { - Promise.reject(err); - } + try { + browserSync.reload(); + return Promise.resolve(); + } catch (err) { + Promise.reject(err); + } } /** * Watch for changes for each build step */ function buildWatch() { - const config = { - server: false, - proxy: { - target: "localhost:30000", - ws: true - }, - browser: 'google-chrome', - open: false, + const config = { + server: false, + proxy: { + target: "localhost:30000", + ws: true, + }, + browser: "google-chrome", + open: false, ghostMode: { clicks: false, forms: false, scroll: false, - location: false - } - } - browserSync.init(config); - - // gulp.watch('**/*.less', { ignoreInitial: false }, buildLess); - gulp.watch('**/*.scss', { ignoreInitial: false }, buildSass); - gulp.watch( - ['fonts', 'lang', 'templates', '*.json', 'assets/**/*', 'js/**/*', 'html/**/*'], - { ignoreInitial: false }, - watchFiles - ); + location: false, + }, + }; + browserSync.init(config); + + // gulp.watch('**/*.less', { ignoreInitial: false }, buildLess); + gulp.watch("**/*.scss", { ignoreInitial: false }, buildSass); + gulp.watch( + [ + "fonts", + "lang", + "templates", + "*.json", + "assets/**/*", + "js/**/*", + "html/**/*", + ], + { ignoreInitial: false }, + watchFiles + ); } /*********************/ @@ -110,132 +121,126 @@ function buildWatch() { * Update version and URLs in the manifest JSON */ function updateManifest(cb) { - const packageJson = fs.readJSONSync('package.json'); - const config = { + const packageJson = fs.readJSONSync("package.json"); + const config = { repository: repoBaseUrl + moduleName, - rawURL: rawBaseUrl + moduleName + rawURL: rawBaseUrl + moduleName, }, - manifest = getManifest(), - rawURL = config.rawURL, - repoURL = config.repository, - manifestRoot = manifest.root; - - if (!config) cb(Error(chalk.red('foundryconfig.json not found'))); - if (!manifest) cb(Error(chalk.red('Manifest JSON not found'))); - if (!rawURL || !repoURL) - cb( - Error( - chalk.red( - 'Repository URLs not configured in foundryconfig.json' - ) - ) - ); - - try { - const version = argv.update || argv.u; - - /* Update version */ - - const versionMatch = /^(\d{1,}).(\d{1,}).(\d{1,})$/; - const currentVersion = manifest.file.version; - let targetVersion = ''; - - if (!version) { - cb(Error('Missing version number')); - } - - if (versionMatch.test(version)) { - targetVersion = version; - } else { - targetVersion = currentVersion.replace( - versionMatch, - (substring, major, minor, patch) => { - console.log( - substring, - Number(major) + 1, - Number(minor) + 1, - Number(patch) + 1 - ); - if (version === 'major') { - return `${Number(major) + 1}.0.0`; - } else if (version === 'minor') { - return `${major}.${Number(minor) + 1}.0`; - } else if (version === 'patch') { - return `${major}.${minor}.${Number(patch) + 1}`; - } else { - return ''; - } - } - ); - } - - if (targetVersion === '') { - return cb(Error(chalk.red('Error: Incorrect version arguments.'))); - } - - if (targetVersion === currentVersion) { - return cb( - Error( - chalk.red( - 'Error: Target version is identical to current version.' - ) - ) - ); - } - console.log(`Updating version number to '${targetVersion}'`); - - packageJson.version = targetVersion; - manifest.file.version = targetVersion; - - /* Update URLs */ - - const downloadUrl = `${repoURL}/releases/download/v${manifest.file.version}/v${manifest.file.version}.zip`; - // const result = `${rawURL}/v${manifest.file.version}/package/${manifest.file.name}-v${manifest.file.version}.zip`; - - manifest.file.url = repoURL; - manifest.file.manifest = `${rawURL}/master/${manifest.name}`; - manifest.file.download = downloadUrl; - - const prettyProjectJson = stringify(manifest.file, { - maxLength: 35, - indent: '\t', - }); - - fs.writeJSONSync('package.json', packageJson, { spaces: '\t' }); - fs.writeFileSync( - path.join(manifest.root, manifest.name), - prettyProjectJson, - 'utf8' - ); - - return cb(); - } catch (err) { - cb(err); - } + manifest = getManifest(), + rawURL = config.rawURL, + repoURL = config.repository, + manifestRoot = manifest.root; + + if (!config) cb(Error(chalk.red("foundryconfig.json not found"))); + if (!manifest) cb(Error(chalk.red("Manifest JSON not found"))); + if (!rawURL || !repoURL) + cb( + Error(chalk.red("Repository URLs not configured in foundryconfig.json")) + ); + + try { + const version = argv.update || argv.u; + + /* Update version */ + + const versionMatch = /^(\d{1,}).(\d{1,}).(\d{1,})$/; + const currentVersion = manifest.file.version; + let targetVersion = ""; + + if (!version) { + cb(Error("Missing version number")); + } + + if (versionMatch.test(version)) { + targetVersion = version; + } else { + targetVersion = currentVersion.replace( + versionMatch, + (substring, major, minor, patch) => { + console.log( + substring, + Number(major) + 1, + Number(minor) + 1, + Number(patch) + 1 + ); + if (version === "major") { + return `${Number(major) + 1}.0.0`; + } else if (version === "minor") { + return `${major}.${Number(minor) + 1}.0`; + } else if (version === "patch") { + return `${major}.${minor}.${Number(patch) + 1}`; + } else { + return ""; + } + } + ); + } + + if (targetVersion === "") { + return cb(Error(chalk.red("Error: Incorrect version arguments."))); + } + + if (targetVersion === currentVersion) { + return cb( + Error( + chalk.red("Error: Target version is identical to current version.") + ) + ); + } + console.log(`Updating version number to '${targetVersion}'`); + + packageJson.version = targetVersion; + manifest.file.version = targetVersion; + + /* Update URLs */ + + const downloadUrl = `${repoURL}/releases/download/v${manifest.file.version}/v${manifest.file.version}.zip`; + // const result = `${rawURL}/v${manifest.file.version}/package/${manifest.file.name}-v${manifest.file.version}.zip`; + + manifest.file.url = repoURL; + manifest.file.manifest = `${rawURL}/master/${manifest.name}`; + manifest.file.download = downloadUrl; + + const prettyProjectJson = stringify(manifest.file, { + maxLength: 35, + indent: "\t", + }); + + fs.writeJSONSync("package.json", packageJson, { spaces: "\t" }); + fs.writeFileSync( + path.join(manifest.root, manifest.name), + prettyProjectJson, + "utf8" + ); + + return cb(); + } catch (err) { + cb(err); + } } function gitAdd() { - return gulp.src('.').pipe(git.add()); + return gulp.src(".").pipe(git.add()); } function gitCommit() { - return gulp.src('./*').pipe( - git.commit(`v${getManifest().file.version}`, { - args: '-a', - disableAppendPaths: true, - }) - ); + return gulp.src("./*").pipe( + git.commit(`v${getManifest().file.version}`, { + args: "-a", + disableAppendPaths: true, + }) + ); } function gitTag() { - const manifest = getManifest(); - return git.tag( - `v${manifest.file.version}`, - `Updated to ${manifest.file.version}`, - (err) => { - if (err) throw err; - } - ); + const manifest = getManifest(); + return git.tag( + `v${manifest.file.version}`, + `Updated to ${manifest.file.version}`, + (err) => { + if (err) throw err; + } + ); } const execGit = gulp.series(gitAdd, gitCommit, gitTag); @@ -245,8 +250,4 @@ const execBuild = gulp.parallel(buildLess); exports.build = gulp.series(execBuild); exports.watch = buildWatch; exports.update = updateManifest; -exports.publish = gulp.series( - updateManifest, - execBuild, - execGit -); \ No newline at end of file +exports.publish = gulp.series(updateManifest, execBuild, execGit); diff --git a/module.json b/module.json index 024ce88..a335568 100644 --- a/module.json +++ b/module.json @@ -1,17 +1,17 @@ { "name": "mars-5e", "title": "Mars 5e - Moerills alternative rolling style for 5e", - "description": "", - "version": "0.1.0", + "description": "This module provides an opinionated alternative to how the roll workflow in DnD5e and how they're displayed.
Main goal is to provide some flexibility in how much information is displayed to the players from the GM side, while also automating some basic tasks. To avoid having to care about all possible edge cases and houserules almost every automatic generated result is toggleable.", + "version": "0.1.1", "author": "Moerill", "esmodules": ["js/index.js"], "styles": ["mars-5e.css"], - "minimumCoreVersion": "0.6.6", - "compatibleCoreVersion": "0.7.2", + "minimumCoreVersion": "0.7.8", + "compatibleCoreVersion": "0.7.9", "socket": true, - "manifest": "https://raw.githubusercontent.com/Moerill/mars-5e/master/module.json", - "download": "https://github.com/Moerill/mars-5e/releases/download/v0.1.0/v0.1.0.zip", - "url": "https://github.com/Moerill/mars-5e", + "manifest": "https://raw.githubusercontent.com/Moerill/fvtt-mars-5e/master/module.json", + "download": "https://github.com/Moerill/fvtt-mars-5e/releases/download/v0.1.1/v0.1.1.zip", + "url": "https://github.com/Moerill/fvtt-mars-5e", "languages": [ { "lang": "en", diff --git a/package.json b/package.json index 8268219..df19284 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "module-template", - "version": "0.1.0", + "version": "0.1.1", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"