Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): remove default nx landing page and make docs homepage base route #162

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ const nextConfig = {
reactStrictMode: true,
output: 'standalone',
},
images: {
remotePatterns: [
{
protocol: 'https',
// eslint-disable-next-line node/prefer-global/process
hostname: process.env.ALLOWED_IMAGE_HOSTNAME || 'avatars.githubusercontent.com',
},
],
},
}

const withMDX = createMDX({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export default async function Page({
}

const MDX = page.data.exports.default
const path = `src/content/docs/${page.file.path}`
const path = `src/content/(docs)/${page.file.path}`
const gitHubRepoUrl = packageJson.repository.url.replace(/\.git$/, '') // Remove .git suffix

const footer = (
<>
<a
href={`${gitHubRepoUrl}/blob/main/apps/docs/${path}`}
href={`${gitHubRepoUrl}/blob/main/apps/(docs)/${path}`}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Issue Found: Incorrect GitHub URL Path

The "Edit on GitHub" link is pointing to a non-existent apps/(docs)/ directory. Based on the repository structure, the correct path should likely be docs/src/app/(docs)/.

  • Update the href to:
    href={`${gitHubRepoUrl}/blob/main/docs/src/app/(docs)/${path}`}
    

Please verify that the updated path correctly points to the intended files in the repository.

🔗 Analysis chain

LGTM! Verify GitHub repository structure.

The update to the GitHub repository URL for editing the page is consistent with the changes made to the content path. This ensures that the "Edit on GitHub" link will correctly point to the new file location.

To ensure everything is correctly set up, please verify:

  1. The GitHub repository structure matches this new path (apps/(docs)/...).
  2. The "Edit on GitHub" links are functional and lead to the correct files.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the GitHub repository structure and link functionality

# Extract the GitHub repository URL from package.json
REPO_URL=$(jq -r '.repository.url' package.json | sed 's/\.git$//')

# Check the structure of the apps/(docs) directory in the repository
echo "Checking the structure of apps/(docs) directory in the repository:"
gh repo view $REPO_URL --json files --jq '.files[] | select(.path | startswith("apps/(docs)/"))'

# Test a sample "Edit on GitHub" link
SAMPLE_FILE="src/content/(docs)/index.mdx"
if [ -f "$SAMPLE_FILE" ]; then
    EDIT_URL="${REPO_URL}/blob/main/apps/(docs)/${SAMPLE_FILE}"
    echo "Testing sample 'Edit on GitHub' link:"
    echo $EDIT_URL
    # Use curl to check if the URL is accessible
    curl -s -o /dev/null -w "%{http_code}" $EDIT_URL
else
    echo "Sample file $SAMPLE_FILE not found."
fi

Length of output: 1693


Script:

#!/bin/bash
# Verify the existence of the apps/(docs) directory and the sample file

# Extract the GitHub repository URL from package.json
REPO_URL=$(jq -r '.repository.url' package.json | sed 's/\.git$//')

echo "Searching for the 'apps/(docs)' directory in the repository:"
fd "apps/\(docs\)" --type d

echo "Searching for the sample file 'apps/(docs)/index.mdx':"
fd "index.mdx" apps/(docs)/

Length of output: 561


Script:

#!/bin/bash
# Correctly escape parentheses and verify the existence of the apps/(docs) directory and the sample file

# Extract the GitHub repository URL from package.json
REPO_URL=$(jq -r '.repository.url' package.json | sed 's/\.git$//')

echo "Searching for the 'apps/(docs)' directory in the repository:"
fd "apps/\\(docs\\)" --type d

echo "Searching for the sample file 'apps/(docs)/index.mdx':"
fd "index.mdx" "apps/(docs)/"

Length of output: 524


Script:

#!/bin/bash
# List all directories within the apps/ directory to identify the correct 'docs' path

echo "Listing all directories within 'apps/':"
fd . --type d --base-directory apps/

Length of output: 2612

target="_blank"
rel="noreferrer noopener"
className="inline-flex items-center justify-center rounded-md font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-secondary/80 h-9 px-3 text-xs gap-1.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const baseOptions: HomeLayoutProps = {
<span className="text-lg font-bold">cuHacking DevDocs</span>
</>
),
url: '/docs',
url: '/',
},
githubUrl: 'https://github.com/cuhacking/hackathon',
links: [
Expand Down Expand Up @@ -83,7 +83,7 @@ export const docsOptions: DocsLayoutProps = {
options={pages.map(page => ({
title: page.title,
description: page.description,
url: `/docs/${page.url}`,
url: `/${page.url}`,
icon: (
<page.icon
className="size-9 shrink-0 rounded-md bg-gradient-to-t from-background/80 p-1.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const pages = [
]

export const { getPage, getPages, pageTree } = loader({
baseUrl: '/docs',
baseUrl: '/',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Residual '/docs' References Detected

The verification script identified several files containing '/docs' references that may need updating to align with the new baseUrl change:

  • apps/docs/src/app/docs/source.ts
  • apps/docs/src/content/docs/index.mdx
  • apps/docs/src/content/docs/knowledge-base/nextauth.mdx
  • apps/docs/src/content/docs/knowledge-base/index.mdx
  • apps/docs/src/content/docs/contribution-guidelines/conventional-commits.mdx
  • apps/docs/src/app/api/search/route.ts
  • apps/docs-e2e/src/docs.spec.ts
  • apps/landing-page/src/pages/homePage/heroSection/SocialsPannel.tsx

Please review and update these references to ensure consistency and prevent potential routing issues.

🔗 Analysis chain

LGTM! The baseUrl change aligns with the PR objectives.

The modification of baseUrl from '/docs' to '/' correctly implements the desired change to streamline the documentation URL structure as described in the PR objectives.

To ensure consistency across the codebase, let's verify that there are no remaining references to the old '/docs' base URL:

Please review the results of this search and update any remaining '/docs' references if necessary.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining '/docs' references that might need updating

# Test: Search for '/docs' references in all files. 
# Expect: No occurrences of '/docs' that are related to URL routing or base paths.
rg '/docs' --type-not md

Length of output: 16504

rootDir: 'docs',
icon(icon) {
if (!icon) {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/app/api/search/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createSearchAPI } from 'fumadocs-core/search/server'
import { getPages } from '../../../app/docs/source'
import { getPages } from '../../../app/(docs)/source'

export const { GET } = createSearchAPI('advanced', {
indexes: getPages().map(page => ({
Expand Down
Loading
Loading