Compare commits
5 Commits
60ef8b060a
...
4a27159234
Author | SHA1 | Date |
---|---|---|
Renovate | 4a27159234 | |
Dawid Wysokiński | a968d42e8a | |
Dawid Wysokiński | 0ff002ce1a | |
renovate | 24a9b7113f | |
renovate | 4a30e57fbf |
|
@ -3,5 +3,5 @@ dist
|
|||
.parcel-cache
|
||||
k8s
|
||||
.prettierrc.js
|
||||
.terserrc.js
|
||||
commitlint.config.js
|
||||
postbuild.js
|
||||
|
|
19
package.json
19
package.json
|
@ -4,16 +4,8 @@
|
|||
"license": "MIT",
|
||||
"scripts": {
|
||||
"prepare": "husky install",
|
||||
"build-single": "PUBLIC_URL=https://scripts.tribalwarshelp.com parcel build",
|
||||
"build:extended-player-profile-user": "PREAMBLE=extended-player-profile yarn build-single ./src/extended-player-profile.user.ts",
|
||||
"build:extended-player-profile-quickbar": "yarn build-single ./src/extended-player-profile.quickbar.ts",
|
||||
"build:extended-map-popup-user": "PREAMBLE=extended-map-popup yarn build-single ./src/extended-map-popup.user.ts",
|
||||
"build:extended-map-popup-quickbar": "yarn build-single ./src/extended-map-popup.quickbar.ts",
|
||||
"build:extended-village-profile-user": "PREAMBLE=extended-village-profile yarn build-single ./src/extended-village-profile.user.ts",
|
||||
"build:extended-village-profile-quickbar": "yarn build-single ./src/extended-village-profile.quickbar.ts",
|
||||
"build:extended-tribe-profile-user": "PREAMBLE=extended-tribe-profile yarn build-single ./src/extended-tribe-profile.user.ts",
|
||||
"build:extended-tribe-profile-quickbar": "yarn build-single ./src/extended-tribe-profile.quickbar.ts",
|
||||
"build": "npm-run-all build:*",
|
||||
"build": "parcel build ./src/*.user.ts ./src/*.quickbar.ts",
|
||||
"postbuild": "PUBLIC_URL=https://scripts.tribalwarshelp.com node postbuild.js",
|
||||
"lint": "eslint src/**/*.ts"
|
||||
},
|
||||
"targets": {
|
||||
|
@ -33,8 +25,8 @@
|
|||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.4.4",
|
||||
"@commitlint/config-conventional": "^17.4.4",
|
||||
"@parcel/validator-eslint": "^2.8.3",
|
||||
"@parcel/validator-typescript": "^2.8.3",
|
||||
"@parcel/validator-eslint": "^2.9.1",
|
||||
"@parcel/validator-typescript": "^2.9.1",
|
||||
"@types/jquery": "^3.5.14",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/node": "^18.11.17",
|
||||
|
@ -44,8 +36,7 @@
|
|||
"eslint": "^8.0.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"husky": "^8.0.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"parcel": "^2.8.3",
|
||||
"parcel": "^2.9.1",
|
||||
"prettier": "^2.8.3",
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
const preambles = {
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const FILE_SUFFIX = '.user.js';
|
||||
const DIST_DIR = 'dist';
|
||||
|
||||
const metadata = {
|
||||
'extended-player-profile': `// ==UserScript==
|
||||
// @name Extended player profile
|
||||
// @version 1.1.3
|
||||
|
@ -49,11 +55,12 @@ const preambles = {
|
|||
// ==/UserScript==`,
|
||||
};
|
||||
|
||||
const preamble = preambles[process.env.PREAMBLE];
|
||||
module.exports = preamble
|
||||
? {
|
||||
output: {
|
||||
preamble: preamble,
|
||||
},
|
||||
}
|
||||
: {};
|
||||
Object.entries(metadata).forEach(([name, m]) => {
|
||||
const p = path.join('.', DIST_DIR, `${name}${FILE_SUFFIX}`);
|
||||
const data = fs.readFileSync(p);
|
||||
const fd = fs.openSync(p, 'w+');
|
||||
const insert = Buffer.from(`${m}\n`);
|
||||
fs.writeSync(fd, insert, 0, insert.length, 0);
|
||||
fs.writeSync(fd, data, 0, data.length, insert.length);
|
||||
fs.closeSync(fd);
|
||||
});
|
Loading…
Reference in New Issue