mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Prettier
This commit is contained in:
parent
89b99c74ce
commit
b18dc36c38
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
@ -53,7 +53,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);
|
||||
@ -63,11 +63,15 @@ function getAchievementNames(event) {
|
||||
|
||||
function activateAchievement(event, id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
greenworks.activateAchievement(id, () => resolve(), err => reject(err))
|
||||
greenworks.activateAchievement(
|
||||
id,
|
||||
() => resolve(),
|
||||
err => reject(err)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
init,
|
||||
listen
|
||||
listen,
|
||||
};
|
||||
|
@ -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",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -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,10 +32,12 @@ 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);
|
||||
@ -46,21 +48,23 @@ 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 };
|
||||
|
@ -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,8 +27,7 @@ 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", () => {
|
||||
@ -42,18 +41,21 @@ 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
|
||||
const packageJsonString = JSON.stringify(
|
||||
{
|
||||
scripts: {
|
||||
start: pj.scripts.start,
|
||||
},
|
||||
devDependencies: pj.devDependencies,
|
||||
optionalDependencies: pj.optionalDependencies,
|
||||
},
|
||||
devDependencies: pj.devDependencies,
|
||||
optionalDependencies: pj.optionalDependencies
|
||||
}, null, 4);
|
||||
null,
|
||||
4
|
||||
);
|
||||
|
||||
fs.writeFileSync(path.join(tempDestBuildDir, "package.json"), packageJsonString);
|
||||
|
||||
@ -79,8 +81,7 @@ 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 => {
|
||||
@ -175,9 +176,7 @@ 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)
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2018","WebWorker"]
|
||||
"lib": ["ES2018", "WebWorker"]
|
||||
},
|
||||
"exclude": [],
|
||||
"extends": "../tsconfig",
|
||||
|
Loading…
Reference in New Issue
Block a user