diff --git a/README.md b/README.md index 9367ca624..af705ce13 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ - - Aspid.FastTools + + Aspid.FastTools -[![Unity 6000.0.53f1+](Website/docs/Images/status-badge-unity.svg)](https://assetstore.unity.com/packages/package/2333465) -[![Release 1.0.0](Website/docs/Images/status-badge-preview.svg)](https://github.com/VPDPersonal/Aspid.FastTools/releases/tag/v1.0.0) -[![MIT License](Website/docs/Images/status-badge-license.svg)](https://github.com/VPDPersonal/Aspid.FastTools/blob/main/LICENSE) +[![Minimum Unity version](https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools/status-badge-unity.svg)](https://assetstore.unity.com/packages/package/2333465) +[![Release](https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools/status-badge-release.svg)](https://github.com/VPDPersonal/Aspid.FastTools/releases/latest) +[![MIT License](https://vpdpersonal.github.io/VPDPersonal/badges/status-badge-license.svg)](https://github.com/VPDPersonal/Aspid.FastTools/blob/main/LICENSE) Aspid.FastTools is a Unity package that takes the routine out of serialization, profiling and editor code. diff --git a/Website/docs/Images/aspid_fasttools_readme_banner.png b/Website/docs/Images/aspid_fasttools_readme_banner.png deleted file mode 100644 index 36fa205d7..000000000 Binary files a/Website/docs/Images/aspid_fasttools_readme_banner.png and /dev/null differ diff --git a/Website/docs/Images/aspid_fasttools_readme_banner_dark.webp b/Website/docs/Images/aspid_fasttools_readme_banner_dark.webp deleted file mode 100644 index 84988a2c3..000000000 Binary files a/Website/docs/Images/aspid_fasttools_readme_banner_dark.webp and /dev/null differ diff --git a/Website/docs/Images/status-badge-license.svg b/Website/docs/Images/status-badge-license.svg deleted file mode 100644 index 1d03b40dd..000000000 --- a/Website/docs/Images/status-badge-license.svg +++ /dev/null @@ -1,18 +0,0 @@ - - MIT License - - - - - - MIT - diff --git a/Website/docs/Images/status-badge-preview.svg b/Website/docs/Images/status-badge-preview.svg deleted file mode 100644 index c32e09a67..000000000 --- a/Website/docs/Images/status-badge-preview.svg +++ /dev/null @@ -1,19 +0,0 @@ - - Release 1.0.0 - - - - Release - 1.0.0 - diff --git a/Website/docs/Images/status-badge-unity.svg b/Website/docs/Images/status-badge-unity.svg deleted file mode 100644 index faf054c25..000000000 --- a/Website/docs/Images/status-badge-unity.svg +++ /dev/null @@ -1,21 +0,0 @@ - - Unity 6000.0.53f1+ - - - - - Unity 6000.0.53f1+ - diff --git a/Website/docs/README.md b/Website/docs/README.md index 0e9cee600..189bbd9cf 100644 --- a/Website/docs/README.md +++ b/Website/docs/README.md @@ -1,11 +1,11 @@ - - Aspid.FastTools + + Aspid.FastTools -[![Unity 6000.0.53f1+](Images/status-badge-unity.svg)](https://assetstore.unity.com/packages/package/2333465) -[![Release 1.0.0](Images/status-badge-preview.svg)](https://github.com/VPDPersonal/Aspid.FastTools/releases/tag/v1.0.0) -[![MIT License](Images/status-badge-license.svg)](https://github.com/VPDPersonal/Aspid.FastTools/blob/main/LICENSE) +[![Unity 6000.0.53f1+](https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools/status-badge-unity.svg)](https://assetstore.unity.com/packages/package/2333465) +[![Release 1.0.0](https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools/status-badge-release.svg)](https://github.com/VPDPersonal/Aspid.FastTools/releases/tag/v1.0.0) +[![MIT License](https://vpdpersonal.github.io/VPDPersonal/badges/status-badge-license.svg)](https://github.com/VPDPersonal/Aspid.FastTools/blob/main/LICENSE) Aspid.FastTools is a Unity package that takes the routine out of serialization, profiling and editor code. diff --git a/Website/i18n/ru/docusaurus-plugin-content-docs/current/README.md b/Website/i18n/ru/docusaurus-plugin-content-docs/current/README.md index 81b9ce84f..11a3d2277 100644 --- a/Website/i18n/ru/docusaurus-plugin-content-docs/current/README.md +++ b/Website/i18n/ru/docusaurus-plugin-content-docs/current/README.md @@ -1,11 +1,11 @@ - - Aspid.FastTools + + Aspid.FastTools -[![Unity 6000.0.53f1+](../../../../docs/Images/status-badge-unity.svg)](https://assetstore.unity.com/packages/package/2333465) -[![Release 1.0.0](../../../../docs/Images/status-badge-preview.svg)](https://github.com/VPDPersonal/Aspid.FastTools/releases/tag/v1.0.0) -[![MIT License](../../../../docs/Images/status-badge-license.svg)](https://github.com/VPDPersonal/Aspid.FastTools/blob/main/LICENSE) +[![Unity 6000.0.53f1+](https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools/status-badge-unity.svg)](https://assetstore.unity.com/packages/package/2333465) +[![Release 1.0.0](https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools/status-badge-release.svg)](https://github.com/VPDPersonal/Aspid.FastTools/releases/tag/v1.0.0) +[![MIT License](https://vpdpersonal.github.io/VPDPersonal/badges/status-badge-license.svg)](https://github.com/VPDPersonal/Aspid.FastTools/blob/main/LICENSE) Aspid.FastTools — пакет для Unity, который убирает рутину из сериализации, профилирования и редакторского кода. diff --git a/Website/scripts/github-readme.mjs b/Website/scripts/github-readme.mjs index 765deee7c..cd340b01b 100644 --- a/Website/scripts/github-readme.mjs +++ b/Website/scripts/github-readme.mjs @@ -221,6 +221,24 @@ function donateCard(tree, {images, exists}) { * @param options.exists whether a URL relative to the README names a file */ export function githubLayout(tree, options) { + // The site's chips describe its documented version; GitHub images follow the published channel automatically. + function sharedBadges(node) { + if (node.type === 'link') { + const badge = node.children?.find((child) => child.type === 'image' + && child.url.startsWith('https://vpdpersonal.github.io/VPDPersonal/badges/')); + if (badge?.url.endsWith('/status-badge-unity.svg')) badge.alt = 'Minimum Unity version'; + if (badge?.url.endsWith('/status-badge-release.svg')) { + badge.alt = 'Release'; + node.url = `${options.repository}/releases/latest`; + } + if (badge?.url.endsWith('/status-badge-preview.svg')) { + badge.alt = 'Preview'; + node.url = `${options.repository}/releases`; + } + } + node.children?.forEach(sharedBadges); + } + sharedBadges(tree); siteLinks(tree, options.site); linkRow(tree, options.site, options.locales); installCard(tree, options); diff --git a/Website/scripts/github-readme.test.mjs b/Website/scripts/github-readme.test.mjs index 242a95c61..92cafe64c 100644 --- a/Website/scripts/github-readme.test.mjs +++ b/Website/scripts/github-readme.test.mjs @@ -17,6 +17,22 @@ function layout(markdown, files = []) { return processor.stringify(tree); } +test('shared badges keep their URLs while GitHub alt text and release links follow the live channel', () => { + const base = 'https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools'; + const stable = layout(`[![Unity 6000.0.53f1+](${base}/status-badge-unity.svg)](#installation)\n` + + `[![Release 1.0.0](${base}/status-badge-release.svg)](${repository}/releases/tag/v1.0.0)`); + assert.match(stable, /!\[Minimum Unity version\]/); + assert.match(stable, /!\[Release\]/); + assert.ok(stable.includes(`${repository}/releases/latest`)); + assert.ok(stable.includes(`${base}/status-badge-release.svg`)); + assert.doesNotMatch(stable, /1\.0\.0|6000\.0\.53f1/); + const preview = layout(`[![Preview 2.0.0-rc.1](${base}/status-badge-preview.svg)](${repository}/releases/tag/v2.0.0-rc.1)`); + assert.match(preview, /!\[Preview\]/); + assert.ok(preview.includes(`](${repository}/releases)`)); + assert.doesNotMatch(preview, /2\.0\.0-rc\.1/); + assert.match(layout('![Unrelated 1.0.0](badge.svg)'), /Unrelated 1\.0\.0/); +}); + const features = `## Features ### Serialization diff --git a/Website/scripts/intro-banner.test.mjs b/Website/scripts/intro-banner.test.mjs index 1354b556a..d86307e77 100644 --- a/Website/scripts/intro-banner.test.mjs +++ b/Website/scripts/intro-banner.test.mjs @@ -17,7 +17,7 @@ for (const [language, file] of Object.entries(introduction)) { test(`${language} introduction: the banner, the status badges and the install panel`, () => { assert.equal(tree.children[0].name, 'IntroBanner'); - assert.match(attribute(tree.children[0], 'src'), /aspid_fasttools_readme_banner\.png$/); + assert.equal(attribute(tree.children[0], 'src'), 'https://vpdpersonal.github.io/VPDPersonal/banners/aspid-fasttools/banner.png'); const kinds = [...markdown.matchAll(/status-badge-(\w+)\.svg/g)].map(match => match[1]); assert.ok(kinds.length > 0); assert.deepEqual(find(tree, element('StatusBadge')).map(node => attribute(node, 'kind')), kinds); diff --git a/Website/src/components/StatusBadge/index.js b/Website/src/components/StatusBadge/index.js index b3377ae77..7790741b6 100644 --- a/Website/src/components/StatusBadge/index.js +++ b/Website/src/components/StatusBadge/index.js @@ -6,8 +6,16 @@ import styles from './styles.module.css'; const BUBBLES = [[15.6, 0.7, 0], [18.2, 0.9, 0.14], [20.6, 0.6, 0.07], [22.6, 0.75, 0.21]]; const SPARKS = [[0, -11], [-8, -8], [8, -8], [-11, -2], [11, -2], [-4, -12], [4, -12]]; -// The marks from the README badge SVGs (`Website/docs/Images/status-badge-*.svg`), drawn inline so they can move. +// The marks from VPDPersonal's shared README badge SVGs, drawn inline so they can follow the site theme and move. const ICONS = { + release: ( + + ), // Unity mark: https://github.com/simple-icons/simple-icons/blob/develop/icons/unity.svg unity: (