Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!-- Generated from Website/docs/README.md. Edit that file, then run npm --prefix Website run sync-readme. -->

<picture>
<source srcset="Website/docs/Images/aspid_fasttools_readme_banner_dark.webp" />
<img src="Website/docs/Images/aspid_fasttools_readme_banner.png" alt="Aspid.FastTools" />
<source srcset="https://vpdpersonal.github.io/VPDPersonal/banners/aspid-fasttools/banner.webp" type="image/webp" />
<img src="https://vpdpersonal.github.io/VPDPersonal/banners/aspid-fasttools/banner.png" alt="Aspid.FastTools" />
</picture>

[![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.

Expand Down
Binary file not shown.
Binary file not shown.
18 changes: 0 additions & 18 deletions Website/docs/Images/status-badge-license.svg

This file was deleted.

19 changes: 0 additions & 19 deletions Website/docs/Images/status-badge-preview.svg

This file was deleted.

21 changes: 0 additions & 21 deletions Website/docs/Images/status-badge-unity.svg

This file was deleted.

10 changes: 5 additions & 5 deletions Website/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<picture>
<source srcset="Images/aspid_fasttools_readme_banner_dark.webp" />
<img src="Images/aspid_fasttools_readme_banner.png" alt="Aspid.FastTools" />
<source srcset="https://vpdpersonal.github.io/VPDPersonal/banners/aspid-fasttools/banner.webp" type="image/webp" />
<img src="https://vpdpersonal.github.io/VPDPersonal/banners/aspid-fasttools/banner.png" alt="Aspid.FastTools" />
</picture>

[![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.

Expand Down
10 changes: 5 additions & 5 deletions Website/i18n/ru/docusaurus-plugin-content-docs/current/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<picture>
<source srcset="../../../../docs/Images/aspid_fasttools_readme_banner_dark.webp" />
<img src="../../../../docs/Images/aspid_fasttools_readme_banner.png" alt="Aspid.FastTools" />
<source srcset="https://vpdpersonal.github.io/VPDPersonal/banners/aspid-fasttools/banner.webp" type="image/webp" />
<img src="https://vpdpersonal.github.io/VPDPersonal/banners/aspid-fasttools/banner.png" alt="Aspid.FastTools" />
</picture>

[![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, который убирает рутину из сериализации, профилирования и редакторского кода.

Expand Down
18 changes: 18 additions & 0 deletions Website/scripts/github-readme.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions Website/scripts/github-readme.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Website/scripts/intro-banner.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 9 additions & 1 deletion Website/src/components/StatusBadge/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
<svg className={styles.icon} viewBox="9 7 20 18" aria-hidden="true">
<g fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round">
<circle cx="19" cy="10.5" r="1.7" />
<path d="M19 12.2V23 M15.5 15h7 M12 17v1a7 5 0 0 0 14 0v-1 M12 17l2 1.5 M26 17l-2 1.5" />
</g>
</svg>
),
// Unity mark: https://github.com/simple-icons/simple-icons/blob/develop/icons/unity.svg
unity: (
<svg className={styles.icon} viewBox="0 0 24 24" aria-hidden="true">
Expand Down
2 changes: 2 additions & 0 deletions Website/src/components/StatusBadge/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ html[data-theme='light'] .badge {
}
.icon { flex: none; width: 16px; height: 16px; overflow: visible; }
.unity .icon { color: var(--badge-unity); }
.release .icon { color: var(--badge-unity); }
.preview .icon, .accent { color: var(--badge-gold); }
.license .icon { width: 18px; height: 18px; color: var(--badge-shield); }

Expand All @@ -37,6 +38,7 @@ html[data-theme='light'] .badge {
}
/* The hover outline takes the badge's own icon colour, not the site accent. */
.unity { --badge-mark: var(--badge-unity); }
.release { --badge-mark: var(--badge-unity); }
.preview { --badge-mark: var(--badge-gold); }
.license { --badge-mark: var(--badge-shield); }
:global(.markdown) a.badge:hover { border-color: var(--badge-mark); }
Expand Down
3 changes: 2 additions & 1 deletion Website/src/remark/introBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export default function remarkIntroBanner({baseUrl, siteUrl}) {
const isBannerImage = (node) => node?.type === 'mdxJsxFlowElement' && node.name === 'img'
&& node.attributes.some((attribute) => attribute.name === 'src'
&& typeof attribute.value === 'string'
&& attribute.value.endsWith('/aspid_fasttools_readme_banner.png'));
&& (attribute.value.endsWith('/aspid_fasttools_readme_banner.png')
|| attribute.value === 'https://vpdpersonal.github.io/VPDPersonal/banners/aspid-fasttools/banner.png'));
const banner = tree.children.find((node) => node.type === 'mdxJsxFlowElement' && ['img', 'picture'].includes(node.name));
const image = banner?.name === 'picture' ? banner.children.find(isBannerImage) : banner;
if (isBannerImage(image)) {
Expand Down
15 changes: 10 additions & 5 deletions scripts/check-version.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Check that the files scripts/set-version.sh writes carry the package.json version whole and its channel: a stable
// Check that documentation carries the package.json version whole and its channel: a stable
// version installs from `upm` under a "Release" badge, a prerelease from `upm-preview` under a "Preview" one; the
// Agent Skills page installs the skills from the matching `skills` or `skills-preview` branch.
// Both CHANGELOGs must have the version's section, dated as set-version.sh writes it, and its release link.
Expand All @@ -15,7 +15,6 @@ const FILES = [
'README.md',
'Website/docs/README.md',
'Website/i18n/ru/docusaurus-plugin-content-docs/current/README.md',
'Website/docs/Images/status-badge-preview.svg',
];
const SKILLS_PAGES = [
'Website/docs/13-agent-skills.md',
Expand Down Expand Up @@ -45,11 +44,17 @@ const checkInstallUrls = (file, text) => {

for (const file of FILES) {
const text = readFileSync(file, 'utf8');
if (!whole(`${label} ${version}`).test(text)) fail(file, `has no "${label} ${version}" badge; ${fix}`);
if (file.endsWith('.svg')) {
if (!text.includes(`>${label}</text>`)) fail(file, `the badge text is not "${label}"; ${fix}`);
const badge = `https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools/status-badge-${branch === 'upm' ? 'release' : 'preview'}.svg`;
const unity = `https://vpdpersonal.github.io/VPDPersonal/badges/aspid-fasttools/${branch === 'upm' ? '' : 'preview/'}status-badge-unity.svg`;
if (!text.includes(badge) || !text.includes(unity)) fail(file, `the shared badge URLs do not match #${branch}; ${fix}`);
if (file === 'README.md') {
if (!text.includes(`[![${label}](${badge})]`)) fail(file, `has no dynamic "${label}" badge; ${fix}`);
const target = `${REPOSITORY}/releases${branch === 'upm' ? '/latest' : ''})`;
if (!text.includes(target)) fail(file, `the dynamic badge does not link ${target}; ${fix}`);
checkInstallUrls(file, text);
continue;
}
if (!whole(`${label} ${version}`).test(text)) fail(file, `has no "${label} ${version}" badge; ${fix}`);
if (!text.includes(`/releases/tag/v${version})`)) fail(file, `the badge does not link the v${version} release; ${fix}`);
checkInstallUrls(file, text);
}
Expand Down
17 changes: 6 additions & 11 deletions scripts/set-version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# Set the package version everywhere it is written by hand: package.json, the badge SVG and the badge alt text,
# Set the package version everywhere it is written by hand: package.json and the documentation badge alt text,
# release link and install URLs in both README translations (Website/docs, Website/i18n/ru). The root README is
# regenerated from the English one; on a stable version the unshipped analyzer rules move to
# AnalyzerReleases.Shipped.md. The [Unreleased] notes of CHANGELOG.md and Website/i18n/ru/CHANGELOG.md become the version's
Expand Down Expand Up @@ -42,6 +42,8 @@ case "$NEW" in
*) BRANCH=upm SKILLS=skills LABEL=Release EN='latest release' RU='последнюю версию' ;;
esac
export NEW BRANCH SKILLS LABEL EN RU
case "$BRANCH" in upm) BADGE_KIND=release UNITY_CHANNEL= ;; *) BADGE_KIND=preview UNITY_CHANNEL=preview/ ;; esac
export BADGE_KIND UNITY_CHANNEL
# Only the "version" line: a dependency can be at the same number.
OLD=$OLD perl -pi -e 's/^( "version": ")\Q$ENV{OLD}\E(",)$/$1$ENV{NEW}$2/' "$PKG/package.json"
# Each file replaces the version its own badge carries, whole: 1.0.0 does not rewrite 1.0.0-rc.8 or 11.0.0.
Expand All @@ -50,6 +52,8 @@ WHOLE='s/(?<![0-9.])\Q$old\E(?![0-9A-Za-z-]|\.[0-9A-Za-z])/$ENV{NEW}/g if define
for f in "$DOCS/README.md" "$RU_DOCS/README.md"; do
perl -0pi -e 'my ($old) = /\[!\[(?:Preview|Release) ([^\]]+)\]/; '"$WHOLE"';
s/\[!\[(?:Preview|Release) /[![$ENV{LABEL} /g;
s{(vpdpersonal\.github\.io/VPDPersonal/badges/aspid-fasttools/)status-badge-(?:release|preview)\.svg}{$1status-badge-$ENV{BADGE_KIND}.svg}g;
s{(vpdpersonal\.github\.io/VPDPersonal/badges/aspid-fasttools/)(?:preview/)?status-badge-unity\.svg}{$1$ENV{UNITY_CHANNEL}status-badge-unity.svg}g;
s/\.git#upm(?:-preview)?\b/.git#$ENV{BRANCH}/g;
s/the latest (?:preview|release);/the $ENV{EN};/;
s/на последнюю (?:preview-)?версию;/на $ENV{RU};/' "$f"
Expand All @@ -58,16 +62,7 @@ done
for f in "$DOCS/13-agent-skills.md" "$RU_DOCS/13-agent-skills.md"; do
perl -pi -e 's/Aspid\.FastTools#skills(?:-preview)?\b/Aspid.FastTools#$ENV{SKILLS}/g' "$f"
done
# The badge is as wide as its version text: an estimated 13px glyph width per character, plus 14px of padding,
# which keeps 1.0.0-rc.8 at the original 162.
perl -0pi -e 'my ($old) = /aria-label="(?:Preview|Release) ([^"]+)"/; '"$WHOLE"';
s/(?:Preview|Release)( \Q$ENV{NEW}\E|<\/text>)/$ENV{LABEL}$1/g;
if (my ($t) = /class="text" x="90" y="20\.5">([^<]*)</) {
my $e = 0; $e += /[0-9]/ ? 7.4 : /\./ ? 3.6 : /-/ ? 4.6 : /[A-Z]/ ? 8.5 : 6.6 for split //, $t;
my $w = 90 + int($e + 0.5) + 14; my $r = $w - 1;
s/width="\d+" height="32" viewBox="0 0 \d+ 32"/width="$w" height="32" viewBox="0 0 $w 32"/;
s/(<rect class="outline"[^>]* width=")\d+/$1$r/;
}' "$DOCS/Images/status-badge-preview.svg"
# Shared SVGs are refreshed from published releases by VPDPersonal's badge workflow.
# Analyzer release tracking: the unshipped rules ship with a stable version. Its release headers accept only
# System.Version numbers (RS2007), so pre-releases keep them unshipped. A version that already has its header is
# never given a second one.
Expand Down
Loading
Loading