Merge branch 'master' into earth/add-unsupported-browser-message

This commit is contained in:
Andrei Andreev 2022-03-28 18:23:49 +03:00
commit cefdf275b3
4 changed files with 42 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
dist
.tmp
.vscode
.idea

39
build/check-npm.js Normal file
View File

@ -0,0 +1,39 @@
/* eslint-disable no-bitwise */
const fs = require("fs");
const path = require("path");
const proc = require("child_process");
function getHash(string) {
let hash = 0;
for (let i = 0; i < string.length; i++) {
const char = string.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
// Convert to 32bit integer
hash &= hash;
}
return hash.toString();
}
const hashPath = path.resolve(__dirname, "../.tmp/package-lock.json.hash");
let currentHash = undefined;
if (fs.existsSync(hashPath)) {
currentHash = fs.readFileSync(hashPath, { encoding: "utf-8" });
}
const packageLockPath = path.resolve(__dirname, "../package-lock.json");
const packageLockContents = fs.readFileSync(packageLockPath, { encoding: "utf-8" });
const newHash = getHash(packageLockContents);
if (newHash !== currentHash) {
const tmpPath = path.resolve(__dirname, "../.tmp");
if (!fs.existsSync(tmpPath)) {
fs.mkdirSync(tmpPath);
}
// eslint-disable-next-line no-console
console.log("package-lock.json changes were detected");
console.log("Running 'npm ci' (this might take a while)...");
proc.execSync("npm ci");
fs.writeFileSync(hashPath, newHash, {});
}

View File

@ -343,6 +343,7 @@ GameStorage.migrations = {
},
adjustWhy(player) {
player.requirementChecks.permanent.singleTickspeed = player.why ?? 0;
delete player.why;
},

View File

@ -1,7 +1,7 @@
{
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"serve": "node build/check-npm.js && vue-cli-service serve",
"build": "vue-cli-service build && node build/post-build.js",
"lint": "vue-cli-service lint",
"supportedBrowsers": "(echo export const supportedBrowsers = && browserslist-useragent-regexp --allowHigherVersions) > supportedBrowsers.js"