Skip to content

Commit ba88dba

Browse files
authored
improvements (#9)
* small improvements * fix for standalone .mdx files + typesafety for generated pages and sections fixed * small changes * updates * small updates * fixes * fixes * small updates * deployed app using standard fly launch and fly deploy commands * fixes in loding content collections and some UI fixes * removed content-collections:build script from package.json * accordion component updated * added on PR fly deploy action * removed flydotio/dockerfile * fixed content-ollections Page imports * fly deploy workflow update * fly deploy workflow update * content-collections cli returned * added small console log for debugging * added small console log for debugging * added small console log for debugging * added small console log for debugging and pr-close workflow * small fix * updated env_vars in ci.yml * debounced search * small update in seo.ts and favion.ico changed * added meta for index page * small fix in filename * fix with seo image? * small fixes in padding, leading, font size * update in fly.toml, dockerfile and package.json * small change in dockerifle * added http_checks in fly.toml * small update in fly.toml * small update? * fly tol update * previous state? * check? * previous state * small fix
1 parent 24c6153 commit ba88dba

File tree

87 files changed

+957
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+957
-510
lines changed

.dockerignore

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
node_modules
2+
public/build
3+
build
4+
dist
5+
out
6+
coverage
7+
.history
8+
.react-router
9+
10+
# Other Coverage tools
11+
*.lcov
12+
13+
# macOS
14+
.DS_*
15+
16+
# Cache Directories and files
17+
.cache
18+
.yarn*
19+
.env*
20+
!.env.example
21+
.swp*
22+
.turbo
23+
.npm
24+
.stylelintcache
25+
*.tsbuildinfo
26+
.node_repl_history
27+
28+
# Lock files from other package managers
29+
package-lock.json
30+
yarn.lock
31+
32+
# General tempory files and directories
33+
t?mp
34+
.t?mp
35+
*.t?mp
36+
37+
# Docusaurus cache and generated files
38+
.docusaurus
39+
40+
# Output of 'npm pack'
41+
*.tgz
42+
*.tar
43+
*.tar.gz
44+
*.tar.bz2
45+
*.tbz
46+
*.zip
47+
48+
# Runtime data
49+
pids
50+
*.pid
51+
*.seed
52+
*.pid.lock
53+
54+
# Diagnostic reports (https://nodejs.org/api/report.html)
55+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
56+
57+
# Logs
58+
logs
59+
*.log
60+
npm-debug.log*
61+
yarn-debug.log*
62+
yarn-error.log*
63+
lerna-debug.log*
64+
.pnpm-debug.log*
65+
vite.config.ts.*
66+
67+
# Playwright various test reports
68+
test-results
69+
playwright-report
70+
blob-report
71+
72+
73+
# Editors
74+
.idea/workspace.xml
75+
.idea/usage.statistics.xml
76+
.idea/shelf
77+
78+
# Dont commit sqlite database files
79+
*.db
80+
*.sqlite
81+
*.sqlite3
82+
*.db-journal
83+
84+
85+
# Content collections output files
86+
.content-collections
87+
88+
# Output base directory of the documentation
89+
generated-docs/

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
GITHUB_OWNER="github-owner" # Your username or organization name (Optional. For edit/report an issue for the documentation page)
22
GITHUB_REPO="github-repo" # Repository name (Optional. For edit/report an issue for the documentation page)
33
APP_ROOT_PATH="/path/to/your/app" # Optional. Default is `process.cwd()`
4+
GITHUB_REPO_URL="github-repo-url" # Optional. If you want to have GitHub icon link in the header or footer
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 🚀 Validation Pipeline
1+
name: 🚀 Validation & Deploy Pipeline
22
concurrency:
33
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
44
cancel-in-progress: true
@@ -67,3 +67,24 @@ jobs:
6767
# Only works if you set `reportOnFailure: true` in your vite config as specified above
6868
if: always()
6969
uses: davelosert/vitest-coverage-report-action@v2
70+
71+
72+
deploy:
73+
needs: [lint, typecheck, check-unused, vitest]
74+
name: 🚀 Deploy PR Preview
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
- uses: forge-42/fly-deploy@v1.0.0-rc.2
79+
id: deploy
80+
env:
81+
FLY_ORG: ${{ vars.FLY_ORG }}
82+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
83+
FLY_REGION: ${{ vars.FLY_REGION }}
84+
with:
85+
app_name: ${{github.event.repository.name}}-${{ github.event.number }}
86+
env_vars: |
87+
APP_ENV=staging
88+
GITHUB_OWNER=${{github.repository_owner}}
89+
GITHUB_REPO=${{github.event.repository.name}}
90+
GITHUB_REPO_URL=https://github.com/${{ github.repository }}

.github/workflows/pr-close.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 🧹 PR Close
2+
3+
concurrency:
4+
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
pull_request:
9+
branches: [main]
10+
types: closed
11+
12+
jobs:
13+
14+
destroy-pr-preview:
15+
name: 🧹 Destroy PR Preview
16+
runs-on: ubuntu-latest
17+
environment:
18+
name: pr-preview
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: forge-42/fly-destroy@v1.0.0-rc.2
22+
id: destroy
23+
env:
24+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
25+
FLY_ORG: ${{ vars.FLY_ORG }}
26+
with:
27+
app_name: ${{ env.FLY_ORG }}-${{ github.event.number }}

Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
# syntax = docker/dockerfile:1.4
3+
4+
# Base dependencies stage
5+
ARG NODE_VERSION=22.17.0
6+
FROM node:${NODE_VERSION}-slim AS base
7+
8+
LABEL fly_launch_runtime="Node.js"
9+
10+
# Node.js app lives here
11+
WORKDIR /app
12+
13+
# Set production environment
14+
ENV NODE_ENV="production"
15+
16+
# Install pnpm
17+
ARG PNPM_VERSION=10.13.0
18+
RUN npm install -g pnpm@$PNPM_VERSION
19+
20+
21+
# Throw-away build stage to reduce size of final image
22+
FROM base AS build
23+
24+
# Install packages needed to build node modules
25+
RUN apt-get update -qq && \
26+
apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3 git
27+
28+
# Install node modules
29+
COPY .npmrc package.json pnpm-lock.yaml ./
30+
RUN pnpm install --frozen-lockfile --prod=false
31+
32+
# Copy application code
33+
COPY . .
34+
35+
# Build application
36+
RUN pnpm run generate:docs
37+
RUN pnpm run build
38+
39+
# Remove development dependencies
40+
RUN pnpm prune --prod
41+
42+
43+
# Final stage for app image
44+
FROM base
45+
46+
# Copy built application
47+
COPY --from=build /app /app
48+
49+
# Start the server by default, this can be overwritten at runtime
50+
EXPOSE 3000
51+
CMD [ "pnpm", "run", "start" ]

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This folder contains all the resources used by the documentation site, such as S
1717

1818
`content/`
1919

20-
This folder contains sections and subsections with .mdx files that hold your documentation content. Below is the recommended structure to follow.
20+
This folder contains .md and .mdx files that hold your documentation content. Below is the recommended structure to follow.
2121

2222

2323
An example of a valid content/ folder structure for organizing your package documentation:
@@ -46,12 +46,15 @@ content/
4646
├── 01-buttons.mdx
4747
└── 02-modals.mdx
4848
```
49-
- Top-level .mdx files (like 01-changelog.mdx) are allowed.
50-
- Sections (like 04-getting-started, 05-core-features) are subfolders inside the content/ folder.
51-
- Subsections (like 03-data-management, 04-ui-components) are nested folders within sections.
52-
- Each section or subsection should have an index.md file for its sidebar title.
49+
- Top-level .mdx files (like 01-changelog.mdx) are allowed, but we recommend placing them in order before the sections, as shown in the example.
5350

54-
### Example of the valid `02-introduction.mdx` file:
51+
- Sections (like 04-getting-started, 05-core-features) are subfolders inside the `content` folder.
52+
53+
- Subsections (like 03-data-management, 04-ui-components) are nested folders within sections. Filenames inside them should start with `01-*.mdx`.
54+
55+
- Each section or subsection should include an `index.md` file, which defines its sidebar title.
56+
57+
### Example of the valid `**/*.mdx` file:
5558
```
5659
---
5760
title: "Introduction to Forge42 Base Stack"
@@ -75,7 +78,7 @@ cd my-app
7578
npm install
7679
```
7780

78-
### Example of the valid `04-getting-started/index.md` file:
81+
### Example of the valid `**/*.md` file:
7982
```
8083
---
8184
title: Getting Started

app/components/command-k/components/search-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function SearchInput({ value, onChange, placeholder, ref }: SearchInputPr
1313
return (
1414
<div
1515
className={cn(
16-
"flex items-center gap-3 border-[var(--color-input-border)] border-b bg-[var(--color-input-bg)] px-4 py-4"
16+
"flex items-center gap-3 border-[var(--color-input-border)] border-b bg-[var(--color-input-bg)] px-4 py-3"
1717
)}
1818
>
1919
<Icon name="Search" className="size-5 flex-shrink-0 text-[var(--color-input-icon)]" />

app/components/command-k/components/trigger-button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const TriggerButton = ({
1212
type="button"
1313
onClick={onOpen}
1414
className={cn(
15-
"group flex items-center gap-2 rounded-lg border px-3 py-2 text-sm shadow-sm transition-all duration-200",
15+
"group flex items-center gap-2 rounded-lg border px-2 py-1.5 text-sm shadow-sm transition-all duration-200 xl:px-3 xl:py-2",
1616
"border-[var(--color-trigger-border)] bg-[var(--color-trigger-bg)] text-[var(--color-trigger-text)]",
1717
"hover:border-[var(--color-trigger-hover-border)] hover:bg-[var(--color-trigger-hover-bg)] hover:shadow-md",
1818
"focus:border-[var(--color-trigger-focus-border)] focus:outline-none focus:ring-2 focus:ring-[var(--color-trigger-focus-ring)]"
@@ -22,8 +22,8 @@ export const TriggerButton = ({
2222
name="Search"
2323
className={cn("size-4 transition-colors", "group-hover:text-[var(--color-trigger-hover-text)]")}
2424
/>
25-
<span className="hidden sm:inline">{placeholder}</span>
26-
<div className="ml-auto hidden items-center gap-1 sm:flex">
25+
<span className="hidden xl:inline">{placeholder}</span>
26+
<div className="ml-auto hidden items-center gap-1 xl:flex">
2727
<kbd
2828
className={cn(
2929
"rounded border border-[var(--color-kbd-border)] bg-[var(--color-kbd-bg)] px-1.5 py-0.5 font-mono text-xs",

app/components/command-k/create-search-index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,11 @@ function extractHeadingSections(rawMdx: string) {
108108

109109
export function createSearchIndex(pages: Page[]) {
110110
return pages
111-
.filter((page) => page._meta.fileName !== "_index.mdx" && page.slug !== "_index")
111+
.filter((page) => page.slug !== "_index")
112112
.flatMap((page) => {
113113
const pageSlug = getPageSlug(page)
114114
const pageUrl = pageSlug.startsWith("/") ? pageSlug : `/${pageSlug}`
115115
const sections = extractHeadingSections(page.rawMdx)
116-
117116
return sections.map((section) => {
118117
const heading = section.heading === "_intro" ? page.title : section.heading
119118

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { useEffect, useState } from "react"
2+
3+
export function useDebounce<T>(value: T, delay = 250) {
4+
const [debouncedValue, setDebouncedValue] = useState<T>(value)
5+
6+
useEffect(() => {
7+
const id = setTimeout(() => setDebouncedValue(value), delay)
8+
return () => clearTimeout(id)
9+
}, [value, delay])
10+
11+
return debouncedValue
12+
}

0 commit comments

Comments
 (0)