1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

one prettier to rule them all

This commit is contained in:
akupiec 2021-01-15 23:57:09 +01:00
parent 3b531dfb2b
commit 339719da16
10 changed files with 46 additions and 42 deletions

View File

@ -1,11 +0,0 @@
# .prettierrc or .prettierrc.yaml
trailingComma: "es5"
tabWidth: 4
semi: true
singleQuote: false
printWidth: 110
useTabs: false
quoteProps: "consistent"
bracketSpacing: true
arrowParens: avoid
endOfLine: auto

View File

@ -4,7 +4,7 @@ const { readFileSync, readdirSync, writeFileSync } = require("fs");
const suffixToScale = { const suffixToScale = {
lq: "0.25", lq: "0.25",
mq: "0.5", mq: "0.5",
hq: "0.75" hq: "0.75",
}; };
function convert(srcDir) { function convert(srcDir) {
@ -65,7 +65,7 @@ function convert(srcDir) {
x: xy[0], x: xy[0],
y: xy[1], y: xy[1],
w: size[0], w: size[0],
h: size[1] h: size[1],
}, },
// Whether image was rotated // Whether image was rotated
@ -75,21 +75,21 @@ function convert(srcDir) {
// How is the image trimmed // How is the image trimmed
spriteSourceSize: { spriteSourceSize: {
x: offset[0], x: offset[0],
y: (orig[1] - size[1]) - offset[1], y: orig[1] - size[1] - offset[1],
w: size[0], w: size[0],
h: size[1] h: size[1],
}, },
sourceSize: { sourceSize: {
w: orig[0], w: orig[0],
h: orig[1] h: orig[1],
} },
} };
} }
// Simple object that will hold other metadata // Simple object that will hold other metadata
current = { current = {
name: line name: line,
}; };
} else { } else {
// Read and set current image metadata // Read and set current image metadata
@ -108,14 +108,14 @@ function convert(srcDir) {
format: srcMeta.format, format: srcMeta.format,
size: { size: {
w: atlasSize[0], w: atlasSize[0],
h: atlasSize[1] h: atlasSize[1],
}, },
scale: atlasScale.toString() scale: atlasScale.toString(),
} },
}); });
writeFileSync(atlas.replace(".atlas", ".json"), result, { writeFileSync(atlas.replace(".atlas", ".json"), result, {
encoding: "utf-8" encoding: "utf-8",
}); });
} }
} }

View File

@ -29,7 +29,7 @@ module.exports = {
try { try {
return execSync("git describe --tag --exact-match").toString("ascii"); return execSync("git describe --tag --exact-match").toString("ascii");
} catch (e) { } catch (e) {
throw new Error('Current git HEAD is not a version tag'); throw new Error("Current git HEAD is not a version tag");
} }
}, },

View File

@ -6,7 +6,6 @@ function requireUncached(module) {
} }
function gulptasksJS($, gulp, buildFolder, browserSync) { function gulptasksJS($, gulp, buildFolder, browserSync) {
//// DEV //// DEV
gulp.task("js.dev.watch", () => { gulp.task("js.dev.watch", () => {

View File

@ -24,7 +24,7 @@ function gulptasksReleaseUploader($, gulp, buildFolder) {
const currentTag = buildutils.getTag(); const currentTag = buildutils.getTag();
const octokit = new Octokit({ 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", { const createdRelease = await octokit.request("POST /repos/{owner}/{repo}/releases", {
@ -32,10 +32,12 @@ function gulptasksReleaseUploader($, gulp, buildFolder) {
repo: "shapez.io", repo: "shapez.io",
tag_name: currentTag, tag_name: currentTag,
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}`); console.log(`Created release ${id} for tag ${currentTag}`);
const dmgContents = fs.readFileSync(dmgPath); const dmgContents = fs.readFileSync(dmgPath);
@ -46,21 +48,23 @@ function gulptasksReleaseUploader($, gulp, buildFolder) {
method: "POST", method: "POST",
url: upload_url, url: upload_url,
headers: { headers: {
"content-type": "application/x-apple-diskimage" "content-type": "application/x-apple-diskimage",
}, },
name: dmgName, name: dmgName,
data: dmgContents data: dmgContents,
}); });
cb(); cb();
}); });
gulp.task("standalone.uploadRelease.darwin64", gulp.task(
"standalone.uploadRelease.darwin64",
gulp.series( gulp.series(
"standalone.uploadRelease.darwin64.cleanup", "standalone.uploadRelease.darwin64.cleanup",
"standalone.uploadRelease.darwin64.compress", "standalone.uploadRelease.darwin64.compress",
"standalone.uploadRelease.darwin64.upload" "standalone.uploadRelease.darwin64.upload"
)); )
);
} }
module.exports = { gulptasksReleaseUploader }; module.exports = { gulptasksReleaseUploader };

View File

@ -11,7 +11,7 @@
"dev": "cd gulp && yarn gulp main.serveDev", "dev": "cd gulp && yarn gulp main.serveDev",
"tslint": "cd src/js && tsc", "tslint": "cd src/js && tsc",
"lint": "eslint src/js", "lint": "eslint src/js",
"prettier-all": "prettier --write src/**/*.* && prettier --write gulp/**/*.*", "prettier-all": "prettier src/ gulp/ --write --ignore-unknown",
"publishOnItchWindows": "butler push tmp_standalone_files/shapez.io-standalone-win32-x64 tobspr/shapezio:windows --userversion-file version", "publishOnItchWindows": "butler push tmp_standalone_files/shapez.io-standalone-win32-x64 tobspr/shapezio:windows --userversion-file version",
"publishOnItchLinux": "butler push tmp_standalone_files/shapez.io-standalone-linux-x64 tobspr/shapezio:linux --userversion-file version", "publishOnItchLinux": "butler push tmp_standalone_files/shapez.io-standalone-linux-x64 tobspr/shapezio:linux --userversion-file version",
"publishOnItch": "yarn publishOnItchWindows && yarn publishOnItchLinux", "publishOnItch": "yarn publishOnItchWindows && yarn publishOnItchLinux",
@ -95,9 +95,21 @@
"postcss-preset-env": "^6.5.0", "postcss-preset-env": "^6.5.0",
"postcss-round-subpixels": "^1.2.0", "postcss-round-subpixels": "^1.2.0",
"postcss-unprefix": "^2.1.3", "postcss-unprefix": "^2.1.3",
"prettier": "^2.0.4", "prettier": "^2.2.1",
"sass-unused": "^0.3.0", "sass-unused": "^0.3.0",
"strip-json-comments": "^3.0.1", "strip-json-comments": "^3.0.1",
"trim": "^0.0.1" "trim": "^0.0.1"
},
"prettier": {
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": false,
"printWidth": 110,
"useTabs": false,
"quoteProps": "consistent",
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "auto"
} }
} }

View File

@ -42,5 +42,5 @@
<link rel="canonical" href="https://shapez.io" /> <link rel="canonical" href="https://shapez.io" />
</head> </head>
<body oncontextmenu="return false" style="background: #393747;"></body> <body oncontextmenu="return false" style="background: #393747"></body>
</html> </html>

View File

@ -18,5 +18,5 @@
<meta http-equiv="Cache-Control" content="private, max-age=0, no-store, no-cache, must-revalidate" /> <meta http-equiv="Cache-Control" content="private, max-age=0, no-store, no-cache, must-revalidate" />
<meta http-equiv="Expires" content="0" /> <meta http-equiv="Expires" content="0" />
</head> </head>
<body oncontextmenu="return false" style="background: #393747;"></body> <body oncontextmenu="return false" style="background: #393747"></body>
</html> </html>

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"lib": ["ES2018","WebWorker"] "lib": ["ES2018", "WebWorker"]
}, },
"exclude": [], "exclude": [],
"extends": "../tsconfig", "extends": "../tsconfig",

View File

@ -6978,10 +6978,10 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier@^2.0.4: prettier@^2.2.1:
version "2.0.4" version "2.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.4.tgz#2d1bae173e355996ee355ec9830a7a1ee05457ef" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha512-SVJIQ51spzFDvh4fIbCLvciiDMCrRhlN3mbZvv/+ycjvmF5E73bKdGfU8QDLNmjYJf+lsGnDBC4UUnvTe5OO0w== integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
private@^0.1.8, private@~0.1.5: private@^0.1.8, private@~0.1.5:
version "0.1.8" version "0.1.8"