diff --git a/gulpfile.js b/gulpfile.js index 9bc1b0d..d219d8d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,7 +4,7 @@ const sourcemaps = require('gulp-sourcemaps'); const sass = require('gulp-sass')(require('sass')); const zip = require('gulp-zip'); const fs = require('fs'); -const fetch = import('node-fetch'); +const fetch = require('node-fetch'); const replace = require('gulp-replace'); const FormData = require('form-data'); @@ -259,7 +259,7 @@ async function uploadToPackageRegistry(done) { /* Publish to FoundryVTT /* ----------------------------------------- */ -function publishToFoundry(done) { +async function publishToFoundry(done) { const moduleManifestPath = 'system.json'; const moduleManifest = JSON.parse(fs.readFileSync(moduleManifestPath)); @@ -281,7 +281,7 @@ function publishToFoundry(done) { // Construct the payload const payload = { - id: id, + id: "kidsonbrooms", release: { version: version, manifest: manifest, @@ -299,7 +299,7 @@ function publishToFoundry(done) { } // Send the POST request to Foundry VTT API - const response = fetch('https://api.foundryvtt.com/_api/packages/release', { + const response = await fetch('https://api.foundryvtt.com/_api/packages/release_version', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -308,9 +308,9 @@ function publishToFoundry(done) { body: JSON.stringify(payload), }); - const responseData = response.json(); + const responseData = await response.text(); - if (responseData.status === 'success') { + if (responseData.includes('success')) { console.log('Successfully published to Foundry VTT:'); console.log(JSON.stringify(responseData, null, 2)); done(); diff --git a/package.json b/package.json index 07f5083..e5731dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kidsonbrooms", - "version": "1.1.2", + "version": "1.1.3", "description": "CSS compiler for the Kids On Brooms system", "scripts": { "build": "gulp build", @@ -23,7 +23,7 @@ "gulp-sourcemaps": "^2.6.5", "gulp-zip": "^5.0.1", "kidsonbrooms": "file:", - "node-fetch": "^3.3.2" + "node-fetch": "^2.7.0" }, "devDependencies": { "sass": "^1.79.1"