mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Add versioning system, changelog page, and release skill
Replace calver (YYYY.MM.DD+sha) with marketing versioning (X.Y.Z), starting at 9.9.0. Add changelog page at /changelog with Keep a Changelog parsing, pre-release banner, and expandable entries linked to GitLab releases. Add VersionCheck component that shows a "What's new" toast when the app version changes. Add release skill for managing versioned releases with changelog and git tagging.
This commit is contained in:
20 files changed
+754
-43
No files matched your search
@@ -0,0 +1,198 @@
|
||||
---
|
||||
name: release
|
||||
description: Publish a new app release with versioning, changelog, and git tagging. Triggered by "publish a new release" or similar requests.
|
||||
---
|
||||
|
||||
# Release Skill
|
||||
|
||||
This skill guides you through publishing a new release of the app. It handles version bumping, changelog generation, and git tagging/pushing.
|
||||
|
||||
## Overview
|
||||
|
||||
- **Version format**: Marketing version (X.Y.Z), starting from 9.9.0. **This is NOT semver.** Version numbers are chosen based on how the release looks to end users, not based on API compatibility or breaking changes. Think of it like an app store version -- the number reflects the perceived significance of the update to a regular user.
|
||||
- **Version source of truth**: `package.json` `version` field
|
||||
- **Changelog**: `CHANGELOG.md` in repo root, using [Keep a Changelog](https://keepachangelog.com/) format
|
||||
- **Version bumping**:
|
||||
- **Patch (Z)**: Most releases. Bug fixes, tweaks, internal improvements, anything a user wouldn't specifically notice or seek out.
|
||||
- **Minor (Y)**: Releases with headline features -- things worth announcing. A user should be able to look at the minor bump and think "oh, something new happened."
|
||||
- **Major (X)**: Only when the user explicitly requests it (milestones, rebrands, major redesigns)
|
||||
- **CI trigger**: Pushing a version tag (`v9.9.0`) triggers the CI pipeline to build and create a GitLab release
|
||||
|
||||
## Release Procedure
|
||||
|
||||
Follow these steps in order. Do NOT skip any step.
|
||||
|
||||
### Step 1: Required Reading
|
||||
|
||||
Before writing any release notes, you MUST read these pages to understand the product context, voice, and values:
|
||||
|
||||
1. **https://soapbox.pub/** -- Soapbox company overview and product suite
|
||||
2. **https://shakespeare.diy/** -- Shakespeare product page
|
||||
|
||||
These pages define what Shakespeare is, how it's positioned, and the tone of voice to use. Changelog entries should reflect this identity: creative, empowering, user-focused, emphasizing building and self-expression. Avoid dry technical jargon -- write for people who use the app, not developers.
|
||||
|
||||
### Step 2: Pre-flight Checks
|
||||
|
||||
```bash
|
||||
# Ensure working directory is clean
|
||||
git status
|
||||
|
||||
# Ensure we're on main branch
|
||||
git branch --show-current
|
||||
|
||||
# Run the full test suite
|
||||
npm run test
|
||||
```
|
||||
|
||||
- If the working directory has uncommitted changes, ask the user whether to commit them first or abort.
|
||||
- If not on `main`, warn the user and ask whether to proceed.
|
||||
- If tests fail, stop and fix the issues before continuing.
|
||||
|
||||
### Step 3: Determine What Changed
|
||||
|
||||
```bash
|
||||
# Get the current version from package.json
|
||||
node -p "require('./package.json').version"
|
||||
|
||||
# Get commits since the last version tag
|
||||
git log v$(node -p "require('./package.json').version")..HEAD --oneline
|
||||
```
|
||||
|
||||
- If there are no commits since the last tag, inform the user there is nothing to release and stop.
|
||||
- Review the commit list to understand the scope of changes.
|
||||
|
||||
### Step 4: Decide the Version Bump
|
||||
|
||||
Analyze the commits from Step 3 and determine the appropriate bump level:
|
||||
|
||||
| Bump | When to use | Example |
|
||||
|------|-------------|---------|
|
||||
| **Patch** | Bug fixes, minor tweaks, dependency updates, small UI polish, internal tooling, developer-facing pages, CI/build changes, settings/admin screens | 9.9.0 -> 9.9.1 |
|
||||
| **Minor** | Significant new product features that change how users interact with the app -- the kind of thing you'd highlight in an app store update or announce on social media (e.g., new template support, new AI features, new deployment options, major UI overhaul) | 9.9.1 -> 9.10.0 |
|
||||
| **Major** | ONLY when the user explicitly instructs a major bump | 9.10.0 -> 10.0.0 |
|
||||
|
||||
**Default to patch** when in doubt. The bar for a minor bump is high -- ask yourself: "Would a regular user notice and care about this change?" If the answer is no, it's a patch. Internal pages (changelog, settings, about screens), infrastructure improvements, CI fixes, and developer tooling are always patch-level regardless of whether they technically add a new page or screen.
|
||||
|
||||
When bumping minor, reset patch to 0 (e.g., 9.9.3 -> 9.10.0).
|
||||
When bumping major, reset minor and patch to 0 (e.g., 9.3.1 -> 10.0.0).
|
||||
|
||||
### Step 5: Write the Changelog Entry
|
||||
|
||||
Prepend a new section to `CHANGELOG.md` directly below the `# Changelog` heading.
|
||||
|
||||
**Format:**
|
||||
|
||||
```markdown
|
||||
## [X.Y.Z] - YYYY-MM-DD
|
||||
|
||||
### Added
|
||||
- Description of new features
|
||||
|
||||
### Changed
|
||||
- Description of changes to existing features
|
||||
|
||||
### Fixed
|
||||
- Description of bug fixes
|
||||
|
||||
### Removed
|
||||
- Description of removed features
|
||||
```
|
||||
|
||||
**Rules:**
|
||||
- Only include categories that have entries (omit empty categories)
|
||||
- Write **user-facing descriptions**, not raw commit messages
|
||||
- Keep descriptions concise -- one line per change
|
||||
- Group related commits into single entries where appropriate
|
||||
- Use present tense ("Add dark mode toggle", not "Added dark mode toggle")
|
||||
- Focus on what the user sees/experiences, not internal implementation details
|
||||
- Use the current date in YYYY-MM-DD format
|
||||
- **Collapse related work into one entry.** If a feature was added and then fixed/tweaked across multiple commits in the same release, present the finished result as a single "Added" entry. Never list something as "Added" and then also list fixes for that same thing -- the user sees the end product, not the development history.
|
||||
- **Omit purely internal changes.** CI fixes, build pipeline tweaks, developer tooling, and infrastructure changes should be omitted from the changelog entirely unless they have a direct, visible impact on the user experience. The changelog is for users, not developers.
|
||||
- **Compare the actual code between versions** to understand what really changed, rather than just reading commit messages. Commit messages may over- or under-represent the significance of changes.
|
||||
|
||||
### Step 6: Update Version in All Files
|
||||
|
||||
#### 6a. `package.json`
|
||||
|
||||
Update the `version` field:
|
||||
|
||||
```json
|
||||
"version": "X.Y.Z"
|
||||
```
|
||||
|
||||
### Step 7: Copy Changelog to Public Directory
|
||||
|
||||
The changelog is served at runtime by the app from the `public/` directory. After updating `CHANGELOG.md`, copy it:
|
||||
|
||||
```bash
|
||||
cp CHANGELOG.md public/CHANGELOG.md
|
||||
```
|
||||
|
||||
### Step 8: Pull Latest Changes
|
||||
|
||||
Before committing the release, pull the latest changes from the remote to ensure the release commit sits on top of the latest code. This **must** happen before committing and tagging.
|
||||
|
||||
```bash
|
||||
git pull origin main
|
||||
```
|
||||
|
||||
**CRITICAL**: Always use `git pull` (merge), NEVER `git pull --rebase`. Rebasing rewrites commit hashes, which would orphan any tag pointing to the original commit. Since version tags are often protected on the remote and cannot be deleted or updated, a broken tag cannot be easily fixed.
|
||||
|
||||
If there are merge conflicts with the pulled changes, resolve them before proceeding.
|
||||
|
||||
### Step 9: Commit the Release
|
||||
|
||||
```bash
|
||||
git add package.json CHANGELOG.md public/CHANGELOG.md
|
||||
git commit -m "release: vX.Y.Z"
|
||||
```
|
||||
|
||||
### Step 10: Tag the Release
|
||||
|
||||
```bash
|
||||
git tag vX.Y.Z
|
||||
```
|
||||
|
||||
The tag format is `v` followed by the version with no suffix. Examples: `v9.9.0`, `v9.10.0`, `v10.0.0`.
|
||||
|
||||
### Step 11: Push
|
||||
|
||||
```bash
|
||||
git push origin main vX.Y.Z
|
||||
```
|
||||
|
||||
**CRITICAL**: Push only the specific tag being released. NEVER use `--tags` -- that pushes ALL local tags, including stale or deleted ones.
|
||||
|
||||
### Step 12: Confirm
|
||||
|
||||
After pushing, inform the user:
|
||||
- The new version number
|
||||
- A brief summary of what was released
|
||||
- That CI will handle building and publishing the artifacts
|
||||
|
||||
## File Reference
|
||||
|
||||
| File | What to update | Notes |
|
||||
|------|---------------|-------|
|
||||
| `package.json` | `version` field | Source of truth for the version |
|
||||
| `CHANGELOG.md` | Prepend new section | User-facing changelog |
|
||||
| `public/CHANGELOG.md` | Copy from `CHANGELOG.md` | Served at runtime by the app |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### "Nothing to release"
|
||||
If `git log` shows no commits since the last tag, there genuinely is nothing to release.
|
||||
|
||||
### Tests fail
|
||||
Fix the failing tests before proceeding. The release must not contain broken code.
|
||||
|
||||
### Wrong version bumped
|
||||
If you tagged the wrong version and haven't pushed yet:
|
||||
```bash
|
||||
git tag -d vX.Y.Z # delete the local tag
|
||||
git reset --soft HEAD~1 # undo the commit but keep changes staged
|
||||
```
|
||||
Then redo steps 4-10 with the correct version.
|
||||
|
||||
### Already pushed a bad release
|
||||
This requires manual intervention. Inform the user and suggest they delete the tag and release from GitLab manually, then re-run the release process.
|
||||
@@ -0,0 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## [9.9.0] - 2026-04-02
|
||||
|
||||
### Added
|
||||
- Changelog page and versioning system with "What's new" toast notifications on updates
|
||||
- Release skill for managing versioned releases with changelog generation and git tagging
|
||||
Generated
+2
-27
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "shakespeare.diy",
|
||||
"version": "0.0.0",
|
||||
"version": "9.9.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "shakespeare.diy",
|
||||
"version": "0.0.0",
|
||||
"version": "9.9.0",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
@@ -4677,7 +4677,6 @@
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4691,7 +4690,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4705,7 +4703,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4719,7 +4716,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4733,7 +4729,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4747,7 +4742,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4761,7 +4755,6 @@
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4775,7 +4768,6 @@
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4789,7 +4781,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4803,7 +4794,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4817,7 +4807,6 @@
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4831,7 +4820,6 @@
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4845,7 +4833,6 @@
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4859,7 +4846,6 @@
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4873,7 +4859,6 @@
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4887,7 +4872,6 @@
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4901,7 +4885,6 @@
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4915,7 +4898,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4929,7 +4911,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4943,7 +4924,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4957,7 +4937,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4971,7 +4950,6 @@
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4985,7 +4963,6 @@
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -4999,7 +4976,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -5013,7 +4989,6 @@
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment",
|
||||
"homepage": "https://shakespeare.diy",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "0.0.0",
|
||||
"version": "9.9.0",
|
||||
"type": "module",
|
||||
"author": {
|
||||
"name": "shakespeare.diy",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## [9.9.0] - 2026-04-02
|
||||
|
||||
### Added
|
||||
- Changelog page and versioning system with "What's new" toast notifications on updates
|
||||
- Release skill for managing versioned releases with changelog generation and git tagging
|
||||
@@ -30,6 +30,7 @@ import { OfflineIndicator } from '@/components/OfflineIndicator';
|
||||
import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt';
|
||||
import { ErrorBoundary } from '@/components/ErrorBoundary';
|
||||
import { LockdownModeDetector } from '@/components/LockdownModeDetector';
|
||||
import { VersionCheck } from '@/components/VersionCheck';
|
||||
|
||||
import AppRouter from './AppRouter';
|
||||
|
||||
@@ -152,6 +153,7 @@ export function App() {
|
||||
<DynamicFavicon />
|
||||
<OfflineIndicator />
|
||||
<PWAUpdatePrompt />
|
||||
<VersionCheck />
|
||||
<LockdownModeDetector />
|
||||
<Suspense>
|
||||
<AppRouter />
|
||||
|
||||
@@ -23,6 +23,7 @@ import { NIP19Page } from "./pages/NIP19Page";
|
||||
import NotFound from "./pages/NotFound";
|
||||
import { ProjectView } from "./pages/ProjectView";
|
||||
import { SettingsLayout } from "./components/SettingsLayout";
|
||||
import { ChangelogPage } from "./pages/ChangelogPage";
|
||||
|
||||
export function AppRouter() {
|
||||
return (
|
||||
@@ -49,6 +50,7 @@ export function AppRouter() {
|
||||
<Route path="storage" element={<StorageSettings />} />
|
||||
<Route path="about" element={<AboutSettings />} />
|
||||
</Route>
|
||||
<Route path="/changelog" element={<ChangelogPage />} />
|
||||
<Route path="/project/:projectId" element={<ProjectView />} />
|
||||
{/* NIP-19 route for npub1, note1, naddr1, nevent1, nprofile1 */}
|
||||
<Route path="/:nip19" element={<NIP19Page />} />
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { toast } from '@/hooks/useToast';
|
||||
import { ToastAction } from '@/components/ui/toast';
|
||||
import { parseChangelog } from '@/lib/changelog';
|
||||
|
||||
const STORAGE_KEY = 'shakespeare:app-version';
|
||||
|
||||
/** Fetch the first changelog item for the given version (or the latest entry). */
|
||||
async function fetchChangelogExcerpt(version: string): Promise<string | undefined> {
|
||||
try {
|
||||
const res = await fetch('/CHANGELOG.md');
|
||||
if (!res.ok) return undefined;
|
||||
const markdown = await res.text();
|
||||
const entries = parseChangelog(markdown);
|
||||
|
||||
// Try to find the entry matching the current version, otherwise use the first entry.
|
||||
const entry = entries.find((e) => e.version === version) ?? entries[0];
|
||||
if (!entry) return undefined;
|
||||
|
||||
// Return the first item from the first section.
|
||||
return entry.sections[0]?.items[0];
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/** Compares the running app version against localStorage and shows a toast when the version changes. */
|
||||
export function VersionCheck() {
|
||||
useEffect(() => {
|
||||
const currentVersion = import.meta.env.VERSION;
|
||||
if (!currentVersion) return;
|
||||
|
||||
const storedVersion = localStorage.getItem(STORAGE_KEY);
|
||||
localStorage.setItem(STORAGE_KEY, currentVersion);
|
||||
|
||||
if (storedVersion && storedVersion !== currentVersion) {
|
||||
// Show the toast immediately, then enrich it with a changelog excerpt.
|
||||
const { update, id } = toast({
|
||||
title: `What's new in v${currentVersion}`,
|
||||
action: (
|
||||
<ToastAction altText="View changelog" asChild>
|
||||
<Link to="/changelog">See all</Link>
|
||||
</ToastAction>
|
||||
),
|
||||
});
|
||||
|
||||
fetchChangelogExcerpt(currentVersion).then((excerpt) => {
|
||||
if (excerpt) {
|
||||
update({
|
||||
id,
|
||||
title: `What's new in v${currentVersion}`,
|
||||
description: excerpt,
|
||||
action: (
|
||||
<ToastAction altText="View changelog" asChild>
|
||||
<Link to="/changelog">See all</Link>
|
||||
</ToastAction>
|
||||
),
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/** Category types from Keep a Changelog format. */
|
||||
type ChangelogCategory = 'Added' | 'Changed' | 'Deprecated' | 'Removed' | 'Fixed' | 'Security';
|
||||
|
||||
/** A single version entry in the changelog. */
|
||||
interface ChangelogEntry {
|
||||
version: string;
|
||||
date: string;
|
||||
sections: {
|
||||
category: ChangelogCategory;
|
||||
items: string[];
|
||||
}[];
|
||||
}
|
||||
|
||||
/** Apply basic typographic transformations to a changelog item string. */
|
||||
function prettify(text: string): string {
|
||||
return text
|
||||
.replace(/ -- /g, ' \u2014 ') // space-dash-dash-space → em dash
|
||||
.replace(/(\w)--(\w)/g, '$1\u2013$2') // word--word → en dash
|
||||
.replace(/ (\S+)$/, '\u00A0$1'); // prevent orphaned last word
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Keep a Changelog formatted markdown string into structured data.
|
||||
* @see https://keepachangelog.com/
|
||||
*/
|
||||
function parseChangelog(markdown: string): ChangelogEntry[] {
|
||||
const entries: ChangelogEntry[] = [];
|
||||
let current: ChangelogEntry | null = null;
|
||||
let currentCategory: ChangelogCategory | null = null;
|
||||
|
||||
for (const line of markdown.split('\n')) {
|
||||
// Match version heading: ## [X.Y.Z] - YYYY-MM-DD
|
||||
const versionMatch = line.match(/^## \[([^\]]+)\]\s*-\s*(.+)$/);
|
||||
if (versionMatch) {
|
||||
current = { version: versionMatch[1], date: versionMatch[2].trim(), sections: [] };
|
||||
entries.push(current);
|
||||
currentCategory = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Match category heading: ### Added, ### Changed, etc.
|
||||
const categoryMatch = line.match(/^### (.+)$/);
|
||||
if (categoryMatch && current) {
|
||||
currentCategory = categoryMatch[1].trim() as ChangelogCategory;
|
||||
current.sections.push({ category: currentCategory, items: [] });
|
||||
continue;
|
||||
}
|
||||
|
||||
// Match list item: - Description
|
||||
const itemMatch = line.match(/^- (.+)$/);
|
||||
if (itemMatch && current) {
|
||||
const section = current.sections[current.sections.length - 1];
|
||||
if (section) {
|
||||
section.items.push(prettify(itemMatch[1]));
|
||||
} else {
|
||||
// Item without a category heading — treat as "Changed"
|
||||
current.sections.push({ category: 'Changed', items: [prettify(itemMatch[1])] });
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Lines that don't start with "- " but aren't blank may be a continuation or
|
||||
// freeform text after the version heading (e.g. "Initial release of Shakespeare").
|
||||
const trimmed = line.trim();
|
||||
if (trimmed && current && !trimmed.startsWith('#')) {
|
||||
const section = current.sections[current.sections.length - 1];
|
||||
if (section) {
|
||||
// Append to last item or add new item
|
||||
section.items.push(prettify(trimmed));
|
||||
} else {
|
||||
// Freeform text under version with no category — store in a generic section
|
||||
current.sections.push({ category: 'Changed', items: [prettify(trimmed)] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
export { parseChangelog };
|
||||
export type { ChangelogEntry, ChangelogCategory };
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import { NPool, NRelay1 } from '@nostrify/nostrify';
|
||||
import type { NostrEvent, NostrSigner } from '@nostrify/nostrify';
|
||||
import type { NostrSigner } from '@nostrify/nostrify';
|
||||
|
||||
import { DotAI } from '../DotAI';
|
||||
import { buildAppEvent } from '../appEvent';
|
||||
|
||||
@@ -239,6 +239,7 @@
|
||||
"aboutShakespeareDescription": "Information about Shakespeare",
|
||||
"mirrors": "Mirrors",
|
||||
"mirrorsDescription": "Shakespeare is available at multiple mirror URLs for redundancy and accessibility.",
|
||||
"changelog": "Changelog",
|
||||
"sourceCode": "Source Code",
|
||||
"description": "Description",
|
||||
"license": "License",
|
||||
|
||||
@@ -267,6 +267,7 @@
|
||||
"aboutShakespeareDescription": "Bayani game da Shakespeare.",
|
||||
"mirrors": "Madubai",
|
||||
"mirrorsDescription": "Shakespeare yana samuwa a URLs masu yawa don inganci da samun dama.",
|
||||
"changelog": "Tarihin Canje-canje",
|
||||
"sourceCode": "Lambar Tushe",
|
||||
"description": "Bayanin",
|
||||
"license": "Lasisi",
|
||||
|
||||
@@ -267,6 +267,7 @@
|
||||
"aboutShakespeareDescription": "Ozi gbasara Shakespeare.",
|
||||
"mirrors": "Enyo",
|
||||
"mirrorsDescription": "Shakespeare dị na ọtụtụ URL enyo maka nnọchi na nnweta.",
|
||||
"changelog": "Ndekọ Mgbanwe",
|
||||
"sourceCode": "Koodu Isi",
|
||||
"description": "Nkọwa",
|
||||
"license": "Ikike",
|
||||
|
||||
@@ -276,6 +276,7 @@
|
||||
"aboutShakespeareDescription": "Informações sobre o Shakespeare.",
|
||||
"mirrors": "Espelhos",
|
||||
"mirrorsDescription": "Shakespeare está disponível em vários URLs espelhados para redundância e acessibilidade.",
|
||||
"changelog": "Registro de alterações",
|
||||
"sourceCode": "Código-fonte",
|
||||
"description": "Descrição",
|
||||
"license": "Licença",
|
||||
|
||||
@@ -267,6 +267,7 @@
|
||||
"aboutShakespeareDescription": "Alaye nipa Shakespeare.",
|
||||
"mirrors": "Awọn Digi",
|
||||
"mirrorsDescription": "Shakespeare wa ni awọn URL digi pupọ fun aredundan ati iraye si.",
|
||||
"changelog": "Akọsilẹ Ayipada",
|
||||
"sourceCode": "Koodu Orisun",
|
||||
"description": "Apejuwe",
|
||||
"license": "Iwe-aṣẹ",
|
||||
|
||||
@@ -276,6 +276,7 @@
|
||||
"aboutShakespeareDescription": "关于Shakespeare的信息。",
|
||||
"mirrors": "镜像",
|
||||
"mirrorsDescription": "Shakespeare可通过多个镜像URL访问,以确保冗余和可访问性。",
|
||||
"changelog": "更新日志",
|
||||
"sourceCode": "源代码",
|
||||
"description": "描述",
|
||||
"license": "许可证",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Info, ExternalLink, Loader2, AlertTriangle, Code, Globe } from 'lucide-react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Info, ExternalLink, Loader2, AlertTriangle, Code, Globe, ScrollText } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { SettingsPageLayout } from '@/components/SettingsPageLayout';
|
||||
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
|
||||
@@ -97,6 +98,22 @@ export function AboutSettings() {
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
|
||||
{/* Changelog */}
|
||||
<Card>
|
||||
<CardContent className="p-0">
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="w-full h-12 flex items-center gap-2 justify-start text-base"
|
||||
asChild
|
||||
>
|
||||
<Link to="/changelog">
|
||||
<ScrollText className="!size-5 text-muted-foreground" />
|
||||
{t('changelog')}
|
||||
</Link>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Project Information */}
|
||||
<Card>
|
||||
<CardContent className="p-0">
|
||||
@@ -148,9 +165,9 @@ export function AboutSettings() {
|
||||
</div>
|
||||
|
||||
{import.meta.env.VERSION && (
|
||||
<div className="text-center text-xs text-muted-foreground/60 pt-4">
|
||||
v{import.meta.env.VERSION}
|
||||
</div>
|
||||
<Link to="/changelog" className="block text-center text-[11px] text-muted-foreground/50 hover:text-muted-foreground transition-colors select-none pt-4 pb-2">
|
||||
v{import.meta.env.VERSION}{import.meta.env.COMMIT_TAG ? '' : '+'} ({new Date(import.meta.env.BUILD_DATE).toLocaleDateString()})
|
||||
</Link>
|
||||
)}
|
||||
</SettingsPageLayout>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,323 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useSeoMeta } from '@unhead/react';
|
||||
import { ArrowLeft, Bug, FlaskConical, Minus, Package, Plus, RefreshCw, ShieldAlert } from 'lucide-react';
|
||||
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
import { parseChangelog } from '@/lib/changelog';
|
||||
import type { ChangelogCategory, ChangelogEntry } from '@/lib/changelog';
|
||||
|
||||
const GITLAB_REPO = 'https://gitlab.com/soapbox-pub/shakespeare';
|
||||
|
||||
/** Per-category icon + color used as inline list bullets. */
|
||||
const CATEGORY_STYLES: Record<ChangelogCategory, { icon: typeof Plus; colorClass: string }> = {
|
||||
Added: { icon: Plus, colorClass: 'text-emerald-600 dark:text-emerald-400' },
|
||||
Changed: { icon: RefreshCw, colorClass: 'text-blue-600 dark:text-blue-400' },
|
||||
Deprecated: { icon: Package, colorClass: 'text-orange-600 dark:text-orange-400' },
|
||||
Removed: { icon: Minus, colorClass: 'text-red-600 dark:text-red-400' },
|
||||
Fixed: { icon: Bug, colorClass: 'text-amber-600 dark:text-amber-400' },
|
||||
Security: { icon: ShieldAlert, colorClass: 'text-purple-600 dark:text-purple-400' },
|
||||
};
|
||||
|
||||
/** Format "2026-03-26" as a readable date string. */
|
||||
function formatDate(raw: string): string {
|
||||
const date = new Date(raw + 'T00:00:00');
|
||||
if (isNaN(date.getTime())) return raw;
|
||||
return date.toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' });
|
||||
}
|
||||
|
||||
const commitSha = import.meta.env.COMMIT_SHA;
|
||||
const commitTag = import.meta.env.COMMIT_TAG;
|
||||
const buildDate = import.meta.env.BUILD_DATE;
|
||||
const isPreRelease = !commitTag;
|
||||
|
||||
export function ChangelogPage() {
|
||||
const [content, setContent] = useState<string | null>(null);
|
||||
const [error, setError] = useState(false);
|
||||
|
||||
useSeoMeta({
|
||||
title: 'Changelog | Shakespeare',
|
||||
description: "What's new in Shakespeare",
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/CHANGELOG.md')
|
||||
.then((res) => {
|
||||
if (!res.ok) throw new Error(res.statusText);
|
||||
return res.text();
|
||||
})
|
||||
.then(setContent)
|
||||
.catch(() => setError(true));
|
||||
}, []);
|
||||
|
||||
const entries = useMemo(() => (content ? parseChangelog(content) : []), [content]);
|
||||
const latestVersion = entries[0]?.version;
|
||||
|
||||
return (
|
||||
<main className="min-h-screen bg-background">
|
||||
{/* Header */}
|
||||
<div className="border-b">
|
||||
<div className="max-w-2xl mx-auto px-4 py-3 flex items-center gap-3">
|
||||
<Button variant="ghost" size="sm" className="h-8 w-8 p-0" asChild>
|
||||
<Link to="/settings/about">
|
||||
<ArrowLeft className="size-4" />
|
||||
</Link>
|
||||
</Button>
|
||||
<h1 className="text-lg font-semibold">Changelog</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="max-w-2xl mx-auto px-4 pt-3 pb-16 space-y-4">
|
||||
{error ? (
|
||||
<p className="text-sm text-muted-foreground pt-4">Failed to load changelog.</p>
|
||||
) : content === null ? (
|
||||
<ChangelogSkeleton />
|
||||
) : entries.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground pt-4">No releases yet.</p>
|
||||
) : (
|
||||
<>
|
||||
{isPreRelease && latestVersion && <PreReleaseBanner latestVersion={latestVersion} />}
|
||||
|
||||
<LatestRelease entry={entries[0]} />
|
||||
|
||||
{entries.length > 1 && (
|
||||
<>
|
||||
<div className="flex items-center gap-3 pt-4 pb-1">
|
||||
<div className="h-px flex-1 bg-border" />
|
||||
<span className="text-xs font-medium text-muted-foreground uppercase tracking-wider">Past releases</span>
|
||||
<div className="h-px flex-1 bg-border" />
|
||||
</div>
|
||||
|
||||
{entries.slice(1).map((entry) => (
|
||||
<ChangelogEntryCard key={entry.version} entry={entry} />
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
/** Hero treatment for the most recent release — no card, centered version + date. */
|
||||
function LatestRelease({ entry }: { entry: ChangelogEntry }) {
|
||||
const contentRef = useRef<HTMLUListElement>(null);
|
||||
const [overflows, setOverflows] = useState(false);
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
const measure = useCallback(() => {
|
||||
const el = contentRef.current;
|
||||
if (el) setOverflows(el.scrollHeight > ENTRY_MAX_HEIGHT);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
measure();
|
||||
window.addEventListener('resize', measure);
|
||||
return () => window.removeEventListener('resize', measure);
|
||||
}, [measure]);
|
||||
|
||||
return (
|
||||
<div className="pt-2 pb-1 px-4">
|
||||
{/* Big centered version + date */}
|
||||
<a
|
||||
href={`${GITLAB_REPO}/-/releases/v${entry.version}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block text-center text-2xl font-bold tracking-tight hover:underline"
|
||||
>
|
||||
v{entry.version}
|
||||
</a>
|
||||
<a
|
||||
href={`${GITLAB_REPO}/-/releases/v${entry.version}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center justify-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors mt-1"
|
||||
>
|
||||
{formatDate(entry.date)}
|
||||
</a>
|
||||
|
||||
{/* Items */}
|
||||
<div className="relative mt-4">
|
||||
<ul
|
||||
ref={contentRef}
|
||||
style={!expanded && overflows ? { maxHeight: ENTRY_MAX_HEIGHT, overflow: 'hidden' } : undefined}
|
||||
className="space-y-2.5"
|
||||
>
|
||||
{entry.sections.flatMap((section) => {
|
||||
const style = CATEGORY_STYLES[section.category] ?? CATEGORY_STYLES.Changed;
|
||||
const Icon = style.icon;
|
||||
|
||||
return section.items.map((item, i) => (
|
||||
<li key={`${section.category}-${i}`} className="flex gap-2 text-base text-foreground/90">
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Icon className={`size-4 shrink-0 mt-1 cursor-default ${style.colorClass}`} />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="left">{section.category}</TooltipContent>
|
||||
</Tooltip>
|
||||
<span>{item}</span>
|
||||
</li>
|
||||
));
|
||||
})}
|
||||
</ul>
|
||||
{!expanded && overflows && (
|
||||
<div className="absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background to-transparent pointer-events-none" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{overflows && (
|
||||
<button
|
||||
className="w-full text-sm text-primary hover:underline mt-1"
|
||||
onClick={() => setExpanded((v) => !v)}
|
||||
>
|
||||
{expanded ? 'Show less' : 'Read more'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const ENTRY_MAX_HEIGHT = 240; // px — entries taller than this get a "Read more" button
|
||||
|
||||
/** A single changelog release card with truncation for long entries. */
|
||||
function ChangelogEntryCard({ entry }: { entry: ChangelogEntry }) {
|
||||
const contentRef = useRef<HTMLUListElement>(null);
|
||||
const [overflows, setOverflows] = useState(false);
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
const measure = useCallback(() => {
|
||||
const el = contentRef.current;
|
||||
if (el) setOverflows(el.scrollHeight > ENTRY_MAX_HEIGHT);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
measure();
|
||||
window.addEventListener('resize', measure);
|
||||
return () => window.removeEventListener('resize', measure);
|
||||
}, [measure]);
|
||||
|
||||
return (
|
||||
<div className="rounded-2xl border border-border overflow-hidden">
|
||||
{/* Version header */}
|
||||
<div className="flex items-center gap-3 px-4 py-3">
|
||||
<a
|
||||
href={`${GITLAB_REPO}/-/releases/v${entry.version}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="font-semibold text-sm hover:underline"
|
||||
>
|
||||
v{entry.version}
|
||||
</a>
|
||||
<a
|
||||
href={`${GITLAB_REPO}/-/releases/v${entry.version}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors ml-auto"
|
||||
>
|
||||
<span>{formatDate(entry.date)}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Items */}
|
||||
<div className="relative">
|
||||
<ul
|
||||
ref={contentRef}
|
||||
style={!expanded && overflows ? { maxHeight: ENTRY_MAX_HEIGHT, overflow: 'hidden' } : undefined}
|
||||
className="px-4 py-3 space-y-2.5"
|
||||
>
|
||||
{entry.sections.flatMap((section) => {
|
||||
const style = CATEGORY_STYLES[section.category] ?? CATEGORY_STYLES.Changed;
|
||||
const Icon = style.icon;
|
||||
|
||||
return section.items.map((item, i) => (
|
||||
<li key={`${section.category}-${i}`} className="flex gap-2 text-sm text-foreground/90">
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Icon className={`size-3.5 shrink-0 mt-[3px] cursor-default ${style.colorClass}`} />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="left">{section.category}</TooltipContent>
|
||||
</Tooltip>
|
||||
<span>{item}</span>
|
||||
</li>
|
||||
));
|
||||
})}
|
||||
</ul>
|
||||
{!expanded && overflows && (
|
||||
<div className="absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background to-transparent pointer-events-none" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{overflows && (
|
||||
<button
|
||||
className="w-full text-sm text-primary hover:underline py-2"
|
||||
onClick={() => setExpanded((v) => !v)}
|
||||
>
|
||||
{expanded ? 'Show less' : 'Read more'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Banner shown at the top of the changelog for untagged (pre-release) builds. */
|
||||
function PreReleaseBanner({ latestVersion }: { latestVersion: string }) {
|
||||
return (
|
||||
<div className="rounded-2xl border border-dashed border-amber-500/50 bg-amber-50/50 dark:bg-amber-950/20 px-4 py-3 space-y-1.5">
|
||||
<div className="flex items-center gap-2">
|
||||
<FlaskConical className="size-4 text-amber-600 dark:text-amber-400 shrink-0" />
|
||||
<span className="text-sm font-medium text-amber-800 dark:text-amber-300">Pre-release build</span>
|
||||
{commitSha && buildDate && (
|
||||
<a
|
||||
href={`${GITLAB_REPO}/-/commit/${commitSha}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="ml-auto text-[11px] text-amber-600/70 dark:text-amber-400/70 hover:text-amber-800 dark:hover:text-amber-300 transition-colors"
|
||||
>
|
||||
{formatDate(buildDate.split('T')[0])}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-amber-700/80 dark:text-amber-400/70">
|
||||
This build contains changes not yet included in a release.{' '}
|
||||
<a
|
||||
href={`${GITLAB_REPO}/-/compare/v${latestVersion}...${commitSha || 'main'}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline underline-offset-2 hover:text-amber-900 dark:hover:text-amber-200 transition-colors"
|
||||
>
|
||||
View unreleased changes
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ChangelogSkeleton() {
|
||||
return (
|
||||
<div className="space-y-4 pt-1">
|
||||
{[1, 2].map((i) => (
|
||||
<div key={i} className="rounded-2xl border border-border overflow-hidden">
|
||||
<div className="flex items-center gap-3 px-4 py-3">
|
||||
<Skeleton className="size-4 rounded" />
|
||||
<Skeleton className="h-4 w-16" />
|
||||
<div className="ml-auto flex items-center gap-1.5">
|
||||
<Skeleton className="size-3.5 rounded" />
|
||||
<Skeleton className="h-3 w-24" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-4 py-3 space-y-2">
|
||||
<Skeleton className="h-4 w-16 rounded-full" />
|
||||
<Skeleton className="h-4 w-full ml-3" />
|
||||
<Skeleton className="h-4 w-4/5 ml-3" />
|
||||
<Skeleton className="h-4 w-3/5 ml-3" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ChangelogPage;
|
||||
Vendored
+12
-1
@@ -1,2 +1,13 @@
|
||||
/// <reference types="vite/client" />
|
||||
/// <reference types="vite-plugin-pwa/client" />
|
||||
/// <reference types="vite-plugin-pwa/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
/** Marketing version from package.json (e.g., "9.9.0"). */
|
||||
readonly VERSION: string;
|
||||
/** ISO 8601 timestamp of when the app was built (e.g., "2026-04-02T19:42:00.000Z"). */
|
||||
readonly BUILD_DATE: string;
|
||||
/** Short git commit SHA (e.g., "c1266823"). Empty string if unavailable. */
|
||||
readonly COMMIT_SHA: string;
|
||||
/** Git tag for the current commit (e.g., "v9.9.0"). Empty string if untagged (pre-release build). */
|
||||
readonly COMMIT_TAG: string;
|
||||
}
|
||||
+24
-9
@@ -1,3 +1,4 @@
|
||||
import { createRequire } from "node:module";
|
||||
import { execSync } from "node:child_process";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -5,15 +6,26 @@ import react from "@vitejs/plugin-react-swc";
|
||||
import { defineConfig } from "vitest/config";
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
|
||||
function getVersion(): string {
|
||||
const require = createRequire(import.meta.url);
|
||||
const pkg = require("./package.json") as { version: string };
|
||||
|
||||
/** Short commit SHA — prefer CI env var, fall back to git. */
|
||||
function getCommitSha(): string {
|
||||
if (process.env.CI_COMMIT_SHORT_SHA) return process.env.CI_COMMIT_SHORT_SHA;
|
||||
try {
|
||||
const gitCommit = execSync('git rev-parse --short HEAD').toString().trim();
|
||||
const commitTimestamp = execSync('git log -1 --format=%ct').toString().trim();
|
||||
const commitDate = new Date(parseInt(commitTimestamp) * 1000);
|
||||
const utcDate = commitDate.toISOString().split('T')[0].replace(/-/g, '.');
|
||||
return `${utcDate}+${gitCommit}`;
|
||||
return execSync("git rev-parse --short HEAD", { encoding: "utf-8" }).trim();
|
||||
} catch {
|
||||
return new Date().toISOString().split('T')[0].replace(/-/g, '.');
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/** Git tag for the current commit — prefer CI env var, fall back to git. Empty string if untagged. */
|
||||
function getCommitTag(): string {
|
||||
if (process.env.CI_COMMIT_TAG) return process.env.CI_COMMIT_TAG;
|
||||
try {
|
||||
return execSync("git describe --exact-match --tags HEAD 2>/dev/null", { encoding: "utf-8" }).trim();
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +36,10 @@ export default defineConfig(() => ({
|
||||
port: 8080,
|
||||
},
|
||||
define: {
|
||||
'import.meta.env.VERSION': JSON.stringify(getVersion()),
|
||||
'import.meta.env.VERSION': JSON.stringify(pkg.version),
|
||||
'import.meta.env.BUILD_DATE': JSON.stringify(new Date().toISOString()),
|
||||
'import.meta.env.COMMIT_SHA': JSON.stringify(getCommitSha()),
|
||||
'import.meta.env.COMMIT_TAG': JSON.stringify(getCommitTag()),
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
@@ -62,4 +77,4 @@ export default defineConfig(() => ({
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
}));
|
||||
}));
|
||||
Reference in new issue
Block a user