From 51dd5608b07f2db885636e8ffec19ff97f19d302 Mon Sep 17 00:00:00 2001 From: Chlod Alejandro Date: Sun, 20 Nov 2022 14:11:31 +0800 Subject: [PATCH] about: expanded versioning data --- i18n/settings/en.json | 2 + package-lock.json | 41 +++++++------ package.json | 1 + rollup.config.js | 8 ++- src/DeputyVersion.ts | 15 +++-- src/css/settings.css | 20 +++++-- src/ui/config/ConfigurationAboutTabPanel.tsx | 62 +++++++++++++------- 7 files changed, 100 insertions(+), 49 deletions(-) diff --git a/i18n/settings/en.json b/i18n/settings/en.json index dfd61731..293c40e1 100644 --- a/i18n/settings/en.json +++ b/i18n/settings/en.json @@ -1,4 +1,5 @@ { + "deputy.about.version": "v$1 ($2)", "deputy.about": "About", "deputy.about.homepage": "Homepage", "deputy.about.openSource": "Source", @@ -6,6 +7,7 @@ "deputy.about.credit": "Deputy was made with the help of the English Wikipedia Copyright Cleanup WikiProject and the Wikimedia Foundation.", "deputy.about.license": "Deputy is licensed under the Apache License 2.0. The source code for Deputy is available on GitHub, and is free for everyone to view and suggest changes.", "deputy.about.thirdParty": "Deputy is bundled with third party libraries to make development easier. All libraries have been vetted for user security and license compatibility. For more information, see the \"Licensing\" section on Deputy's README.", + "deputy.about.buildInfo": "Deputy v$1 ($2), committed $3.", "deputy.about.footer": "Made with love, coffee, and the tears of copyright editors.", "deputy.settings.portlet": "Deputy preferences", diff --git a/package-lock.json b/package-lock.json index c5e18754..9e8a1830 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@chlodalejandro/parsoid": "2.0.0-f08be30", "broadcastchannel-polyfill": "^1.0.1", "idb": "^7.1.0", + "rollup-plugin-git-info": "^1.0.0", "tsx-dom": "^1.4.0" }, "devDependencies": { @@ -1233,7 +1234,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", - "dev": true, "dependencies": { "@rollup/pluginutils": "^3.0.8" }, @@ -1298,7 +1298,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", - "dev": true, "dependencies": { "@types/estree": "0.0.39", "estree-walker": "^1.0.1", @@ -1314,8 +1313,7 @@ "node_modules/@rollup/pluginutils/node_modules/estree-walker": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==" }, "node_modules/@sideway/address": { "version": "4.1.4", @@ -1406,8 +1404,7 @@ "node_modules/@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", - "dev": true + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" }, "node_modules/@types/expect-puppeteer": { "version": "4.4.7", @@ -3709,7 +3706,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -6012,7 +6008,6 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, "engines": { "node": ">=8.6" }, @@ -6527,7 +6522,6 @@ "version": "2.79.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.0.tgz", "integrity": "sha512-x4KsrCgwQ7ZJPcFA/SUu6QVcYlO7uRLfLAy0DSA4NS2eG8japdbpM50ToH7z4iObodRYOJ0soneF0iaQRJ6zhA==", - "dev": true, "bin": { "rollup": "dist/bin/rollup" }, @@ -6538,6 +6532,14 @@ "fsevents": "~2.3.2" } }, + "node_modules/rollup-plugin-git-info": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-git-info/-/rollup-plugin-git-info-1.0.0.tgz", + "integrity": "sha512-AL2jzfDvOLze+Sakz3yuQjq9wY/wIj3j49yYnhuXtr6qP4qKzD039haPFa8uaLb0rzDBj2P5S8fWvJyYeIjOVw==", + "dependencies": { + "@rollup/plugin-json": "^4.1.0" + } + }, "node_modules/rollup-plugin-node-license": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/rollup-plugin-node-license/-/rollup-plugin-node-license-0.2.1.tgz", @@ -8785,7 +8787,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", - "dev": true, "requires": { "@rollup/pluginutils": "^3.0.8" } @@ -8827,7 +8828,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", - "dev": true, "requires": { "@types/estree": "0.0.39", "estree-walker": "^1.0.1", @@ -8837,8 +8837,7 @@ "estree-walker": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==" } } }, @@ -8931,8 +8930,7 @@ "@types/estree": { "version": "0.0.39", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", - "dev": true + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" }, "@types/expect-puppeteer": { "version": "4.4.7", @@ -10607,7 +10605,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "optional": true }, "function-bind": { @@ -12385,8 +12382,7 @@ "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" }, "pirates": { "version": "4.0.5", @@ -12764,11 +12760,18 @@ "version": "2.79.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.0.tgz", "integrity": "sha512-x4KsrCgwQ7ZJPcFA/SUu6QVcYlO7uRLfLAy0DSA4NS2eG8japdbpM50ToH7z4iObodRYOJ0soneF0iaQRJ6zhA==", - "dev": true, "requires": { "fsevents": "~2.3.2" } }, + "rollup-plugin-git-info": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-git-info/-/rollup-plugin-git-info-1.0.0.tgz", + "integrity": "sha512-AL2jzfDvOLze+Sakz3yuQjq9wY/wIj3j49yYnhuXtr6qP4qKzD039haPFa8uaLb0rzDBj2P5S8fWvJyYeIjOVw==", + "requires": { + "@rollup/plugin-json": "^4.1.0" + } + }, "rollup-plugin-node-license": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/rollup-plugin-node-license/-/rollup-plugin-node-license-0.2.1.tgz", diff --git a/package.json b/package.json index 531edf0d..75ce798c 100644 --- a/package.json +++ b/package.json @@ -87,6 +87,7 @@ "@chlodalejandro/parsoid": "2.0.0-f08be30", "broadcastchannel-polyfill": "^1.0.1", "idb": "^7.1.0", + "rollup-plugin-git-info": "^1.0.0", "tsx-dom": "^1.4.0" } } diff --git a/rollup.config.js b/rollup.config.js index 64233f8b..3865387c 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -4,6 +4,7 @@ import sourcemaps from 'rollup-plugin-sourcemaps'; import { nodeResolve } from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import json from '@rollup/plugin-json'; +import gitInfo from 'rollup-plugin-git-info'; import license from 'rollup-plugin-node-license'; import { createFilter } from 'rollup-pluginutils'; import serve from 'rollup-plugin-serve'; @@ -91,11 +92,16 @@ function getPlugins() { commonjs(), // Handles Node-like resolution nodeResolve( { browser: false } ), + gitInfo( { + updateVersion: false, + versionFormat: '[version]+g[abbrevHash]' + } ), // Transpiles TypeScript typescript(), // Allows JSON imports (i18n files) json( { - preferConst: true + preferConst: true, + exclude: [ 'package.json' ] } ), // Transform CSS to standard JS strings cssString(), diff --git a/src/DeputyVersion.ts b/src/DeputyVersion.ts index 28266c8b..661cb9a7 100644 --- a/src/DeputyVersion.ts +++ b/src/DeputyVersion.ts @@ -1,4 +1,5 @@ -import { version } from '../package.json'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-nocheck /** * Deputy's current version, exported as a string. * @@ -11,6 +12,12 @@ import { version } from '../package.json'; * This ensures that the version is available, even if the core is not loaded. * It also keeps standalone versions lightweight to avoid too much additional code. */ -export default version; - -export const deputyVersion = version; +export { + gitAbbrevHash, + gitBranch, + gitCommitHash, + gitDate, + gitVersion, + version as deputyVersion, + version as default +} from '../package.json'; diff --git a/src/css/settings.css b/src/css/settings.css index d062d243..714d2487 100644 --- a/src/css/settings.css +++ b/src/css/settings.css @@ -35,27 +35,37 @@ flex: 1; } -.deputy-about > :nth-child(2) > :first-child { +.deputy-about > :nth-child(2) > :first-child > * { + display: inline; +} + +.deputy-about > :nth-child(2) > :first-child > :first-child { font-weight: bold; font-size: 2em; } +.deputy-about > :nth-child(2) > :first-child > :nth-child(2) { + color: gray; + vertical-align: bottom; + margin-left: 0.4em; +} + .deputy-about > :nth-child(2) > :not(:first-child) { margin-top: 0.5em; } -.ltr .deputy-about > :nth-child(2) > :last-child > :not(:last-child) { +.ltr .deputy-about + div > :not(:last-child) { margin-right: 0.5em; } -.rtl .deputy-about > :nth-child(2) > :last-child > :not(:last-child) { +.rtl .deputy-about + div > :not(:last-child) { margin-left: 0.5em; } -.ltr .deputy-about > :nth-child(2) > :last-child { +.ltr .deputy-about + div { text-align: right; } -.rtl .deputy-about > :nth-child(2) > :last-child { +.rtl .deputy-about + div { text-align: left; } diff --git a/src/ui/config/ConfigurationAboutTabPanel.tsx b/src/ui/config/ConfigurationAboutTabPanel.tsx index f1fa37ce..175b0481 100644 --- a/src/ui/config/ConfigurationAboutTabPanel.tsx +++ b/src/ui/config/ConfigurationAboutTabPanel.tsx @@ -1,6 +1,12 @@ import { h } from 'tsx-dom'; import '../../types'; import unwrapWidget from '../../util/unwrapWidget'; +import deputyVersion, { + gitAbbrevHash, + gitDate, + gitBranch, + gitVersion +} from '../../DeputyVersion'; let InternalConfigurationGroupTabPanel: any; @@ -32,30 +38,37 @@ function initConfigurationGroupTabPanel() { ConfigurationGroupTabPanel.logoUrl } alt="Deputy logo"/>
-
{ mw.msg( 'deputy.name' ) }
-
{ mw.msg( 'deputy.description' ) }
- { - unwrapWidget( new OO.ui.ButtonWidget( { - label: mw.msg( 'deputy.about.homepage' ), - flags: [ 'progressive' ] - } ) ) - } - { - unwrapWidget( new OO.ui.ButtonWidget( { - label: mw.msg( 'deputy.about.openSource' ), - flags: [ 'progressive' ] - } ) ) - } - { - unwrapWidget( new OO.ui.ButtonWidget( { - label: mw.msg( 'deputy.about.contact' ), - flags: [ 'progressive' ] - } ) ) - } +
{ mw.msg( 'deputy.name' ) }
+
{ mw.msg( + 'deputy.about.version', + deputyVersion, + gitAbbrevHash + ) }
+
{ mw.msg( 'deputy.description' ) }
+
+ { + unwrapWidget( new OO.ui.ButtonWidget( { + label: mw.msg( 'deputy.about.homepage' ), + flags: [ 'progressive' ] + } ) ) + } + { + unwrapWidget( new OO.ui.ButtonWidget( { + label: mw.msg( 'deputy.about.openSource' ), + flags: [ 'progressive' ] + } ) ) + } + { + unwrapWidget( new OO.ui.ButtonWidget( { + label: mw.msg( 'deputy.about.contact' ), + flags: [ 'progressive' ] + } ) ) + } +

+