diff --git a/electron/index.js b/electron/index.js index 2ecbf9a1..d078b649 100644 --- a/electron/index.js +++ b/electron/index.js @@ -6,7 +6,7 @@ const url = require("url"); const childProcess = require("child_process"); const { ipcMain, shell } = require("electron"); const fs = require("fs"); -const steam = require("./steam"); +const steam = require('./steam'); const isDev = process.argv.indexOf("--dev") >= 0; const isLocal = process.argv.indexOf("--local") >= 0; diff --git a/electron/steam.js b/electron/steam.js index 70c74e7c..c65816f0 100644 --- a/electron/steam.js +++ b/electron/steam.js @@ -1,5 +1,5 @@ -const fs = require("fs"); -const path = require("path"); +const fs = require('fs'); +const path = require('path'); const { ipcMain } = require("electron"); let greenworks = null; @@ -14,7 +14,7 @@ try { // throw err; } -function init(isDev) { +function init (isDev) { if (!greenworks) { return; } @@ -34,7 +34,7 @@ function init(isDev) { initialized = true; } -function listen() { +function listen () { ipcMain.handle("steam:is-initialized", isInitialized); if (!greenworks || !initialized) { @@ -55,7 +55,7 @@ function isInitialized(event) { function getAchievementNames(event) { return new Promise((resolve, reject) => { try { - const achievements = greenworks.getAchievementNames(); + const achievements = greenworks.getAchievementNames() resolve(achievements); } catch (err) { reject(err); @@ -65,35 +65,23 @@ function getAchievementNames(event) { function getAchievement(event, id) { return new Promise((resolve, reject) => { - greenworks.getAchievement( - id, - () => resolve(), - err => reject(err) - ); + greenworks.getAchievement(id, () => resolve(), err => reject(err)) }); } function activateAchievement(event, id) { return new Promise((resolve, reject) => { - greenworks.activateAchievement( - id, - is_achieved => resolve(is_achieved), - err => reject(err) - ); + greenworks.activateAchievement(id, (is_achieved) => resolve(is_achieved), err => reject(err)) }); } function deactivateAchievement(event, id) { return new Promise((resolve, reject) => { - greenworks.clearAchievement( - id, - () => resolve(), - err => reject(err) - ); + greenworks.clearAchievement(id, () => resolve(), err => reject(err)) }); } module.exports = { init, - listen, + listen }; diff --git a/gulp/atlas2json.js b/gulp/atlas2json.js index 8286a195..b77a47f3 100644 --- a/gulp/atlas2json.js +++ b/gulp/atlas2json.js @@ -4,7 +4,7 @@ const { readFileSync, readdirSync, writeFileSync } = require("fs"); const suffixToScale = { lq: "0.25", mq: "0.5", - hq: "0.75", + hq: "0.75" }; function convert(srcDir) { @@ -65,7 +65,7 @@ function convert(srcDir) { x: xy[0], y: xy[1], w: size[0], - h: size[1], + h: size[1] }, // Whether image was rotated @@ -75,21 +75,21 @@ function convert(srcDir) { // How is the image trimmed spriteSourceSize: { x: offset[0], - y: orig[1] - size[1] - offset[1], + y: (orig[1] - size[1]) - offset[1], w: size[0], - h: size[1], + h: size[1] }, - + sourceSize: { w: orig[0], - h: orig[1], - }, - }; + h: orig[1] + } + } } // Simple object that will hold other metadata current = { - name: line, + name: line }; } else { // Read and set current image metadata @@ -108,14 +108,14 @@ function convert(srcDir) { format: srcMeta.format, size: { w: atlasSize[0], - h: atlasSize[1], + h: atlasSize[1] }, - scale: atlasScale.toString(), - }, + scale: atlasScale.toString() + } }); writeFileSync(atlas.replace(".atlas", ".json"), result, { - encoding: "utf-8", + encoding: "utf-8" }); } } diff --git a/gulp/buildutils.js b/gulp/buildutils.js index 8b5e389b..ea253773 100644 --- a/gulp/buildutils.js +++ b/gulp/buildutils.js @@ -29,7 +29,7 @@ module.exports = { try { return execSync("git describe --tag --exact-match").toString("ascii"); } catch (e) { - throw new Error("Current git HEAD is not a version tag"); + throw new Error('Current git HEAD is not a version tag'); } }, diff --git a/gulp/release-uploader.js b/gulp/release-uploader.js index faf3aff2..eececa4a 100644 --- a/gulp/release-uploader.js +++ b/gulp/release-uploader.js @@ -24,7 +24,7 @@ function gulptasksReleaseUploader($, gulp, buildFolder) { const currentTag = buildutils.getTag(); const octokit = new Octokit({ - auth: process.env.SHAPEZ_CLI_GITHUB_TOKEN, + auth: process.env.SHAPEZ_CLI_GITHUB_TOKEN }); const createdRelease = await octokit.request("POST /repos/{owner}/{repo}/releases", { @@ -32,12 +32,10 @@ function gulptasksReleaseUploader($, gulp, buildFolder) { repo: "shapez.io", tag_name: currentTag, name: currentTag, - draft: true, + draft: true }); - const { - data: { id, upload_url }, - } = createdRelease; + const { data: { id, upload_url } } = createdRelease; console.log(`Created release ${id} for tag ${currentTag}`); const dmgContents = fs.readFileSync(dmgPath); @@ -48,23 +46,21 @@ function gulptasksReleaseUploader($, gulp, buildFolder) { method: "POST", url: upload_url, headers: { - "content-type": "application/x-apple-diskimage", + "content-type": "application/x-apple-diskimage" }, name: dmgName, - data: dmgContents, + data: dmgContents }); cb(); }); - gulp.task( - "standalone.uploadRelease.darwin64", + gulp.task("standalone.uploadRelease.darwin64", gulp.series( "standalone.uploadRelease.darwin64.cleanup", "standalone.uploadRelease.darwin64.compress", "standalone.uploadRelease.darwin64.upload" - ) - ); + )); } module.exports = { gulptasksReleaseUploader }; diff --git a/gulp/standalone.js b/gulp/standalone.js index 61023759..f9718010 100644 --- a/gulp/standalone.js +++ b/gulp/standalone.js @@ -14,7 +14,7 @@ function gulptasksStandalone($, gulp) { { tempDestDir: path.join(__dirname, "..", "tmp_standalone_files"), suffix: "", - taskPrefix: "", + taskPrefix: "" }, { tempDestDir: path.join(__dirname, "..", "tmp_standalone_files_china"), @@ -27,7 +27,8 @@ function gulptasksStandalone($, gulp) { const tempDestBuildDir = path.join(tempDestDir, "built"); gulp.task(taskPrefix + "standalone.prepare.cleanup", () => { - return gulp.src(tempDestDir, { read: false, allowEmpty: true }).pipe($.clean({ force: true })); + return gulp.src(tempDestDir, { read: false, allowEmpty: true }) + .pipe($.clean({ force: true })); }); gulp.task(taskPrefix + "standalone.prepare.copyPrefab", () => { @@ -41,21 +42,18 @@ function gulptasksStandalone($, gulp) { // https://github.com/gulpjs/gulp/issues/1427 // path.join(electronBaseDir, "node_modules", "**", "*"), ]; - return gulp.src(requiredFiles, { base: electronBaseDir }).pipe(gulp.dest(tempDestBuildDir)); + return gulp.src(requiredFiles, { base: electronBaseDir }) + .pipe(gulp.dest(tempDestBuildDir)); }); gulp.task(taskPrefix + "standalone.prepare.writePackageJson", cb => { - const packageJsonString = JSON.stringify( - { - scripts: { - start: pj.scripts.start, - }, - devDependencies: pj.devDependencies, - optionalDependencies: pj.optionalDependencies, + const packageJsonString = JSON.stringify({ + scripts: { + start: pj.scripts.start }, - null, - 4 - ); + devDependencies: pj.devDependencies, + optionalDependencies: pj.optionalDependencies + }, null, 4); fs.writeFileSync(path.join(tempDestBuildDir, "package.json"), packageJsonString); @@ -81,7 +79,8 @@ function gulptasksStandalone($, gulp) { }); gulp.task(taskPrefix + "standalone.prepare.copyGamefiles", () => { - return gulp.src("../build/**/*.*", { base: "../build" }).pipe(gulp.dest(tempDestBuildDir)); + return gulp.src("../build/**/*.*", { base: "../build" }) + .pipe(gulp.dest(tempDestBuildDir)); }); gulp.task(taskPrefix + "standalone.killRunningInstances", cb => { @@ -176,7 +175,9 @@ function gulptasksStandalone($, gulp) { ); } - gulp.task(taskPrefix + "standalone.package.prod.win64", cb => packageStandalone("win32", "x64", cb)); + gulp.task(taskPrefix + "standalone.package.prod.win64", cb => + packageStandalone("win32", "x64", cb) + ); gulp.task(taskPrefix + "standalone.package.prod.linux64", cb => packageStandalone("linux", "x64", cb) );