Skip to content

Commit b99c8dc

Browse files
committed
fix(quoteforge[site]): inject version from package.json instead of hardcoding
1 parent 5d92168 commit b99c8dc

6 files changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@ jobs:
180180
--title "quoteforge $VERSION" \
181181
--body "Auto-generated by quoteforge release workflow." \
182182
--base main || echo "PR already exists"
183-
gh pr merge "$branch" --merge --delete-branch --admin
183+
gh pr merge "$branch" --merge --delete-branch

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Installs to `~/.local/bin`. Add to `PATH` if needed:
2424
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
2525
```
2626

27-
Override with `QUOTEFORGE_INSTALL_DIR=/usr/local/bin` or `QUOTEFORGE_VERSION=v0.2.1`.
27+
Override with `QUOTEFORGE_INSTALL_DIR=/usr/local/bin` or `QUOTEFORGE_VERSION=vX.Y.Z` (any tag from [releases](https://github.com/lordvins226/quoteforge/releases)).
2828

2929
### Pre-built Binaries
3030

@@ -50,7 +50,7 @@ bun install
5050
### Verify
5151

5252
```bash
53-
quoteforge --version # 0.2.1
53+
quoteforge --version # prints the installed version
5454
quoteforge doctor # reports assets, Chrome, runtime
5555
```
5656

site/src/components/Install.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function Install() {
2929
</CodeBlock>
3030
<CodeBlock title="verify">
3131
<span className="text-fog-3">$ </span>quoteforge --version
32-
{"\n"}0.2.1
32+
{"\n"}{__APP_VERSION__}
3333
{"\n"}
3434
<span className="text-fog-3">$ </span>quoteforge doctor
3535
{"\n"}

site/src/docs/getting-started.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Installs to `~/.local/bin`. Add to your `PATH` if needed:
2222
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
2323
```
2424

25-
Override the install target with `QUOTEFORGE_INSTALL_DIR=/usr/local/bin` or pin a version with `QUOTEFORGE_VERSION=v0.2.1`.
25+
Override the install target with `QUOTEFORGE_INSTALL_DIR=/usr/local/bin` or pin a version with `QUOTEFORGE_VERSION=vX.Y.Z` (any tag from [the releases page](https://github.com/lordvins226/quoteforge/releases)).
2626

2727
### Pre-built binaries
2828

@@ -49,7 +49,7 @@ Run from source with `bun run quoteforge -- <args>`.
4949
## Verify
5050

5151
```bash
52-
quoteforge --version # prints 0.2.1
52+
quoteforge --version # prints the installed version
5353
quoteforge doctor # reports assets, Chrome, runtime
5454
```
5555

site/src/vite-env.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference types="vite/client" />
2+
3+
declare const __APP_VERSION__: string;

site/vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ import tailwind from "@tailwindcss/vite";
44
import mdx from "@mdx-js/rollup";
55
import remarkGfm from "remark-gfm";
66
import rehypePrettyCode from "rehype-pretty-code";
7+
import { readFileSync } from "node:fs";
8+
import { fileURLToPath } from "node:url";
9+
10+
const rootPkg = JSON.parse(
11+
readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf-8"),
12+
) as { version: string };
713

814
export default defineConfig({
15+
define: {
16+
__APP_VERSION__: JSON.stringify(rootPkg.version),
17+
},
918
plugins: [
1019
{
1120
enforce: "pre",

0 commit comments

Comments
 (0)