Skip to content

Commit 45bb2fb

Browse files
authored
Merge pull request #29 from grega/homepage-usage
Edit homepage usage section
2 parents 3aa732b + 906eadd commit 45bb2fb

File tree

6 files changed

+159
-127
lines changed

6 files changed

+159
-127
lines changed

.prettierrc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
{
2-
"plugins": ["prettier-plugin-astro"],
3-
"overrides": [
4-
{
5-
"files": "*.astro",
6-
"options": {
7-
"parser": "astro"
8-
}
9-
}
10-
]
11-
}
1+
{}
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
name: Playwright Tests
22
on:
33
push:
4-
branches: [ main, master ]
4+
branches: [main, master]
55
pull_request:
6-
branches: [ main, master ]
6+
branches: [main, master]
77
jobs:
88
test:
99
timeout-minutes: 60
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-node@v4
14-
with:
15-
node-version: lts/*
16-
- name: Install dependencies
17-
run: npm ci
18-
- name: Install Playwright Browsers
19-
run: npx playwright install --with-deps
20-
- name: Run Playwright tests
21-
run: npx playwright test
22-
- uses: actions/upload-artifact@v4
23-
if: ${{ !cancelled() }}
24-
with:
25-
name: playwright-report
26-
path: playwright-report/
27-
retention-days: 30
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
- uses: actions/upload-artifact@v4
23+
if: ${{ !cancelled() }}
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

website/.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugins": ["prettier-plugin-astro"],
3+
"overrides": [
4+
{
5+
"files": "*.astro",
6+
"options": {
7+
"parser": "astro"
8+
}
9+
}
10+
]
11+
}

website/src/content/commands.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| Command | Description |
2+
| ------------- | ---------------------------------------------------------------- |
3+
| `hdi` | Interactive picker — shows all sections (default) |
4+
| `hdi install` | Just install/setup commands (aliases: `setup`, `i`) |
5+
| `hdi run` | Just run/start commands (aliases: `start`, `r`) |
6+
| `hdi test` | Just test commands (alias: `t`) |
7+
| `hdi deploy` | Just deploy/release commands and platform detection (alias: `d`) |
8+
| `hdi all` | All sections (aliases: `a`) |

website/src/pages/index.astro

Lines changed: 39 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import DemoLatte from "../assets/demo-latte.gif";
55
import DemoMocha from "../assets/demo-mocha.gif";
66
import { VERSION } from "../data/data";
77
import HdiLogo from "../components/HdiLogo.astro";
8+
import { Content as CommandTable } from "../content/commands.md";
89
---
910

1011
<Layout title="Extract install/run/test commands from project READMEs">
@@ -29,7 +30,9 @@ import HdiLogo from "../components/HdiLogo.astro";
2930
>
3031
<path
3132
d="M56.7937 84.9688C44.4187 83.4688 35.7 74.5625 35.7 63.0313C35.7 58.3438 37.3875 53.2813 40.2 49.9063C38.9812 46.8125 39.1687 40.25 40.575 37.5313C44.325 37.0625 49.3875 39.0313 52.3875 41.75C55.95 40.625 59.7 40.0625 64.2937 40.0625C68.8875 40.0625 72.6375 40.625 76.0125 41.6563C78.9187 39.0313 84.075 37.0625 87.825 37.5313C89.1375 40.0625 89.325 46.625 88.1062 49.8125C91.1062 53.375 92.7 58.1563 92.7 63.0313C92.7 74.5625 83.9812 83.2813 71.4187 84.875C74.6062 86.9375 76.7625 91.4375 76.7625 96.5938L76.7625 106.344C76.7625 109.156 79.1062 110.75 81.9187 109.625C98.8875 103.156 112.2 86.1875 112.2 65.1875C112.2 38.6563 90.6375 17 64.1062 17C37.575 17 16.2 38.6562 16.2 65.1875C16.2 86 29.4187 103.25 47.2312 109.719C49.7625 110.656 52.2 108.969 52.2 106.438L52.2 98.9375C50.8875 99.5 49.2 99.875 47.7 99.875C41.5125 99.875 37.8562 96.5 35.2312 90.2188C34.2 87.6875 33.075 86.1875 30.9187 85.9063C29.7937 85.8125 29.4187 85.3438 29.4187 84.7813C29.4187 83.6563 31.2937 82.8125 33.1687 82.8125C35.8875 82.8125 38.2312 84.5 40.6687 87.9688C42.5437 90.6875 44.5125 91.9063 46.8562 91.9063C49.2 91.9063 50.7 91.0625 52.8562 88.9063C54.45 87.3125 55.6687 85.9063 56.7937 84.9688Z"
32-
fill="currentColor"></path>
33+
fill="currentColor"
34+
>
35+
</path>
3336
</svg>
3437
<span class="version">{VERSION}</span>
3538
</a>
@@ -48,9 +51,7 @@ import HdiLogo from "../components/HdiLogo.astro";
4851
<section id="install-section">
4952
<h2>Install</h2>
5053
<Install />
51-
<p class="install-note">
52-
Works on macOS and Linux (probably WSL2 also).
53-
</p>
54+
<p class="install-note">Works on macOS and Linux (probably WSL2 also).</p>
5455
</section>
5556

5657
<section class="demo-gif">
@@ -76,39 +77,32 @@ import HdiLogo from "../components/HdiLogo.astro";
7677
etc. It extracts the fenced code blocks from matching sections and
7778
presents them as an interactive, executable list.
7879
</p>
79-
</section>
80-
81-
<section class="usage-section">
82-
<h2>Usage</h2>
83-
<pre
84-
class="usage-block"><code>$ cd some-project
85-
$ hdi
86-
<span class="u-yellow">[hdi]</span> some-project
87-
88-
<span class="u-yellow">▸</span> <span class="u-sapphire">Installation</span>
89-
<span class="u-green">▶ npm install</span>
90-
<span class="u-green">cp .env.example .env</span>
91-
92-
<span class="u-yellow">▸</span> <span class="u-sapphire">Run</span>
93-
<span class="u-green">npm run dev</span>
94-
95-
↑↓ navigate ⇥ sections ⏎ execute c copy q quit</code></pre>
9680
<p class="usage-docs-link">
9781
<a
98-
href="https://github.com/grega/hdi#usage"
82+
href="https://blog.gregdev.com/posts/2026-03-18-hdi-a-cli-tool-to-extract-run-commands-from-project-readmes/"
9983
target="_blank"
100-
rel="noopener">Full documentation on GitHub &rarr;</a
84+
rel="noopener"
10185
>
86+
Read the blog post &rarr;
87+
</a>
10288
</p>
10389
</section>
10490

105-
<section class="links-section">
91+
<section class="usage-section">
92+
<h2>Usage</h2>
93+
94+
<div class="command-table">
95+
<CommandTable />
96+
</div>
97+
10698
<p class="usage-docs-link">
10799
<a
108-
href="https://blog.gregdev.com/posts/2026-03-18-hdi-a-cli-tool-to-extract-run-commands-from-project-readmes/"
100+
href="https://github.com/grega/hdi#usage"
109101
target="_blank"
110-
rel="noopener">Read the blog post &rarr;</a
102+
rel="noopener"
111103
>
104+
Full documentation on GitHub &rarr;
105+
</a>
112106
</p>
113107
</section>
114108
</main>
@@ -118,42 +112,39 @@ $ hdi
118112
/* ── About page ─────────────────────────────────────────────────────── */
119113

120114
.about {
115+
--space: 3rem;
116+
121117
flex: 1;
122118
padding: 2rem 1.5rem;
123119
max-width: 48rem;
124120
margin: 0 auto;
125121
width: 100%;
126122

127-
--space: 3rem;
128-
129123
h2 {
130124
font-size: 1.25rem;
131125
color: var(--sapphire);
132126
margin-bottom: 1.5rem;
127+
display: flex;
128+
align-items: center;
129+
gap: 0.5rem;
133130
}
134131
h2::before {
135132
content: "▸ ";
136133
}
137134

135+
h2::after {
136+
content: "";
137+
flex: 1;
138+
background-color: var(--surface1);
139+
block-size: 1px;
140+
}
141+
138142
p {
139143
line-height: 1.5;
140-
141-
code {
142-
background: var(--crust);
143-
padding: 0.125em 0.375em;
144-
border-radius: 2px;
145-
146-
@media (prefers-color-scheme: dark) {
147-
background: var(--surface0);
148-
}
149-
}
144+
margin-block-start: 0.75rem;
150145
}
151146
}
152147

153-
.about .links-section {
154-
margin-top: 1.5rem;
155-
}
156-
157148
/* ── Hero ─────────────────────────────────────────────────────── */
158149

159150
.hero {
@@ -165,21 +156,17 @@ $ hdi
165156
}
166157

167158
.hero-header {
168-
align-items: center;
169159
--space: 1.5rem;
160+
align-items: center;
170161
}
171162

172163
.hero h1 {
173164
font-weight: 400;
174165
}
175166

176-
.hero-accent {
177-
color: var(--yellow);
178-
}
179-
180167
.hero-content {
181-
align-items: center;
182168
--space: 1.5rem;
169+
align-items: center;
183170
}
184171

185172
.hero-text {
@@ -213,67 +200,25 @@ $ hdi
213200
border: 0.0625rem solid var(--surface0);
214201
}
215202

216-
.demo-link {
217-
margin-top: 0.75rem;
218-
text-align: left;
219-
}
220-
221-
.demo-link a {
222-
color: var(--sapphire);
223-
}
224-
225203
/* ── Install ─────────────────────────────────────────────────────── */
226204

227205
.install-note {
228-
margin-top: 0.75rem;
229206
color: var(--subtext0);
230207
}
231208

232209
/* ── Usage ─────────────────────────────────────────────────────── */
233210

234-
.usage-block {
235-
background: var(--mantle);
236-
border: 0.0625rem solid var(--surface0);
237-
border-radius: 0.375rem;
238-
padding: 1rem 1.25rem;
239-
overflow-x: auto;
240-
line-height: 1.6;
241-
margin-bottom: 1.25rem;
242-
}
243-
244-
.usage-block code {
245-
font-family: var(--font-mono);
246-
color: var(--text);
247-
}
248-
249-
.u-yellow {
250-
color: var(--yellow);
251-
}
252-
.u-sapphire {
253-
color: var(--sapphire);
254-
}
255-
.u-green {
256-
color: var(--green);
257-
}
258-
259-
.usage-docs-link a {
260-
color: var(--sapphire);
261-
text-decoration: none;
262-
}
263-
264-
.usage-docs-link a:hover {
265-
text-decoration: underline;
211+
/* :global needed to escape scoped styles and apply to rendered markdown */
212+
.command-table :global(td:first-child),
213+
.command-table :global(th:first-child) {
214+
min-width: min(20ch, 30vw);
266215
}
267216

268217
/* ── Responsive ─────────────────────────────────────────────────────── */
269218

270219
@media (max-width: 43.75rem) {
271-
/* About */
272220
.about {
273221
padding: 1rem 1.5rem 2rem;
274222
}
275-
.links-section {
276-
flex-direction: column;
277-
}
278223
}
279224
</style>

0 commit comments

Comments
 (0)