mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-24 19:59:36 +00:00
Fix petting on mobile
This commit is contained in:
28
build.js
28
build.js
@@ -20,18 +20,40 @@ const spriteSheets = [
|
||||
const STYLESHEET_PATH = "./stylesheet.css";
|
||||
const STYLESHEET_KEY = "___STYLESHEET___";
|
||||
|
||||
let version = "0.0.0";
|
||||
// Try to read version from manifest.json
|
||||
const now = new Date();
|
||||
const versionDate = `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
|
||||
let buildNumber = 1;
|
||||
|
||||
// Get build number from manifest.json
|
||||
try {
|
||||
const manifest = JSON.parse(readFileSync('manifest.json', 'utf8'));
|
||||
if (manifest.version) {
|
||||
version = manifest.version;
|
||||
if (manifest.version.startsWith(versionDate)) {
|
||||
// Same day, increment build number
|
||||
const parts = manifest.version.split('.');
|
||||
if (parts.length === 4) {
|
||||
buildNumber = parseInt(parts[3], 10) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Could not read version from manifest.json");
|
||||
throw e;
|
||||
}
|
||||
|
||||
const version = `${versionDate}.${buildNumber}`;
|
||||
|
||||
// Update manifest.json with new version
|
||||
try {
|
||||
const manifest = JSON.parse(readFileSync('manifest.json', 'utf8'));
|
||||
manifest.version = version;
|
||||
writeFileSync('manifest.json', JSON.stringify(manifest, null, 4), 'utf8');
|
||||
} catch (e) {
|
||||
console.error("Could not update version in manifest.json");
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
const userScriptHeader =
|
||||
`// ==UserScript==
|
||||
// @name Pocket Bird
|
||||
|
||||
Reference in New Issue
Block a user