Skip to content

Commit

Permalink
feat: update packages, improve naming and structure, prepare for sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
its-darsh committed Dec 23, 2024
1 parent 8cbe6de commit f4b962c
Show file tree
Hide file tree
Showing 34 changed files with 1,818 additions and 2,297 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/astro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Install Fabric Deps
run: |
sudo apt-get update
sudo apt-get install -y -m libgtk-3-dev libcairo2-dev pkg-config libgirepository1.0-dev gobject-introspection gir1.2-glib-2.0 libgtk-layer-shell-dev libdbusmenu-gtk3-dev libcinnamon-desktop-dev webkit2gtk-4.1-dev libwebkit2gtk-4.1-0 libwebkit2gtk-4.1-dev librsvg2-2 librsvg2-common librsvg2-dev
- name: Checkout
uses: actions/checkout@v4
- name: Detect package manager
Expand Down Expand Up @@ -66,6 +70,8 @@ jobs:
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
working-directory: ${{ env.BUILD_PATH }}
- name: Generate Sphinx Pages
run: sh ./buildsphinx.sh
- name: Build with Astro
run: |
${{ steps.detect-package-manager.outputs.runner }} astro build \
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# prebuilt using a script
src/content/docs/api/*

# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production
Expand Down
75 changes: 49 additions & 26 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-check
import starlightSidebarTopics from "starlight-sidebar-topics";
import { prefixLinks } from "./src/plugins/CorrectURL";
import starlightVersions from "starlight-versions";
import { defineConfig } from "astro/config";
Expand All @@ -21,17 +22,54 @@ const BASE_URL = "";
export default defineConfig({
base: BASE_URL,
site: SITE_URL,
trailingSlash: "always",
trailingSlash: "ignore",
markdown: {
remarkPlugins: [prefixLinks({ base: BASE_URL + "/" })],
},
integrations: [
starlight({
title: "Fabric",
plugins: [
starlightVersions({
versions: [{ slug: "0.0.1", label: "v0.0.1" }],
}),
// starlightVersions({
// versions: [{ slug: "0.0.1", label: "v0.0.1" }],
// }),
starlightSidebarTopics([
{
label: "Guides",
link: "/getting-started/introduction/",
icon: "open-book",
items: [
{
label: "Getting Started",
autogenerate: { directory: "getting-started" },
},
{
label: "Guide",
autogenerate: { directory: "guide" },
},
{
label: "Community Snippets",
autogenerate: { directory: "snippets" },
},
{
label: "Contributing",
autogenerate: { directory: "contributing" },
collapsed: true,
},
],
},
{
label: "API Reference",
link: "/api/fabric/",
icon: "information",
items: [
{
label: "Parent Package",
autogenerate: { directory: "api" },
},
],
},
]),
],
editLink: {
baseUrl: "https://github.com/Fabric-Development/fabric-wiki/edit/",
Expand All @@ -45,28 +83,6 @@ export default defineConfig({
github: "https://github.com/Fabric-Development/fabric",
discord: "https://discord.gg/3sDbYc9SZP",
},
sidebar: [
{
label: "Introduction",
autogenerate: { directory: "introduction" },
},

{
label: "Guide",
autogenerate: { directory: "guide" },
},

{
label: "Widgets",
autogenerate: { directory: "widgets" },
},

{
label: "Community Snippets",
autogenerate: { directory: "snippets" },
},
],

customCss: [
"./src/tailwind.css",
"./src/styles/custom.css",
Expand All @@ -92,4 +108,11 @@ export default defineConfig({
include: "./src/components/*.[jsx|tsx]",
}),
],
vite: {
resolve: {
alias: {
"@components": "/src/components",
},
},
},
});
70 changes: 70 additions & 0 deletions buildsphinx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash

set -euo pipefail

project_root=$(realpath "$(dirname "$0")")
temp_folder="$project_root/.ignore-me-fabric-tmp"
dest_folder="$project_root/src/content/docs/api/"
# fabric_repo_url="https://github.com/Fabric-Development/fabric"

# temporary until it's merged
fabric_repo_url="https://github.com/its-darsh/fabric"
default_branch="sphinx"

log() {
echo -e "\033[1;32m[INFO]\033[0m $1"
}

error() {
echo -e "\033[1;31m[ERROR]\033[0m $1" >&2
}

clean_up() {
log "Cleaning up temporary files..."
rm -rf "$temp_folder"
}

cd "$project_root"

if [ -d "$temp_folder" ] && [ "${1:-}" != "clean" ]; then
log "Fabric source found, updating it..."
cd "$temp_folder"
git reset --hard HEAD
git pull origin $default_branch --rebase
log "Updated Fabric source."
else
log "Cloning a fresh copy of Fabric's source..."
clean_up
git clone $fabric_repo_url -b $default_branch "$temp_folder"
fi

log "Setting up Python virtual environment..."
cd "$temp_folder"
python -m venv venv
source venv/bin/activate

log "Installing required Python packages..."
pip install -e .
pip install sphinx recommonmark sphinx-markdown-builder sphinxawesome-theme sphinx-toolbox

log "Building Sphinx documentation..."
cd docs
make clean markdown

log "Sphinx build complete. Verifying output..."
if [ ! -d "build/markdown" ]; then
error "Markdown output not found in 'build/markdown'. Exiting."
exit 1
fi

log "Produced output..."
ls build/markdown

log "Cleaning up destination folder: $dest_folder"
rm -rf "$dest_folder"/*

log "Copying built documentation to destination: $dest_folder"
mkdir -p "$dest_folder"
cp -r build/markdown/[!\.]* $dest_folder

log "Copy complete. Build finished successfully."
Loading

0 comments on commit f4b962c

Please sign in to comment.