Skip to content

Commit a7fa645

Browse files
Merge pull request #25 from paritytech/chore/rename-to-truapi
Prepare for repo rename: truapi-explorer → truapi
2 parents 26a8b8d + 5c9d60e commit a7fa645

4 files changed

Lines changed: 39 additions & 21 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# TrUAPI Protocol Explorer
1+
# TrUAPI
22

3-
Interactive reference documentation for the TrUAPI (Triangle User-Agent Programming Interface) Protocol, the protocol that mediates all communication between a host application and products running in sandboxes.
3+
TrUAPI (Triangle User-Agent Programming Interface) Protocol — the protocol that mediates all communication between a host application and products running in sandboxes.
4+
5+
This repository is the single source of truth for the TrUAPI protocol, containing Rust trait definitions, an interactive protocol explorer, and documentation.
46

57
The explorer covers two protocol versions:
68

@@ -54,8 +56,8 @@ Setup:
5456

5557
After deployment:
5658

57-
- Webapp: `https://paritytech.github.io/truapi-explorer/`
58-
- Rust docs: `https://paritytech.github.io/truapi-explorer/rustdoc/truapi_spec/`
59+
- Webapp: `https://paritytech.github.io/truapi/`
60+
- Rust docs: `https://paritytech.github.io/truapi/rustdoc/truapi_spec/`
5961

6062
The workflow is defined in `.github/workflows/deploy.yml`.
6163

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "tru-api-explorer",
2+
"name": "truapi",
33
"private": true,
44
"version": "0.0.0",
55
"type": "module",

src/main.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@ import { BrowserRouter } from 'react-router-dom'
44
import './index.css'
55
import App from './App.tsx'
66

7-
// The repo was renamed from `host-api-explorer` to `truapi-explorer`.
8-
// Rewrite any incoming legacy path so bookmarks to the old URL keep working.
9-
const LEGACY_BASE = '/host-api-explorer'
10-
const NEW_BASE = '/truapi-explorer'
11-
if (
12-
window.location.pathname === LEGACY_BASE ||
13-
window.location.pathname.startsWith(`${LEGACY_BASE}/`)
14-
) {
15-
const rewritten =
16-
NEW_BASE +
17-
window.location.pathname.slice(LEGACY_BASE.length) +
18-
window.location.search +
19-
window.location.hash
20-
window.location.replace(rewritten)
7+
// Rewrite legacy paths so bookmarks keep working after renames.
8+
const CURRENT_BASE = '/truapi'
9+
const LEGACY_BASES = ['/host-api-explorer', '/truapi-explorer']
10+
for (const legacy of LEGACY_BASES) {
11+
if (
12+
window.location.pathname === legacy ||
13+
window.location.pathname.startsWith(`${legacy}/`)
14+
) {
15+
const rewritten =
16+
CURRENT_BASE +
17+
window.location.pathname.slice(legacy.length) +
18+
window.location.search +
19+
window.location.hash
20+
window.location.replace(rewritten)
21+
break
22+
}
2123
}
2224

2325
createRoot(document.getElementById('root')!).render(
2426
<StrictMode>
25-
<BrowserRouter basename={NEW_BASE}>
27+
<BrowserRouter basename={CURRENT_BASE}>
2628
<App />
2729
</BrowserRouter>
2830
</StrictMode>,

vite.config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ function spa404Plugin(): Plugin {
1818
}
1919

2020
export default defineConfig({
21-
base: '/truapi-explorer/',
21+
base: '/truapi/',
2222
plugins: [react(), tailwindcss(), spa404Plugin()],
23+
server: {
24+
// Redirect legacy base paths to /truapi/ during development.
25+
// In production, the 404.html SPA fallback handles this instead.
26+
proxy: {
27+
'/truapi-explorer': {
28+
target: 'http://localhost:5173',
29+
rewrite: (path) => path.replace(/^\/truapi-explorer/, '/truapi'),
30+
},
31+
'/host-api-explorer': {
32+
target: 'http://localhost:5173',
33+
rewrite: (path) => path.replace(/^\/host-api-explorer/, '/truapi'),
34+
},
35+
},
36+
},
2337
})

0 commit comments

Comments
 (0)