Merge pull request #12 from tribalwarshelp/feat/script-versions-in-one-file

feat: keep script versions in one json file
This commit is contained in:
Dawid Wysokiński 2021-06-12 08:26:02 +02:00 committed by GitHub
commit bec1e0ba03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 61 additions and 25 deletions

View File

@ -8,11 +8,13 @@
"build:tamper": "parcel build ./src/*.js --dist-dir dist --no-optimize --no-source-maps",
"build:quickbar": "parcel build ./src/*.js --dist-dir dist/quickbar --no-source-maps",
"build": "npm-run-all build:*",
"postbuild": "node postbuild.js",
"git:add": "git add .",
"format": "prettier --write \"src/*.{js,jsx,ts,tsx,json,md}\""
},
"dependencies": {
"date-fns": "^2.22.1",
"lodash": "^4.17.21",
"parcel": "2.0.0-beta.2"
},
"browserslist": [

21
postbuild.js Normal file
View File

@ -0,0 +1,21 @@
const path = require('path');
const fs = require('fs');
const _ = require('lodash');
const versions = require('./versions.json');
const srcDirectory = path.join(__dirname, 'src');
const scripts = fs.readdirSync(srcDirectory).filter(f => f.endsWith('.js'));
scripts.forEach(f => {
const version = versions[f];
if (!version) {
return;
}
[
path.join(__dirname, 'dist', f),
path.join(__dirname, 'dist', 'quickbar', f),
].forEach(p => {
const fileContent = fs.readFileSync(p);
const compile = _.template(fileContent);
fs.writeFileSync(p, compile({ version }));
});
});

View File

@ -9,7 +9,7 @@ import { calcDistanceBetweenTwoPoints } from './utils/math';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/bonusBarbarianVillageFinder.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/bonusBarbarianVillageFinder.js
// @version 0.4.6
// @version ${version}
// @description Bonus barbarian village finder
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=map*

View File

@ -6,7 +6,7 @@ import wait from './utils/wait';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/commandRenamer.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/commandRenamer.js
// @version 0.2.4
// @version ${version}
// @description Command renamer
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*mode=incomings*

View File

@ -13,7 +13,7 @@ import { buildURLToServerPage } from './utils/twhelp';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/dailyAchievements.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/dailyAchievements.js
// @version 0.4.5
// @version ${version}
// @description Daily achievements
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=info_player&mode=awards*

View File

@ -14,7 +14,7 @@ import calcLoyalty from './utils/calcLoyalty';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedMapPopup.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedMapPopup.js
// @version 0.6.8
// @version ${version}
// @description Extended map popup
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=map*

View File

@ -25,7 +25,7 @@ import { setItem, getItem } from './utils/localStorage';
// @namespace https://github.com/tribalwarshelp/scripts
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedPlayerProfile.js
// @version 1.2.1
// @version ${version}
// @description Extended player profile
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=info_player*

View File

@ -25,7 +25,7 @@ import * as twutils from './utils/tribalwars';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedTribeProfile.js
// @version 1.1.6
// @version ${version}
// @description Extended tribe profile
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=info_ally*

View File

@ -17,7 +17,7 @@ import showEnnoblementsPopup from './common/showEnnoblementsPopup';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedVillageProfile.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/extendedVillageProfile.js
// @version 0.7.7
// @version ${version}
// @description Extended village profile
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=info_village*

View File

@ -7,7 +7,7 @@ import wait from './utils/wait';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/inADayTribeRankingGenerator.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/inADayTribeRankingGenerator.js
// @version 0.2.3
// @version ${version}
// @description 'In A Day' tribe ranking generator
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=ranking*mode=in_a_day*

View File

@ -13,7 +13,7 @@ import loadTranslations from './i18n/latestEnnoblements';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/latestEnnoblements.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/latestEnnoblements.js
// @version 1.1.1
// @version ${version}
// @description Shows the latest ennoblements
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*

View File

@ -6,7 +6,7 @@ import { getItem, setItem } from './utils/localStorage';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/mapCoordsPicker.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/mapCoordsPicker.js
// @version 0.7.5
// @version ${version}
// @description Map coords picker
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=map*

View File

@ -10,7 +10,7 @@ import showPopup, { POPUP_SELECTOR } from './utils/showPopup';
// @namespace https://github.com/tribalwarshelp/scripts
// @updateURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/warStatsGenerator.js
// @downloadURL https://raw.githubusercontent.com/tribalwarshelp/scripts/master/dist/warStatsGenerator.js
// @version 0.3.4
// @version ${version}
// @description War stats generator
// @author Kichiyaki https://dwysokinski.me/
// @match *://*/game.php*screen=ranking*mode=wars*

13
versions.json Normal file
View File

@ -0,0 +1,13 @@
{
"bonusBarbarianVillageFinder.js": "0.4.6",
"commandRenamer.js": "0.2.4",
"dailyAchievements.js": "0.4.5",
"extendedMapPopup.js": "0.6.8",
"extendedPlayerProfile.js": "1.2.1",
"extendedTribeProfile.js": "1.1.6",
"extendedVillageProfile.js": "0.7.7",
"inADayTribeRankingGenerator.js": "0.2.3",
"latestEnnoblements.js": "1.1.1",
"mapCoordsPicker.js": "0.7.5",
"warStatsGenerator.js": "0.3.4"
}

View File

@ -44,7 +44,7 @@
jsesc "^2.5.1"
source-map "^0.5.0"
"@babel/helper-annotate-as-pure@^7.10.4", "@babel/helper-annotate-as-pure@^7.14.5":
"@babel/helper-annotate-as-pure@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.14.5.tgz#7bf478ec3b71726d56a8ca5775b046fc29879e61"
integrity sha512-EivH9EgBIb+G8ij1B2jAwSH36WnGvkQSEC6CkX/6v6ZFlw5fVOHvsgGF4uiEHO2GzMvunZb6tDLQEQSdrdocrA==
@ -81,7 +81,7 @@
"@babel/helper-replace-supers" "^7.14.5"
"@babel/helper-split-export-declaration" "^7.14.5"
"@babel/helper-create-regexp-features-plugin@^7.12.1", "@babel/helper-create-regexp-features-plugin@^7.14.5":
"@babel/helper-create-regexp-features-plugin@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.14.5.tgz#c7d5ac5e9cf621c26057722fb7a8a4c5889358c4"
integrity sha512-TLawwqpOErY2HhWbGJ2nZT5wSkR192QpN+nBg1THfBfftrlvOh+WbhrxXCH4q4xJ9Gl16BGPR/48JA+Ryiho/A==
@ -213,7 +213,7 @@
dependencies:
"@babel/types" "^7.14.5"
"@babel/helper-validator-identifier@^7.10.4", "@babel/helper-validator-identifier@^7.14.5":
"@babel/helper-validator-identifier@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz#d0f0e277c512e0c938277faa85a3968c9a44c0e8"
integrity sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==
@ -943,7 +943,7 @@
debug "^4.1.0"
globals "^11.1.0"
"@babel/types@^7.10.4", "@babel/types@^7.12.13", "@babel/types@^7.14.5", "@babel/types@^7.4.4":
"@babel/types@^7.12.13", "@babel/types@^7.14.5", "@babel/types@^7.4.4":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.14.5.tgz#3bb997ba829a2104cedb20689c4a5b8121d383ff"
integrity sha512-M/NzBpEL95I5Hh4dwhin5JlE7EzO5PHMAuzjxss3tiOBD46KfQvVedN/3jEPZvdRvtsK2222XfdHogNIttFgcg==
@ -3128,7 +3128,7 @@ gensync@^1.0.0-beta.2:
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
get-intrinsic@^1.0.0, get-intrinsic@^1.0.2, get-intrinsic@^1.1.1:
get-intrinsic@^1.0.2, get-intrinsic@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6"
integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==
@ -3541,7 +3541,7 @@ is-buffer@^1.1.5:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
is-callable@^1.1.4, is-callable@^1.2.2, is-callable@^1.2.3:
is-callable@^1.1.4, is-callable@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e"
integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==
@ -3558,7 +3558,7 @@ is-color-stop@^1.0.0:
rgb-regex "^1.0.1"
rgba-regex "^1.0.0"
is-core-module@^2.1.0, is-core-module@^2.2.0:
is-core-module@^2.2.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.4.0.tgz#8e9fc8e15027b011418026e98f0e6f4d86305cc1"
integrity sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==
@ -3666,7 +3666,7 @@ is-nan@^1.2.1:
call-bind "^1.0.0"
define-properties "^1.1.3"
is-negative-zero@^2.0.0, is-negative-zero@^2.0.1:
is-negative-zero@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24"
integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==
@ -3705,7 +3705,7 @@ is-plain-object@^2.0.3, is-plain-object@^2.0.4:
dependencies:
isobject "^3.0.1"
is-regex@^1.1.1, is-regex@^1.1.3:
is-regex@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.3.tgz#d029f9aff6448b93ebbe3f33dac71511fdcbef9f"
integrity sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==
@ -3992,7 +3992,7 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=
lodash@^4.17.15, lodash@^4.17.19:
lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
@ -4293,7 +4293,7 @@ object-copy@^0.1.0:
define-property "^0.2.5"
kind-of "^3.0.3"
object-inspect@^1.10.3, object-inspect@^1.8.0:
object-inspect@^1.10.3:
version "1.10.3"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.3.tgz#c2aa7d2d09f50c99375704f7a0adf24c5782d369"
integrity sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==
@ -4318,7 +4318,7 @@ object-visit@^1.0.0:
dependencies:
isobject "^3.0.0"
object.assign@^4.1.0, object.assign@^4.1.1, object.assign@^4.1.2:
object.assign@^4.1.0, object.assign@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940"
integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==
@ -5679,7 +5679,7 @@ string.prototype.padend@^3.0.0:
define-properties "^1.1.3"
es-abstract "^1.17.0-next.1"
string.prototype.trimend@^1.0.1, string.prototype.trimend@^1.0.4:
string.prototype.trimend@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80"
integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==
@ -5687,7 +5687,7 @@ string.prototype.trimend@^1.0.1, string.prototype.trimend@^1.0.4:
call-bind "^1.0.2"
define-properties "^1.1.3"
string.prototype.trimstart@^1.0.1, string.prototype.trimstart@^1.0.4:
string.prototype.trimstart@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed"
integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==